Guest mechman Posted March 5, 2004 Posted March 5, 2004 Hey folks. I just recently got into programming with AutoIt, and frankly, I'm more then impressed with its simplicity for its abilities. Anyways, I have a simple question. I would like to know how to trigger a command loop with a hotkey .. example, I have a loop to click a spot every 5 seconds, but I want to beging that loop once someone presses "Ctrl + E" or something like that. The same with pausing the loop as well, enabling it to start again once needed with the same hotkey. I hope you understand what I mean. Much thanks! - mech
scriptkitty Posted March 5, 2004 Posted March 5, 2004 Change the placement of the mouse to suit you, and you might want to add one more while in the loop. AdlibEnable("pause"); this keeps running at all times till you exit. HotKeySet("^e","pauseset"); uses the CTRL+e key to change the value of $Pause $Pause = -1 sleep(500) While 1 mousemove(100,100,0) mouseclick("left") sleep(1000) ; sleep for 1 second before repeating Wend Func pauseset() $Pause = $Pause * -1 EndFunc Func pause() While $Pause = -1 Sleep(500) Wend EndFunc You might want it only to click if the active window is up AdlibEnable("pause"); this keeps running at all times till you exit. HotKeySet("^e","pauseset"); uses the CTRL+e key to change the value of $Pause $Pause = -1 sleep(500) While 1 clicker() sleep(1000) ; sleep for 1 second before repeating Wend func clicker() if winactive("MyProgram") then mouseclick("left",1,1,1,1) endfunc Func pauseset() $Pause = $Pause * -1 EndFunc Func pause() While $Pause = -1 Sleep(500) Wend EndFunc AutoIt3, the MACGYVER Pocket Knife for computers.
Guest mechman Posted March 5, 2004 Posted March 5, 2004 Ah, your awesome, that's perfect. Thanks! - mech
trids Posted March 8, 2004 Posted March 8, 2004 You can also keep an eye on this topic: http://www.hiddensoft.com/forum/index.php?showtopic=950&hl=.. some exciting things in the pipeline
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