Berend Jan Posted April 27, 2005 Share Posted April 27, 2005 Hi guys, I made this script: expandcollapse popupGlobal $LocEmail = "556, 456" Global $LocWW = "556, 485" Global $LocBank = "105, 607" Global $LocStort = "850, 495" Global $Stortbedrag = "787, 523" Global $Bankmoney = 200000000 Global $LocScrollDown = "1267, 130, 1267, 938" Global $LocHoofd = "113, 195" Global $LocDragGeld = "839, 839, 1027, 839" Global $LocNotepadexit = "1268, 10" Global $LocLogout = "113, 871" global $NumberOfUsers = IniRead ( '.\bankusers.ini', 'MobHeader', 'NumberOfUsers', 1 ) global $MobUser = IniRead ( '.\bankusers.ini', 'User' & $UserNumber, 'MobUser', "Unknown User" ) global $MobPass = IniRead ( '.\bankusers.ini', 'User' & $UserNumber, 'MobPass', "" ) Func _GetNextUser() $UserNumber = $UserNumber + 1 if $UserNumber > $NumberOfUsers then $UserNumber = 1 EndIf EndFunc ; GetNextUser Run("C:\Program Files\Internet Explorer\iexplore.exe http://www.mobstar.cc", "", @SW_MAXIMIZE) Func _WaitForWebPage() Do $sIEstatus = StatusbarGetText("Internet Explorer") Until $sIEstatus = "Gereed" EndFunc Mouseclick ("left", $LocEmail, 1) Send ( $MobUser ) Mouseclick ("left", $LocWW, 1) Send ( $MobPass ) Func _WaitForWebPage() Func _Bank() Mouseclickdrag ("left", $LocScrolldown) Mouseclickdrag ("left", $LocDragGeld) Send (^c) Run ("Notepad.exe") sleep (5000) Send (^v) Send ("{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{LEFT}{BS}{BS}{BS}{BS}{BS}{BS} {BS}{BS}{BS}{BS}{BS}") Send ("^a") Send ("^c") $Money = ClipGet() If $Money >= 200000000 Then ProcessClose("notepad.exe", @SW_MAXIMIZE) WinActivate ("Mobstar mafia game - Microsoft Internet Explorer", "") Mouseclick ("left", $LocBank, 1) Func _WaitForWebPage() Mouseclick ("left", $LocStort, 1) Send ($Bankmoney) Mouseclick ("left", $Stortbedrag, 1) Func _WaitForWebPage() Else $Money <= 200000000 Then $LowMoney = $Money - 200000 ProcessClose("notepad.exe", @SW_MAXIMIZE) WinActivate ("Mobstar mafia game - Microsoft Internet Explorer", "") Mouseclick ("left", $LocBank, 1) Func _WaitForWebPage() Mouseclick ("left", $LocStort, 1) Send ($LowMoney) Mouseclick ("left", $Stortbedrag, 1) Func _WaitForWebPage() EndIf EndFunc Func _GetNextUser() Func _Bank () But now I'm getting the error that there is no corresponding EndFunc for Func _Bank Could anyone tell me what I am doing wrong? Berend Jan Link to comment Share on other sites More sharing options...
buzz44 Posted April 27, 2005 Share Posted April 27, 2005 (edited) Look at the last 2 lines of your code, and I think just above the real Bank function at Func _WaitForWebPage().Edit: Bit more information. I don't know about previous versions of AutoIt but in v3 when you want to call a function you do as below.test() Func test() MsgBox(0,"Test","This is a test") EndFuncNot.Func test() Func test() MsgBox(0,"Test","This is a test") EndFuncOr you can use.Call ("test") Func test() MsgBox(0,"Test","This is a test") EndFuncIn some cases when nessicary. Edited April 27, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
CyberSlug Posted April 27, 2005 Share Posted April 27, 2005 What are the last two lines?? You've already defined the functions, so you don't want to use the Func keyword.If you just want to call the functions, you would change the last two lines of your script to simply:_GetNextUser()_Bank() Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Berend Jan Posted April 27, 2005 Author Share Posted April 27, 2005 What are the last two lines?? You've already defined the functions, so you don't want to use the Func keyword.If you just want to call the functions, you would change the last two lines of your script to simply:_GetNextUser()_Bank()<{POST_SNAPBACK}>ok thx guys. But now i'm getting the following errors: "variable used without being declared" on line 13and"error in expression" on line 14.any idea why this is? Link to comment Share on other sites More sharing options...
buzz44 Posted April 27, 2005 Share Posted April 27, 2005 Should. global $NumberOfUsers = IniRead ( '.\bankusers.ini', 'MobHeader', 'NumberOfUsers', 1 ) Be. global $UserNumber = IniRead ( '.\bankusers.ini', 'MobHeader', NumberOfUsers', 1 ) qq Link to comment Share on other sites More sharing options...
Berend Jan Posted April 27, 2005 Author Share Posted April 27, 2005 Ok. I adapted the script now to this: expandcollapse popupGlobal $LocEmail1 = "556" Global $LocEmail2 = "456" Global $LocWW1 = "556" Global $LocWW2 = "485" Global $LocBank1 = "105" Global $LocBank2 = "607" Global $LocStort1 = "850" Global $LocStort2 = "495" Global $Stortbedrag1 = "787" Global $Stortbedrag2 = "523" Global $Bankmoney = 200000000 Global $LocScrollDown1 = "1267" Global $LocScrollDown2 = "130" Global $LocScrollDown3 = "1267" Global $LocScrollDown4 = "938" Global $LocHoofd = "113, 195" Global $LocDragGeld1 = "839" Global $LocDragGeld2 = "839" Global $LocDragGeld3 = "1027" Global $LocDragGeld4 = "839" Global $LocNotepadexit1 = "1268" Global $LocNotepadexit2 = "10" Global $LocLogout1 = "113" Global $LocLogout2 = "871" Global $UserNumber = IniRead ( '.\bankusers.ini', 'MobHeader', 'NumberOfUsers', 1 ) Global $MobUser = IniRead ( '.\bankusers.ini', 'User' & $UserNumber, 'MobUser', "Unknown User" ) Global $MobPass = IniRead ( '.\bankusers.ini', 'User' & $UserNumber, 'MobPass', "" ) Func _GetNextUser() $UserNumber = $UserNumber + 1 if $UserNumber > $UserNumber Then $UserNumber = 1 EndIf EndFunc ; GetNextUser Func _WaitForWebPage() Do $sIEstatus = StatusbarGetText("Internet Explorer") Until $sIEstatus = "Gereed" EndFunc Func _Login () Mouseclick ("left", $LocEmail1, $LocEmail2, 1) Send ( $MobUser ) Mouseclick ("left", $LocWW1, $LocWW2, 1) Send ( $MobPass ) Send ("{ENTER}") _WaitForWebPage() EndFunc Func _Bank() Mouseclickdrag ("left", $LocScrollDown1, $LocScrollDown2, $LocScrollDown3, $LocScrollDown4) Mouseclickdrag ("left", $LocDragGeld1, $LocDragGeld2, $LocDragGeld3, $LocDragGeld4) Send ("^c") Run ("Notepad.exe", @SW_MAXIMIZE) sleep (5000) Send ("^v") Send ("{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{LEFT}{BS}{BS}{BS}{BS}{BS}{BS} {BS}{BS}{BS}{BS}{BS}") Send ("^a") Send ("^c") $Money = ClipGet() If $Money >= 200000000 Then ProcessClose("notepad.exe") WinActivate ("Mobstar mafia game - Microsoft Internet Explorer", "") Mouseclick ("left", $LocBank1, $LocBank2, 1) _WaitForWebPage() Mouseclick ("left", $LocStort1, $LocStort2, 1) Send ($Bankmoney) Mouseclick ("left", $Stortbedrag1, $LocStortbedrag2, 1) _WaitForWebPage() Else $Money <= 200000000 Then $LowMoney = $Money - 200000 ProcessClose("notepad.exe") WinActivate ("Mobstar mafia game - Microsoft Internet Explorer", "") Mouseclick ("left", $LocBank1, $LocBank2, 1) _WaitForWebPage() Mouseclick ("left", $LocStort1, $LocStort2, 1) Send ($LowMoney) Mouseclick ("left", $Stortbedrag1, $LocStortbedrag2, 1) _WaitForWebPage() EndIf EndFunc Run("C:\Program Files\Internet Explorer\iexplore.exe http://www.mobstar.cc", "", @SW_MAXIMIZE) sleep (5000) _Login () _Bank () _GetNextUser() The problem i have now it pauses the script when it arrives at the first _Bank () function. Though I have no idea why it does Does any of you do? Berend Jan Link to comment Share on other sites More sharing options...
CyberSlug Posted April 27, 2005 Share Posted April 27, 2005 put the following at the very top of your scriptOpt("TrayIconDebug", 1)Whenever you think the script is paused, move your mouse over the AutoIt tray icon (next to the clock) and see what line number the script is stuck on....My hunch is that WaitForWebPage is where the delay is. Make sure $sIEstatus = "Gereed" is exactly correct. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Berend Jan Posted April 27, 2005 Author Share Posted April 27, 2005 put the following at the very top of your scriptOpt("TrayIconDebug", 1)Whenever you think the script is paused, move your mouse over the AutoIt tray icon (next to the clock) and see what line number the script is stuck on....My hunch is that WaitForWebPage is where the delay is. Make sure $sIEstatus = "Gereed" is exactly correct.<{POST_SNAPBACK}>indeed it's stuck at the WaitForWebPage. but at this line:$sIEstatus = StatusbarGetText("Mobstar mafia game - Microsoft Internet Explorer") But I don't see the problem the title is exactly thesame. Link to comment Share on other sites More sharing options...
SlimShady Posted April 27, 2005 Share Posted April 27, 2005 All the window functions are case sensitive. Remember that. Link to comment Share on other sites More sharing options...
Berend Jan Posted April 27, 2005 Author Share Posted April 27, 2005 All the window functions are case sensitive. Remember that.<{POST_SNAPBACK}>yeah. but I copied everything exactly as it was shown in the spy. Link to comment Share on other sites More sharing options...
CyberSlug Posted April 27, 2005 Share Posted April 27, 2005 To help debug: Func _WaitForWebPage() Do $sIEstatus = StatusbarGetText("Mobstar mafia game - Microsoft Internet Explorer") ToolTip($sIEstatus, 0, 0) Until $sIEstatus = "Gereed" EndFunc The ToolTip will tell you want text is being read. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Berend Jan Posted April 27, 2005 Author Share Posted April 27, 2005 To help debug:Func _WaitForWebPage() Do $sIEstatus = StatusbarGetText("Mobstar mafia game - Microsoft Internet Explorer") ToolTip($sIEstatus, 0, 0) Until $sIEstatus = "Gereed" EndFuncThe ToolTip will tell you want text is being read.<{POST_SNAPBACK}>How will it tell me because it's still paused at this line:$sIEstatus = StatusbarGetText("Mobstar mafia game - Microsoft Internet Explorer") Link to comment Share on other sites More sharing options...
Valik Posted April 27, 2005 Share Posted April 27, 2005 Instead of questioning somebodies advice, why don't you try it first? Link to comment Share on other sites More sharing options...
Berend Jan Posted April 27, 2005 Author Share Posted April 27, 2005 Instead of questioning somebodies advice, why don't you try it first?<{POST_SNAPBACK}>I did. but it still pauses exactly on the line above the tooltip that's the problem. Link to comment Share on other sites More sharing options...
Valik Posted April 27, 2005 Share Posted April 27, 2005 You are in a loop until the text in the status bar matches the text you are looking for. There is no "pause", its a loop. It executes the same line of code over and over until the condition is met. Look at the text in the tooltip and compare it to the text you are looking for. Are they identical? If not, then it will continue looping. The tooltip is a non-intrusive way of diagnosing what is being returned by StatusBarGetText(). Link to comment Share on other sites More sharing options...
Berend Jan Posted April 27, 2005 Author Share Posted April 27, 2005 You are in a loop until the text in the status bar matches the text you are looking for. There is no "pause", its a loop. It executes the same line of code over and over until the condition is met. Look at the text in the tooltip and compare it to the text you are looking for. Are they identical? If not, then it will continue looping. The tooltip is a non-intrusive way of diagnosing what is being returned by StatusBarGetText().<{POST_SNAPBACK}>I'm probably really blind or something, but where can I view the output of the tooltip? I don't get anything in the traybar or anywhere else. Link to comment Share on other sites More sharing options...
CyberSlug Posted April 27, 2005 Share Posted April 27, 2005 Try this modification. Func _WaitForWebPage() Do $sIEstatus = StatusbarGetText("Mobstar mafia game - Microsoft Internet Explorer") If $sIEstatus = "" Then ToolTip("ERROR...", 0, 0) Else ToolTip("Text is: " & $sIEstatus, 0, 0) EndIf Until $sIEstatus = "Gereed" EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Berend Jan Posted April 27, 2005 Author Share Posted April 27, 2005 Try this modification.Func _WaitForWebPage() Do $sIEstatus = StatusbarGetText("Mobstar mafia game - Microsoft Internet Explorer") If $sIEstatus = "" Then ToolTip("ERROR...", 0, 0) Else ToolTip("Text is: " & $sIEstatus, 0, 0) EndIf Until $sIEstatus = "Gereed" EndFunc<{POST_SNAPBACK}>Yes that one is working. giving the error notification. so apparently he can't read it 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