lbrtdy Posted May 30, 2009 Share Posted May 30, 2009 This is the script I'm trying to make for autologin. At line 35, it keeps giving me a "Else" has no matching "if" problem, and I can't seem to find it.. :S Hoping a trained eye can spot it. Thanks! expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Lbrtdy Script Function: Performs PixelChecksum #ce ---------------------------------------------------------------------------- $BatchPath = "C:\Documents and Settings\Albert Zhen\Desktop\SRO autologin" Opt("MouseCoordmode",1) If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf $CheckSumLoginScreen_connect = PixelChecksum(5,24,239,120) $CheckSumLoginScreen_inputfield = PixelChecksum(378,420,649,543) while 1 if not WinActive("[Class:CLIENT]") Then WinActivate("[Class:CLIENT]") EndIf $State = 0;0 = not logged in, 1 = logged in, 2 = ImageCodeActive $StateCounter = 0 while 1 if $CheckSumLoginScreen_connect <> PixelChecksum(5,24,239,120) Then $State = 1;Logged In ExitLoop EndIf Else $CheckSumImageCodeTemp = PixelChecksum(378,420,649,543) if $CheckSumLoginScreen_inputfield = $CheckSumImageCodeTemp Then $State = 0;Image Code did not come up yet! sleep(100) ExitLoop Else if $CheckSumLoginScreen_inputfield <> $CheckSumImageCodeTemp Then $State = 2;The image is there, autocapcha can begin! ExitLoop EndIf EndIf EndIf WEnd ;--------------------------------------------- if $State = 0 Then ;Image code did not come up yet! ;Clear Screenshot directory RunWait($batchPath & "\clear_screenshots.bat") If Not WinActive("[Class:CLIENT]", "") Then WinActivate("[Class:CLIENT]", "") EndIf MouseClick("left", 460, 580, 1, 0);Clicks "Connect" sleep(100) Send("{PRINTSCREEN}") Sleep(100) RunWait($batchPath & "\decode.bat") If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf ;reads code $handle = FileOpen($batchPath & "\code.txt", 0) $code = FileReadLine($handle) FileClose($handle) ;Sends Code Send($code) Sleep(100) Send("{ENTER}") ;-------------------------------------------------- ElseIf 2 = 2 Then ;The ImageCode is there! RunWait($batchPath & "\clear_screenshots.bat") If Not WinActive("[Class:CLIENT]", "") Then WinActivate("[Class:CLIENT]", "") EndIf Send("{PRINTSCREEN}") Sleep(100) RunWait($batchPath & "\decode.bat") If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf ;reads code $handle = FileOpen($batchPath & "\code.txt", 0) $code = FileReadLine($handle) FileClose($handle) ;Sends Code Send($code) Sleep(100) Send("{ENTER}") ElseIf $State = 1 Then ;Logged In ExitLoop EndIf WEnd exit 0 Link to comment Share on other sites More sharing options...
stampy Posted May 30, 2009 Share Posted May 30, 2009 see code.... expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Lbrtdy Script Function: Performs PixelChecksum #ce ---------------------------------------------------------------------------- $BatchPath = "C:\Documents and Settings\Albert Zhen\Desktop\SRO autologin" Opt("MouseCoordmode",1) If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf $CheckSumLoginScreen_connect = PixelChecksum(5,24,239,120) $CheckSumLoginScreen_inputfield = PixelChecksum(378,420,649,543) while 1 if not WinActive("[Class:CLIENT]") Then WinActivate("[Class:CLIENT]") EndIf $State = 0;0 = not logged in, 1 = logged in, 2 = ImageCodeActive $StateCounter = 0 while 1 if $CheckSumLoginScreen_connect <> PixelChecksum(5,24,239,120) Then $State = 1;Logged In ExitLoop ; EndIf<<<<<<<<<<<<<<<<<<<<<<< ending the if Else;<<<<<<<<<<<<<<<<<<<< then continuing with else $CheckSumImageCodeTemp = PixelChecksum(378,420,649,543) if $CheckSumLoginScreen_inputfield = $CheckSumImageCodeTemp Then $State = 0;Image Code did not come up yet! sleep(100) ExitLoop Else if $CheckSumLoginScreen_inputfield <> $CheckSumImageCodeTemp Then $State = 2;The image is there, autocapcha can begin! ExitLoop EndIf EndIf EndIf WEnd ;--------------------------------------------- if $State = 0 Then ;Image code did not come up yet! ;Clear Screenshot directory RunWait($batchPath & "\clear_screenshots.bat") If Not WinActive("[Class:CLIENT]", "") Then WinActivate("[Class:CLIENT]", "") EndIf MouseClick("left", 460, 580, 1, 0);Clicks "Connect" sleep(100) Send("{PRINTSCREEN}") Sleep(100) RunWait($batchPath & "\decode.bat") If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf ;reads code $handle = FileOpen($batchPath & "\code.txt", 0) $code = FileReadLine($handle) FileClose($handle) ;Sends Code Send($code) Sleep(100) Send("{ENTER}") ;-------------------------------------------------- ElseIf 2 = 2 Then ;The ImageCode is there! RunWait($batchPath & "\clear_screenshots.bat") If Not WinActive("[Class:CLIENT]", "") Then WinActivate("[Class:CLIENT]", "") EndIf Send("{PRINTSCREEN}") Sleep(100) RunWait($batchPath & "\decode.bat") If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf ;reads code $handle = FileOpen($batchPath & "\code.txt", 0) $code = FileReadLine($handle) FileClose($handle) ;Sends Code Send($code) Sleep(100) Send("{ENTER}") ElseIf $State = 1 Then ;Logged In ExitLoop EndIf WEnd exit 0 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now