thechinesekid Posted May 21, 2013 Posted May 21, 2013 Hi, I've been using autoit for quite some years now and have mainly been lurking around the forums whenever I have had a problem. I've managed to get by through trial and error and I don't actually know very much about the program. I was wondering if I could get some help with my script. My question is the following: Is there a way to set a hotkey to pause my script but when I restart it, it begins from the beginning again rather than starting up where it paused? For example. Currently my script does.. ... pause at "c" >> unpause = starts at "d" However I want it to do... ... pause at "c" >> unpause = restarts at "a" Here is what I am working with expandcollapse popup;my script template #requireadmin opt("SendKeyDownDelay", 200) $count = 0 Global $UnPaused HotKeySet("`", "TogglePause") HotKeySet("{ESC}", "Terminate") ;-------------------- While 1 Sleep(10) ToolTip("Script is Paused",0,0) WEnd ;-------------------- Func TogglePause() $UnPaused = NOT $UnPaused While $UnPaused ;---script goes here-- Send("a") Send("b") Send("c") Send("d") ;-------------------- WEnd EndFunc ;-------------------- Func Terminate() Exit 0 EndFunc Any help is greatly appreciated! - Alex
Solution somdcomputerguy Posted May 22, 2013 Solution Posted May 22, 2013 A combination of the example code in the first link, and the restart code in the second link may do it for you. http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
thechinesekid Posted May 22, 2013 Author Posted May 22, 2013 (edited) Ah, thank you for that. It works great. With the method shown above I seem to require another hotkeyset (it pauses + resets script, but pressing it again does not start it up again) Out of curiousity, is there a way to merge my toggle and this new "restart" hotkey? If not, this will work fine. Edited May 22, 2013 by thechinesekid
somdcomputerguy Posted May 22, 2013 Posted May 22, 2013 After the While..WEnd loop, where there is the line ToolTip(""), is where I would put the 'restart code' (after the blank tooltip line, not replacing it). So there would be only one hotkey, whichever one you have set to call the pause function. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
thechinesekid Posted May 22, 2013 Author Posted May 22, 2013 Hmm, I gave it a shot but it got really messy. I get the feeling quite a bit of work will be needed to merge the two functions so I'll stick to what you've given me. I was just wondering for convenience. Thanks
somdcomputerguy Posted May 22, 2013 Posted May 22, 2013 Basically I was just telling you where I would start. I don't have a woking solution to supply, and I'm sure that there would be at least a few obstacles to overcome. Good luck though! - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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