Jump to content

Toggle a loop


Guest Wiseman40
 Share

Recommended Posts

Guest Wiseman40

There are some repetative tasks (only mouse clicks) that I loop using an Autoit script, but the way I currently have it set up requires me to close autoit while the script is still running (challenging mousework) in order to get it to stop.

My problem is that I can't seem to figure out how to bind a key to the Exit function while the script is running.

My goal is to have a repeating cycle that can be toggled on/off using a key.

Are there any suggestions on how to do this?

Link to comment
Share on other sites

Press the "End" key to stop the macro.

Global $Stopped
HotKeySet("{END}", "Stop")

While 1
   ; Your script here!
    MouseMove(10, 100)
    Sleep(500)
    MouseMove(700, 700)
WEnd

Func Stop()
    $Stopped = NOT $Stopped
    While $Stopped
        Sleep(100)
    WEnd
EndFunc
Edited by JoshDB
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...