Fohsap Posted January 15, 2012 Posted January 15, 2012 (edited) Below is my script. Can you please tell me why I keep getting exit code 0, and the script stops? I'm expecting it to just idle in the background and await my hotkey pressing. expandcollapse popupGlobal $Paused HotKeySet("F7", "Cycle2") HotKeySet("F8", "Cycle1") HotKeySet("F9", "Cycle3") Func Cycle3() $Paused = NOT $Paused MouseClick("left", 920, 755, 1, 25) ;taskbar MouseClick("left", 776, 598, 1, 25) ;region MouseClick("left", 575, 565, 1, 25) ;pgdown MouseClickDrag("left", 325, 310, 500, 575, 25) Exit 0 EndFunc Func Cycle2() $Paused = NOT $Paused MouseClick("left", 920, 755, 1, 25) ;taskbar MouseClick("left", 776, 598, 1, 25) ;region MouseClick("left", 575, 565, 1, 25) ;pgdown MouseClick("left", 575, 310, 2, 25) ;up MouseClickDrag("left", 325, 310, 500, 575, 25) Global $Paused EndFunc Func Cycle1() $Paused = NOT $Paused MouseClick("left", 920, 755, 1, 25) ;taskbar MouseClick("left", 776, 598, 1, 25) ;region MouseClickDrag("left", 325, 310, 500, 575, 25) Local $i = 0 Do Sleep(2000) ;2-second sleep Cycle2() $i = $i + 1 Until $i = 7 Global $Paused EndFunc Edited January 15, 2012 by Fohsap
BigDod Posted January 15, 2012 Posted January 15, 2012 Insert While 1 Sleep(100) WEnd after HotKeySet's Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Schoening Posted January 15, 2012 Posted January 15, 2012 Yes like BigDod said you could insert While 1 Sleep(100) WEnd Your Problem is that the Functions are not Used Functions Wait to be called, but because your script has no definition when to start or end it will just run from top to bottom and Exit. When you add a While Loop, the Loop Will Keep the Programm "alive"
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