Jump to content

Recommended Posts

Posted (edited)

Here's some simple functions which convert Dell Service Tags to their equivalent Express Service Codes and vice versa. Not sure if it's of any use, but it is for me, it's easier to type the express service code in on the phone being that it's all numbers. Suggestions and comments welcome.

#include <GuiConstants.au3>

GuiCreate("Dell ESC Utility", 192, 185,(@DesktopWidth-192)/2, (@DesktopHeight-185)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Tag_Input = GuiCtrlCreateInput("", 0, 70, 190, 20)
$ESC_Input = GuiCtrlCreateInput("", 0, 120, 190, 20)
$ESC_Label = GuiCtrlCreateLabel("Express Service Code", 0, 100, 190, 20)
$Tag_Label = GuiCtrlCreateLabel("Service Tag", 0, 50, 190, 20)
$Clear_Button = GuiCtrlCreateButton("Clear", 140, 150, 50, 30)
$Info_Label = GuiCtrlCreateLabel("Enter either the Dell Service Tag or" & @CRLF & "the Express Service Code", 0, 10, 190, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Tag_Input
        GUICtrlSetData($Tag_Input, StringUpper(GUICtrlRead($Tag_Input)))
        GUICtrlSetData($ESC_Input, _Tag2ESC(GUICtrlRead($Tag_Input)))
    Case $msg = $ESC_Input
        GUICtrlSetData($Tag_Input, _ESC2Tag(GUICtrlRead($ESC_Input)))
    Case $msg = $Clear_Button
        GuiCtrlSetData($Tag_Input, "")
        GuiCtrlSetData($ESC_Input, "")
    EndSelect
WEnd
Exit

Func _ValidTagFormat($strTAG)
    $result = 0
    If $strTAG <> "" And $strTAG <> "00000" Then
        $strTAG = StringUpper($strTAG)
        $intLength = StringLen($strTAG)
        If $intLength = 5 Or $intLength = 7 Then
            For $i = 1 To $intLength
                $intCharCode = Asc(StringMid($strTAG, $i, 1))
                If Number($intCharCode) >= 65 And Number($intCharCode) <= 90 Then
                    $result = 1
                ElseIf Number($intCharCode) >= 48 And Number($intCharCode) <= 57 Then
                    $result = 1
                Else
                    $result = 0
                    Return $result
                EndIf
            Next
        EndIf
    EndIf
    Return $result
EndFunc

Func _Tag2ESC($strTAG)
    If _ValidTagFormat($strTAG) Then
        $intLength = StringLen($strTAG)
        Dim $intESC
        Dim $Digit[$intLength + 1]
        $x = 1
        For $i = $intLength To 1 Step - 1
            $Digit[$x] = StringUpper(StringMid($strTAG, $i, 1))
            $x = $x + 1
        Next
        For $i = 1 To $intLength
            If Asc($Digit[$i]) <= 57 Then
                $intESC = $intESC + 36 ^ ($i - 1) * Number($Digit[$i])
            Else
                $intESC = $intESC + 36 ^ ($i - 1) * (Asc($Digit[$i]) - 55)
            EndIf
        Next
        Return $intESC
    EndIf
EndFunc

Func _ESC2Tag($intESC)
    $intESC = StringReplace($intESC, "-", "")
    $intESC = Number($intESC)
    Dim $strTAG
    If IsNumber($intESC) And $intESC > 0 Then
        If $intESC = 1 Then
            $strTAG = "00001"
        Else
            $sESC = 4
            If $intESC > 60466175 Then
                $sESC = 6
            EndIf
            For $i = $sESC To 0 Step - 1
                $intDigit = Int($intESC / (36 ^ $i))
                If Not IsNumber($intDigit) Then
                    $intDigit = 0
                    $strTAG = String($strTAG) & String($intDigit)
                ElseIf Number($intDigit) < 10 Then
                    $strTAG = String($strTAG) & String($intDigit)
                Else
                    $strTAG = String($strTAG) & (Chr(Number($intDigit) + 55))
                EndIf
                $intESCr = Number($intESC) - Number($intDigit * (36 ^ $i))
                If IsNumber($intESCr) Then
                    $intESC = $intESCr
                EndIf
            Next
        EndIf
    EndIf
    If _ValidTagFormat($strTAG) Then
        Return StringUpper($strTAG)
    Else
        Return ""
    EndIf
EndFunc
Edited by archrival
Posted

Here's some simple functions which convert Dell Service Tags to their equivalent Express Service Codes and vice versa.

I use ST2ESC conversions daily with Active Directory. Thanks for your work. I've been using dosxpres.exe to do the conversion from st to esc, but I like having AutoIT functions to do it better!
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
  • 2 weeks later...
Posted

Thanks for sharing this, make sure your techs re-set your Dell Service Tag in non-volatile memory if you have a motherboard replaced.

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Posted

Thanks for sharing this, make sure your techs re-set your Dell Service Tag in non-volatile memory if you have a motherboard replaced.

You can do this yourself as well with the asset.com program. It's a download from Dell. You must know the command line parameters also which are something like: asset /s nnnnnnn (nnnnnnn = service tag)
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...