#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Icons\rm_icon.ico #AutoIt3Wrapper_Compression=0 #AutoIt3Wrapper_Res_Description=General Purpose Automation #AutoIt3Wrapper_Res_Fileversion=1.0.0.4 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p #AutoIt3Wrapper_Res_LegalCopyright=Gareth Bale #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include #include #include #include #include #include _CommSetDllPath("P:\LNT\Source\commG\commg.dll") Opt("MustDeclareVars", 0) _commsetdllpath("P:\LNT\Source\commG\commg.dll") Opt("WinTitleMatchMode", 2) Opt("MouseCoordMode", 0) HotKeySet("{ESC}", "_exit") Global $station = _getstation(@ScriptDir) Global $mesnfile = @ScriptDir & "\MESN" & $station & ".txt" Global $prl10043 = @ScriptDir & "\AUTO_PRL\SPRINT_10043.prl" Global $prl52736 = @ScriptDir & "\AUTO_PRL\VERIZON_52736.prl" Global $cdmawindow = WinGetHandle("CDMA Workshop v3.9.0") Global $statusbar = ControlGetHandle($cdmawindow, "", "[CLASS:TStatusBar; INSTANCE:1]") #Region ### START Koda GUI section ### Form= $mainform = GUICreate("ResetAUTO", 300, 700, Default, Default) GUIStartGroup() $groupspc = GUICtrlCreateGroup("SPC", 10, 10, 280, 70) $radclear = GUICtrlCreateRadio("Clear SPC", 20, 30, 120, 20) $radsend6z = GUICtrlCreateRadio("Send 000000", 160, 30, 120, 20) $radsend16 = GUICtrlCreateRadio("Send 16 Digits", 20, 50, 120, 20) $radcalculate = GUICtrlCreateRadio("Calculate", 160, 50, 120, 20) GUIStartGroup() GUIStartGroup() $groupmesn = GUICtrlCreateGroup("ESN/MEID", 10, 90, 280, 90) $radesn = GUICtrlCreateRadio("ESN", 20, 110, 120, 20) $radmeid = GUICtrlCreateRadio("MEID", 20, 130, 120, 20) $radAkey = GUICtrlCreateRadio("MAkey", 160, 110, 120, 20) $radMSLMeid = GUICtrlCreateRadio("MSLMeid", 160, 130, 120, 20) $radMSLMKey = GUICtrlCreateRadio("MSLMAkey", 160, 150, 120, 20) GUIStartGroup() GUIStartGroup() $group3G = GUICtrlCreateGroup("Write3G", 10, 190, 280, 40) $rad3G = GUICtrlCreateRadio("3G", 20, 205, 120, 20) GUIStartGroup() GUIStartGroup() $groupprl = GUICtrlCreateGroup("PRL", 10, 240, 280, 70) $radspt = GUICtrlCreateRadio("SPRINT [10043]", 20, 260, 120, 20) $radvrz = GUICtrlCreateRadio("VERIZON [52736]", 20, 280, 120, 20) GUIStartGroup() GUIStartGroup() $groupmisc = GUICtrlCreateGroup("MISC.", 10, 320, 280, 70) $checknam = GUICtrlCreateCheckbox("NAM", 20, 340, 120, 20) $checknoread = GUICtrlCreateCheckbox("No Read", 20, 360, 120, 20) $checklockcode = GUICtrlCreateCheckbox("Clear Lock Code", 160, 340, 120, 20) $checkrports = GUICtrlCreateCheckbox("Reset COM Ports", 160, 360, 120, 20) GUIStartGroup() GUIStartGroup() $btnstart = GUICtrlCreateButton("START", 10, 400, 80, 30) $btnmesnfile = GUICtrlCreateButton("MESN FILE", 110, 400, 80, 30) $btnresetport = GUICtrlCreateButton("RESET COM", 210, 400, 80, 30) GUIStartGroup() GUIStartGroup() $labstation = GUICtrlCreateLabel("STATION " & $station, 10, 490, 280, 60) $labcount = GUICtrlCreateLabel("", 10, 440, 280, 40) GUIStartGroup() GUIStartGroup() GUICtrlCreateGroup("COM PORTS STATUS", 10, 540, 280, 150) Global $labcomstatus = GUICtrlCreateLabel("Sergio Ramos", 20, 560, 260, 125) GUIStartGroup() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nmsg = GUIGetMsg() _showcomstatus() Switch $nmsg Case $gui_event_close Exit Case $btnstart $statespc = _getspcstate(GUICtrlRead($radclear), GUICtrlRead($radsend6z), GUICtrlRead($radsend16), GUICtrlRead($radcalculate)) $statemesn = _getmesnstate(GUICtrlRead($radesn), GUICtrlRead($radmeid), GUICtrlRead($radAkey), GUICtrlRead($radMSLMeid), GUICtrlRead($radMSLMKey)) $stateWrite3G = _getWrite3Gstate(GUICtrlRead($rad3G)) $stateprl = _getprlstate(GUICtrlRead($radspt), GUICtrlRead($radvrz)) $statenam = GUICtrlRead($checknam) $statenoread = GUICtrlRead($checknoread) $statelockcode = GUICtrlRead($checklockcode) $staterports = GUICtrlRead($checkrports) GUICtrlSetState($radclear, 128) GUICtrlSetState($radsend6z, 128) GUICtrlSetState($radsend16, 128) GUICtrlSetState($radcalculate, 128) GUICtrlSetState($radesn, 128) GUICtrlSetState($radmeid, 128) GUICtrlSetState($radAkey, 128) GUICtrlSetState($radMSLMeid, 128) GUICtrlSetState($radMSLMKey, 128) GUICtrlSetState($rad3G, 128) GUICtrlSetState($radspt, 128) GUICtrlSetState($radvrz, 128) GUICtrlSetState($checknam, 128) GUICtrlSetState($checknoread, 128) GUICtrlSetState($checklockcode, 128) GUICtrlSetState($checkrports, 128) _startprocess($statespc, $statemesn, $stateWrite3G, $stateprl, $statenam, $statenoread, $statelockcode, $staterports) Case $btnmesnfile ShellExecute($mesnfile) Case $btnresetport _clearports() TrayTip("RAMOS", "All COM Ports have been resetted to default.", 10, 1) EndSwitch WEnd Func _showcomstatus() Local $aportnames = _comgetportnames() Local $counts = UBound($aportnames, 1) - 1 Local $message Local $i For $i = 0 To $counts $message &= $aportnames[$i][0] & " - " & $aportnames[$i][1] & @CRLF Next GUICtrlSetData($labcomstatus, $message) EndFunc Func _checknewphone() Local $text Local $check $text = ControlGetText("[CLASS:#32770]", "", "[CLASS:Edit; INSTANCE:4]") $check = StringInStr($text, "working properly") If $check > 0 Then Return True Else Return False EndIf EndFunc Func _checkconnected() Local $aports Local $aportnames Local $i Local $rows $aports = _commlistports(0) $aportnames = _comgetportnames() $rows = UBound($aportnames, 1) - 1 For $i = 0 To $rows If (NOT ($aportnames[$i][1] = "Communications Port")) AND (NOT ($aportnames[$i][1] = "RIM Virtual Serial Port v2")) Then Return True EndIf Next Return False EndFunc Func _startprocess($statespc, $statemesn, $stateWrite3G, $stateprl, $statenam, $statenoread, $statelockcode, $staterports) Local $changed Local $count Local $sbartext Local $esn Local $meid Local $cmexist Local $mesnleft Local $oldmesn Local $spc While (1) If $staterports = 1 Then _clearports() EndIf Do $changed = _checkconnected() _showcomstatus() Until $changed = True _showcomstatus() WinActivate($cdmawindow) WinWaitActive($cdmawindow) Sleep(1000) ControlClick($cdmawindow, "", "[CLASS:TPanel; INSTANCE:3]", "left", 1, 320, 10) Sleep(500) If $statenoread = 4 Then ControlClick($cdmawindow, "", "[CLASS:TPanel; INSTANCE:3]", "left", 1, 375, 10) Do $count = 0 $sbartext = _guictrlstatusbar_gettext($statusbar, 0) $count = StringInStr($sbartext, "Ready..") Until $count > 0 EndIf If NOT ($statespc = False) Then ControlClick($cdmawindow, "", "[CLASS:TPageControl; INSTANCE:1]", "left", 1, 120, 10) Sleep(200) If $statespc = 1 Then ControlClick($cdmawindow, "Read", "[CLASS:TButton; INSTANCE:6]") Sleep(400) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") Sleep(400) Send("{DOWN}{ENTER}") Sleep(400) WinWaitActive("Information") Sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") Sleep(400) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") Sleep(400) Send("{DOWN 4}{ENTER}") Sleep(400) WinWaitActive("Information") Sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") ElseIf $statespc = 2 Then ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") Sleep(400) Send("{DOWN 2}{ENTER}") Sleep(400) WinWaitActive("Information") Sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") ElseIf $statespc = 3 Then ControlClick($cdmawindow, "Send", "[CLASS:TButton; INSTANCE:4]") Sleep(400) WinWaitActive("Information") Sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") Sleep(400) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") Sleep(400) Send("{DOWN}{ENTER}") Sleep(400) WinWaitActive("Information") Sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") Sleep(400) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") Sleep(400) Send("{DOWN 4}{ENTER}") WinWaitActive("Information") Sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") ElseIf $statespc = 4 Then $oldmesn = _readoldmesn(0) $spc = _calcspc($oldmesn) ControlSetText($cdmawindow, "", "[CLASS:TmvbBtnEdit; INSTANCE:2]", $spc) Sleep(400) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") Sleep(400) Send("{DOWN}{ENTER}") Sleep(400) WinWaitActive("Information") Sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") Sleep(400) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") Sleep(400) Send("{DOWN 4}{ENTER}") Sleep(400) WinWaitActive("Information") Sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") EndIf EndIf If ($statelockcode = 1) AND NOT ($statespc = False) Then ControlClick($cdmawindow, "", "[CLASS:TButton; INSTANCE:7]") ControlSetText($cdmawindow, "", "[CLASS:TmvbBtnEdit; INSTANCE:3]", "0000") ControlClick($cdmawindow, "Write", "[CLASS:TButton; INSTANCE:8]") WinWaitActive("Information") ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") ControlClick($cdmawindow, "", "[CLASS:TButton; INSTANCE:7]") EndIf If NOT ($statemesn = False) Then ControlClick($cdmawindow, "", "[CLASS:TPageControl; INSTANCE:1]", "left", 1, 120, 10) Sleep(1000) If $statemesn = 1 Then $esn = _getmesn($mesnfile) Sleep(500) ControlSetText($cdmawindow, "", "[CLASS:TEdit; INSTANCE:4]", $esn) Sleep(400) ControlClick($cdmawindow, "Write", "[CLASS:TButton; INSTANCE:9]") Sleep(500) $cmexist = ControlGetText($cdmawindow, "", "[CLASS:TComboBox; INSTANCE:4]") If ($cmexist = "HTC method") Then ControlClick("Choose action:", "Ok", "[CLASS:TButton; INSTANCE:1]") ElseIf ($cmexist = "LG method") Then ControlClick("Choose method", "Ok", "[CLASS:TButton; INSTANCE:1]") EndIf WinWaitActive("Information") Sleep(350) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") ElseIf $statemesn = 2 Then $meid = _getmesn($mesnfile) Sleep(500) ControlSetText($cdmawindow, "", "[CLASS:TEdit; INSTANCE:1]", $meid) Sleep(400) ControlClick($cdmawindow, "Write", "[CLASS:TButton; INSTANCE:2]") Sleep(500) $cmexist = ControlGetText($cdmawindow, "", "[CLASS:TComboBox; INSTANCE:2]") If ($cmexist = "HTC method") Then ControlClick("Choose action:", "Ok", "[CLASS:TButton; INSTANCE:1]") ElseIf ($cmexist = "LG method") Then ControlClick("Choose method", "Ok", "[CLASS:TButton; INSTANCE:1]") EndIf WinWaitActive("Information") Sleep(350) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") ElseIf $statemesn = 3 Then $meid = _getmesn($mesnfile) $splitted = StringSplit($meid, @TAB) sleep(500) ControlSetText($cdmawindow, "", "[CLASS:TEdit; INSTANCE:1]", $splitted[1]) ControlClick($cdmawindow, "Write", "[CLASS:TButton; INSTANCE:2]") Sleep(500) $cmexist = ControlGetText($cdmawindow, "", "[CLASS:TComboBox; INSTANCE:2]") If ($cmexist = "HTC method") Then ControlClick("Choose action:", "Ok", "[CLASS:TButton; INSTANCE:1]") ElseIf ($cmexist = "LG method") Then ControlClick("Choose method", "Ok", "[CLASS:TButton; INSTANCE:1]") EndIf WinWaitActive("Information") Sleep(300) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") sleep(500) ControlClick($cdmawindow, "", "[CLASS:TPageControl; INSTANCE:1]", "left", 1, 206, 7) sleep(500) ControlSetText($cdmawindow, "", "[CLASS:TEdit; INSTANCE:3]", $splitted[2]) Sleep(500) $Akey = ControlGetText("", "", "[CLASS:TEdit; INSTANCE:2]") sleep(500) ControlSetText("", "", "[CLASS:TEdit; INSTANCE:6]", $Akey) sleep(800) ControlClick($cdmawindow, "", "[CLASS:TButton; INSTANCE:4]", "left", 1, 37, 18) sleep(800) WinWaitActive("Information") sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") ElseIf $statemesn = 4 Then $meid = _getmesn($mesnfile) $splitted = StringSplit($meid, @TAB) sleep(500) ControlSetText($cdmawindow, "", "[CLASS:TEdit; INSTANCE:1]", $splitted[1]) sleep(500) ControlClick($cdmawindow, "Write", "[CLASS:TButton; INSTANCE:2]") Sleep(500) $cmexist = ControlGetText($cdmawindow, "", "[CLASS:TComboBox; INSTANCE:2]") If ($cmexist = "HTC method") Then ControlClick("Choose action:", "Ok", "[CLASS:TButton; INSTANCE:1]") ElseIf ($cmexist = "LG method") Then ControlClick("Choose method", "Ok", "[CLASS:TButton; INSTANCE:1]") EndIf WinWaitActive("Information") ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") sleep(500) ControlClick($cdmawindow, "Read", "[CLASS:TButton; INSTANCE:6]") sleep(400) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") sleep(200) Send("{DOWN}{ENTER}") WinWaitActive("Information") sleep(250) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") sleep(200) ControlSetText($cdmawindow, "", "[CLASS:TmvbBtnEdit; INSTANCE:2]", $splitted[2]) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") sleep(200) Send("{DOWN 3}{ENTER}") WinWaitActive("Information") sleep(250) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") ElseIf $statemesn = 5 Then $meid = _getmesn($mesnfile) $splitted = StringSplit($meid, @TAB) sleep(500) ControlSetText($cdmawindow, "", "[CLASS:TEdit; INSTANCE:1]", $splitted[1]) sleep(500) ControlClick($cdmawindow, "Write", "[CLASS:TButton; INSTANCE:2]") Sleep(500) $cmexist = ControlGetText($cdmawindow, "", "[CLASS:TComboBox; INSTANCE:2]") If ($cmexist = "HTC method") Then ControlClick("Choose action:", "Ok", "[CLASS:TButton; INSTANCE:1]") ElseIf ($cmexist = "LG method") Then ControlClick("Choose method", "Ok", "[CLASS:TButton; INSTANCE:1]") EndIf WinWaitActive("Information") ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") sleep(500) ControlClick($cdmawindow, "Read", "[CLASS:TButton; INSTANCE:6]") sleep(400) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") sleep(200) Send("{DOWN}{ENTER}") WinWaitActive("Information") sleep(250) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") sleep(200) ControlSetText($cdmawindow, "", "[CLASS:TmvbBtnEdit; INSTANCE:2]", $splitted[2]) ControlClick($cdmawindow, "SPC", "[CLASS:TButton; INSTANCE:8]") sleep(200) Send("{DOWN 3}{ENTER}") WinWaitActive("Information") sleep(250) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") sleep(700) ControlClick($cdmawindow, "", "[CLASS:TPageControl; INSTANCE:1]", "left", 1, 206, 7) sleep(500) ControlSetText($cdmawindow, "", "[CLASS:TEdit; INSTANCE:3]", $splitted[3]) Sleep(500) $Akey = ControlGetText("", "", "[CLASS:TEdit; INSTANCE:2]") sleep(500) ControlSetText("", "", "[CLASS:TEdit; INSTANCE:6]", $Akey) sleep(800) ControlClick($cdmawindow, "", "[CLASS:TButton; INSTANCE:4]", "left", 1, 37, 18) sleep(800) WinWaitActive("Information") sleep(400) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") EndIf EndIf If Not($stateWrite3G = False) Then ControlClick($cdmawindow, "", "[CLASS:TPageControl; INSTANCE:1]", "left", 1, 20, 12) sleep(300) ControlClick($cdmawindow, "", "[CLASS:TMyArrowButton; INSTANCE:2]", "left", 1, 20, 15) sleep(4200) If $stateWrite3G = 1 Then If ControlCommand($cdmawindow, '', 'TMyComboBox30', 'FindString', 'NV only') <> 0 Then ControlCommand($cdmawindow, '', 'TMyComboBox30', 'SelectString', 'Nv only') EndIf EndIf sleep(500) WinActivate($cdmawindow) WinWaitActive($cdmawindow) ControlClick($cdmawindow, "", "[CLASS:TMyArrowButton; INSTANCE:1]", "left", 1, 24, 14) sleep(800) ControlClick($cdmawindow, "", "[CLASS:TMyArrowButton; INSTANCE:2]", "left", 1, 20, 15) sleep(1000) EndIf If NOT ($stateprl = False) Then ControlClick($cdmawindow, "", "[CLASS:TPageControl; INSTANCE:1]", "left", 1, 165, 10) Sleep(500) ControlClick($cdmawindow, "", "[CLASS:TMyArrowButton; INSTANCE:1]") Sleep(400) WinWaitActive("Open") sleep(500) If $stateprl = 1 Then ControlSetText("Open", "", "[CLASS:Edit; INSTANCE:1]", $prl10043) ElseIf $stateprl = 2 Then ControlSetText("Open", "", "[CLASS:Edit; INSTANCE:1]", $prl52736) EndIf Sleep(400) ControlSend("Open", "", "[CLASS:Edit; INSTANCE:1]", "{ENTER}") WinWaitActive("Information") Sleep(300) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") EndIf If $statenam = 1 Then ControlClick($cdmawindow, "", "[CLASS:TPageControl; INSTANCE:1]", "left", 1, 20, 10) Sleep(500) ControlClick($cdmawindow, "", "[CLASS:TMyArrowButton; INSTANCE:2]", "left", 1, 45, 10) Sleep(500) Send("{DOWN}{ENTER}") If $statemesn = 1 Then _generatenam($esn) ElseIf $statemesn = 2 Then _generatenam($meid) ElseIf $statemesn = 3 Then _generatenam($meid) ElseIf $statemesn = 4 Then _generatenam($meid) ElseIf $statemesn = 5 Then _generatenam($meid) ElseIf $statemesn = 0 Then $oldmesn = _readoldmesn(0) _generatenam($oldmesn) EndIf Sleep(1000) ControlClick($cdmawindow, "", "[CLASS:TMyArrowButton; INSTANCE:3]") WinWaitActive("Open") ControlSetText("Open", "", "[CLASS:Edit; INSTANCE:1]", "C:\nam.nam") ControlSend("Open", "", "[CLASS:Edit; INSTANCE:1]", "{ENTER}") ControlClick($cdmawindow, "", "[CLASS:TMyArrowButton; INSTANCE:1]", "left", 1, 45, 10) Send("{DOWN}{ENTER}") EndIf Sleep(1500) Do $count = 0 $sbartext = _guictrlstatusbar_gettext($statusbar, 0) $count = StringInStr($sbartext, "Ready..") Until $count > 0 Sleep(400) WinActivate("CDMA Workshop") WinWaitActive("CDMA Workshop") Sleep(100) ControlClick("CDMA Workshop", "", "[CLASS:TPanel; INSTANCE:3]", "left", 1, 376, 7) WinActivate("CDMA Workshop") WinWaitActive("CDMA Workshop") Sleep(1000) WinActivate("CDMA Workshop") WinWaitActive("CDMA Workshop") ControlClick("CDMA Workshop", "", "[CLASS:TPanel; INSTANCE:3]", "left", 1, 491, 9) Sleep(900) Send("{DOWN 3}{ENTER}") Sleep(100) WinWaitActive("Information") Sleep(100) ControlClick("Information", "OK", "[CLASS:TButton; INSTANCE:1]") Sleep(400) ControlClick($cdmawindow, "", "[CLASS:TPanel; INSTANCE:3]", "left", 1, 320, 10) $mesnleft = _countmesn($mesnfile) If $statemesn = 1 Then GUICtrlSetData($labcount, "DONE: " & $esn & " - " & $mesnleft & " ESN(s) left.") ElseIf $statemesn = 2 Then GUICtrlSetData($labcount, "DONE: " & $meid & " - " & $mesnleft & " MEID(s) left.") ElseIf $statemesn = 3 Then GUICtrlSetData($labcount, "DONE: " & $meid & " - " & $mesnleft & " MEID(s) left.") ElseIf $statemesn = 4 Then GUICtrlSetData($labcount, "DONE: " & $meid & " - " & $mesnleft & " MEID(s) left.") ElseIf $statemesn = 5 Then GUICtrlSetData($labcount, "DONE: " & $meid & " - " & $mesnleft & " MEID(s) left.") EndIf If $staterports = 1 Then _clearports() EndIf Do $changed = _checkconnected() _showcomstatus() Until $changed = False _showcomstatus() If $staterports = 1 Then _clearports() EndIf WEnd EndFunc Func _readoldmesn($isesn) Local $oldmesn Local $child winlistchildren($cdmawindow, $child) For $i = 1 To $child[0][0] Step 1 $oldmesn = ControlGetText($cdmawindow, "", $child[$i][0]) If ((StringLen($oldmesn) = 10) AND (StringInStr($oldmesn, "0x", 1))) Then ExitLoop ElseIf ((StringLen($oldmesn) = 16) AND (StringInStr($oldmesn, "0x", 1))) Then ExitLoop EndIf Next $oldmesn = StringTrimLeft($oldmesn, 2) Return $oldmesn EndFunc Func _getmesn($filepath) Local $file Local $mesn $file = FileOpen($filepath) $mesn = FileReadLine($file, 1) FileClose($file) _filewritetoline($filepath, 1, "", 1) Return $mesn EndFunc Func _countmesn($filepath) Local $count $count = _filecountlines($filepath) Return $count EndFunc Func _exit() Exit EndFunc Func _generatenam($esn) $ohttp = ObjCreate("winhttp.winhttprequest.5.1") $ohttp.open("GET", "http://htracker.hthcomm.net/getnam.php?ESN=" & $esn, False) $ohttp.send() $oreceived = $ohttp.responsetext $ostatuscode = $ohttp.status If $ostatuscode == 200 Then $split = StringSplit($oreceived, ",", 1) If StringLen($split[1]) = 10 AND StringLen($split[2]) = 10 Then $min = $split[1] $mdn = $split[2] $nam = "[CDMA page]" & @CRLF $nam &= "MCC=310" & @CRLF $nam &= "MNC=00" & @CRLF $nam &= "MIN=" & $min & @CRLF $nam &= "Class1_IMSI_State=0" & @CRLF $nam &= "Class1_IMSI=" & @CRLF $nam &= "TrueIMSI_MCC=310" & @CRLF $nam &= "TrueIMSI_MNC=00" & @CRLF $nam &= "TrueIMSI_MIN=0000001804" & @CRLF $nam &= "Class1_TrueIMSI_State=0" & @CRLF $nam &= "Class1_TrueIMSI=" & @CRLF $nam &= "VoCoder_EVRC_enabled=1" & @CRLF $nam &= "VoCoder_Home_page=2" & @CRLF $nam &= "VoCoder_Home_orig=2" & @CRLF $nam &= "VoCoder_Roam_orig=2" & @CRLF $nam &= "VoCoder_EVRC-B_enabled=1" & @CRLF $nam &= "VoCoder_EVRC-WB_enabled=-1" & @CRLF $nam &= "VoCoder_EVRC-NW_enabled=-1" & @CRLF $nam &= "PrimaryChannelA=283" & @CRLF $nam &= "PrimaryChannelB=384" & @CRLF $nam &= "SecondaryChannelA=691" & @CRLF $nam &= "SecondaryChannelB=777" & @CRLF $nam &= "Dir_Number=" & $mdn & @CRLF $nam &= "Dir_PCS=" & $mdn & @CRLF $nam &= "PreferredServingSystem#1=3" & @CRLF $nam &= "PreferredServingSystem#2=-1" & @CRLF $nam &= "RoamingPreference=0" & @CRLF $nam &= "PreferredMode=4" & @CRLF $nam &= "HybridPreference=1" & @CRLF $file = FileOpen("C:\nam.nam", 2) FileWrite($file, $nam) FileClose($file) Else Return False EndIf EndIf EndFunc Func _calcspc($mesn) $url = "http://htracker.hthcomm.net/getmspc.php?esn=" & $mesn Local $ohttp = ObjCreate("WinHttp.WinHttpRequest.5.1") $ohttp.open("GET", $url, False) $ohttp.send() $ohttp.waitforresponse $output = $ohttp.responsetext $splitted = StringSplit($output, "|") If ($splitted[0] = 7) Then Return $splitted[6] Else Return False EndIf EndFunc Func _clearports() RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter", "ComDB", "REG_BINARY", "0x0F00000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") EndFunc Func winlistchildren($hwnd, ByRef $avarr) If UBound($avarr, 0) <> 2 Then Local $avtmp[10][2] = [[0]] $avarr = $avtmp EndIf Local $hchild = _winapi_getwindow($hwnd, $gw_child) While $hchild If $avarr[0][0] + 1 > UBound($avarr, 1) - 1 Then ReDim $avarr[$avarr[0][0] + 10][2] $avarr[$avarr[0][0] + 1][0] = $hchild $avarr[$avarr[0][0] + 1][1] = _winapi_getwindowtext($hchild) $avarr[0][0] += 1 winlistchildren($hchild, $avarr) $hchild = _winapi_getwindow($hchild, $gw_hwndnext) WEnd ReDim $avarr[$avarr[0][0] + 1][2] EndFunc Func _getstation($filepath) Local $station Local $last $station = StringSplit($filepath, "\") $last = $station[0] $station[$last] = StringTrimLeft($station[$last], 7) Return $station[$last] EndFunc Func _getspcstate($stateclear, $statesend6z, $statesend16, $statecalculate) Local $statespc[5] Local $i $statespc[1] = $stateclear $statespc[2] = $statesend6z $statespc[3] = $statesend16 $statespc[4] = $statecalculate For $i = 1 To 4 Step 1 If $statespc[$i] = 1 Then $statespc[0] = $i ExitLoop ElseIf $statespc[$i] = 4 Then $statespc[0] = False EndIf Next Return $statespc[0] EndFunc Func _getmesnstate($stateesn, $statemeid, $stateakey, $stateMSLMeid, $stateMSLMKey ) Local $statemesn[6] Local $i $statemesn[1] = $stateesn $statemesn[2] = $statemeid $statemesn[3] = $stateakey $statemesn[4] = $stateMSLMeid $statemesn[5] = $stateMSLMKey For $i = 1 To 5 Step 1 If $statemesn[$i] = 1 Then $statemesn[0] = $i ExitLoop ElseIf $statemesn[$i] = 4 Then $statemesn[0] = False EndIf Next Return $statemesn[0] EndFunc Func _getWrite3Gstate($state3G) Local $stateWrite3G[2] Local $i $stateWrite3G[1] = $state3G For $i = 1 To 1 Step 1 If $stateWrite3G[$i] = 1 Then $stateWrite3G[0] = $i ExitLoop ElseIf $stateWrite3G[$i] = 4 Then $stateWrite3G[0] = False EndIf Next Return $stateWrite3G[0] EndFunc Func _getprlstate($statespt, $statevrz) Local $stateprl[3] Local $i $stateprl[1] = $statespt $stateprl[2] = $statevrz For $i = 1 To 2 Step 1 If $stateprl[$i] = 1 Then $stateprl[0] = $i ExitLoop ElseIf $stateprl[$i] = 4 Then $stateprl[0] = False EndIf Next Return $stateprl[0] EndFunc