Jump to content

My hotkey script ends prematurely, unexpectedly


Fohsap
 Share

Recommended Posts

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.

Global $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 by Fohsap
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...