Skizzy Posted April 16, 2007 Share Posted April 16, 2007 (edited) Okay, I'm an AutoIt newbie, but I used to do some things with VB about 6 or 7 years ago. Nowadays, I usually just create simple macros with ACTool, but it's not cooperating the way I want it to, so I have switched over to AutoIt. I am trying to create a macro that continually presses {F1} then MouseClick("left") right after it, until the numberpad + is pressed, which terminates or pauses the program. So far I have: Send ("{F1}") MouseClick("left") Pretty simple, huh? That works fine, but I am not sure how to loop it until numberpad + is pressed. I have read documentation on AutoIt for close to two hours now, but have nothing to help me. Now, I knew how to do it in ACTool, but since I've never used AutoIt before, I have no clue. Thanks in advance! Edited April 16, 2007 by Skizzy Link to comment Share on other sites More sharing options...
xcal Posted April 16, 2007 Share Posted April 16, 2007 From the help file... Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ; do your stuff here WEnd EndFunc How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
alex OF DEATH Posted April 16, 2007 Share Posted April 16, 2007 Hotkeyset ("q" "exit1") While 1 = 1 Send ("{F1}") MouseClick("left") wend Func Exit1() Exit(0) Endfunc Does it work? I changed the Numpad + into "q" because I couldn't find that key's code thing. (as in, "{numpad+} ) Link to comment Share on other sites More sharing options...
smashly Posted April 16, 2007 Share Posted April 16, 2007 (edited) Maybe something like this. #include <Misc.au3> $dll = DllOpen("user32.dll") Do Send ("{F1}") MouseClick("left") Until _IsPressed('6B', $dll) DllClose($dll)oÝ÷ ØêÚºÚ"µÍÚ[ÛYH ÓZØË]LÉÝÂÌÍÙHÜ[ ][ÝÝÙÌ ][ÝÊBÚ[HÝÒÔÜÙY ÌÎNÍÌÎNË ÌÍÙ BÙ[ ][ÝÞÑ_I][ÝÊBS[ÝÙPÛXÚÊ ][ÝÛY ][ÝÊHÑ[ÛÜÙJ ÌÍÙ Cheers Edit: You beet me to it alex OF DEATH ...lol And the send for Numbpad + is NUMPADADD Edited April 16, 2007 by smashly Link to comment Share on other sites More sharing options...
alex OF DEATH Posted April 16, 2007 Share Posted April 16, 2007 (edited) Nevermind. Thought something else. Edited April 16, 2007 by alex OF DEATH Link to comment Share on other sites More sharing options...
Generator Posted April 16, 2007 Share Posted April 16, 2007 HotkeySet("{NUMPADADD}","StartPause") $pause=False While 1 Sleep(1000) WEnd Func Startpause() $pause=Not $pause While $Pause=True Send("{F1}") Mouseclick("left") WEnd EndFunc Link to comment Share on other sites More sharing options...
Skizzy Posted April 16, 2007 Author Share Posted April 16, 2007 (edited) Thanks for the replies! I made something almost exactly like alex OF DEATH's, even before I read his reply! I ended up with Hotkeyset ("{NUMPADADD}" "Terminate") While 1 = 1 Send ("{F1}") MouseClick ("left") WEnd Func Terminate() Exit 0 EndFunc First time around, I had to reboot my computer because I forgot to set a Exit command.. that wasn't fun. Thanks again for the replies guys. Edited April 16, 2007 by Skizzy Link to comment Share on other sites More sharing options...
smashly Posted April 16, 2007 Share Posted April 16, 2007 #include <Misc.au3> $dll = DllOpen("user32.dll") While Not _IsPressed('6B', $dll) Send ("{F1}") MouseClick("left") WEnd DllClose($dll) Link to comment Share on other sites More sharing options...
Generator Posted April 16, 2007 Share Posted April 16, 2007 #include <Misc.au3> $dll = DllOpen("user32.dll") While Not _IsPressed('6B', $dll) Send ("{F1}") MouseClick("left") WEnd DllClose($dll)You don't need to open dll Link to comment Share on other sites More sharing options...
smashly Posted April 16, 2007 Share Posted April 16, 2007 (edited) I'm only following the example from the Help file... DllOpen.... But since you don't need to , then I won't ..lol Learn something new every day Cheers Edited April 16, 2007 by smashly Link to comment Share on other sites More sharing options...
Generator Posted April 16, 2007 Share Posted April 16, 2007 (edited) I'm only following the example from the Help file... DllOpen....No need, this should work fine. HotkeySet("{NUMPADADD}","StartPause") HotkeySet("{ESC}","Quit") $pause=False While 1 Sleep(1000) WEnd Func Startpause() $pause=Not $pause While $Pause=True Send("{F1}") Mouseclick("left") WEnd EndFunc Func Quit() Exit EndFunc You don't have to exit your program, you can just set it so you can activiate it anytime. Edited April 16, 2007 by Generator Link to comment Share on other sites More sharing options...
smashly Posted April 16, 2007 Share Posted April 16, 2007 (edited) But why would you use all that when you can do the same thing with 6 lines? #include <Misc.au3> While Not _IsPressed('6B') Sleep(10) Send ("{F1}") MouseClick("left") WEnd Edit: I see why, cpu load.. doh , added sleep and it it's efficient. Edited April 16, 2007 by smashly Link to comment Share on other sites More sharing options...
Generator Posted April 16, 2007 Share Posted April 16, 2007 No need, this should work fine. HotkeySet("{NUMPADADD}","StartPause") HotkeySet("{ESC}","Quit") $pause=False While 1 Sleep(1000) WEnd Func Startpause() $pause=Not $pause While $Pause=True Send("{F1}") Mouseclick("left") WEnd EndFunc Func Quit() Exit EndFunc You don't have to exit your program, you can just set it so you can activiate it anytime.Cuz this way works the best 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