Jump to content
Sign in to follow this  
Guest Wiseman40

Toggle a loop

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?

Share this post


Link to post
Share on other sites
JoshDB

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.