Guest OnlyFox Posted January 21, 2005 Share Posted January 21, 2005 Im trying to write a simple mouse double click macro that loops infinitely until told to stop by user input. Its been years since I have done any type of programing and that was with plain straight C (oh, and I wasnt very good then) Basicaly what i have so far: If <condition> Then MouseClick("left",x,y,2) MouseClick("left",x,y,2) MouseClick("left",x,y,2) Else Exit EndIf now the question is how do i make the condition such that it looks for a specific key stroke to end the macro... and is the "Else Exit" correct syntax to end the macro? Any help would be appreciated Link to comment Share on other sites More sharing options...
Guest OnlyFox Posted January 21, 2005 Share Posted January 21, 2005 I may have found my own answer, but would like someone to eyeball it to confirm before I try to run it.. Nothing like ending up in a loop that causes you to have to hard stop your system. Global $Paused HotKeySet("{PAUSE)", "TogglePause") HotKeySEt("{ESC}", "Terminate") ;;;;;;;;; Do MouseClick("left",x,y,2) MouseClick("left",x,y,2) MouseClick("left",x,y,2) Until $Paused = 1 ;;;;;;;;;; While 1 Sleep (1000) WEnd ;;;;;;;;;;; Func TogglePaus{} $Paused = NOT $Paused While $Paaused Sleep(1000) WEnd EndFunc ;;;;;;;;;;; Func Terminate{} Exit 0 EndFunc Link to comment Share on other sites More sharing options...
scriptkitty Posted January 21, 2005 Share Posted January 21, 2005 (edited) looks a bit messed up, I would put in more qualifiers if using it, and also I assume you are using more than one location in the repeated mouseclicks. Also you misspelled Paaused so you will get an error with the variable also you have a lot of code issues: Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySEt("{ESC}", "Terminate") ;;;;;;;;; Do MouseClick("left",10,10,2); if same location, just mouseclick 6 times MouseClick("left",10,10,2) MouseClick("left",10,10,2) ; sugestion ; if winactive("My program","") then MouseClick("left",10,10,6) sleep(100); I would think you would like some pause. Until $Paused = 1 ;;;;;;;;;; ; this section does nothing as you will never have $Paused=1 with your curent code While 1 Sleep (1000) WEnd ;;;;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused Sleep(1000) WEnd EndFunc ;;;;;;;;;;; Func Terminate() Exit 0 EndFunc Edited January 21, 2005 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Guest OnlyFox Posted January 22, 2005 Share Posted January 22, 2005 Thanks for the responce. It will double click 3 diff spots thats why i didnt bother with the x,y coords since thats easy to figure out. I will most likely just rip out the the "paused" portions since i dont really need it. From what I can tell you are in aggrement the the "exit" portions will work and that is what is important. I pulled that code (aside from my mouse clicks) from the AutoItV3 help file under the Hotkeys issue. But I proly misinterpreted the code that was placed there. Ill try running this now and let you know how it works. Link to comment Share on other sites More sharing options...
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