Orcc Posted March 8, 2008 Share Posted March 8, 2008 Hi i have a script but, every time i do something else i need to close it. is it possible to set a key to pause the script? if so plz send full command my current script is: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: Beta Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- HotKeySet("-", "Stop") ;script can be stopped by pressing 0 Sleep(4000) ;wait some time before starting the control+a cycle, to allow the user to navigate to the correct window While 1 ;repeat endlessly Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait 1 seconds Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait 1 seconds Send("{7}") ;simluate 7 keypress Sleep(3000) ;wait 3 seconds WEnd ;repeat Func Stop() ;to allow the script to stop Exit ;same EndFunc ;same Link to comment Share on other sites More sharing options...
BigDod Posted March 8, 2008 Share Posted March 8, 2008 Look at the example for HotKeySet in the help file, it has a pause/unpause example. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Orcc Posted March 8, 2008 Author Share Posted March 8, 2008 Look at the example for HotKeySet in the help file, it has a pause/unpause example.I have i can't get it to work right.this is the new one i did but.. its not working when i press =#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: Beta Script Function: Template AutoIt script.#ce ----------------------------------------------------------------------------Global $PausedHotKeySet("{PAUSE}", "TogglePause")HotKeySet("-", "Stop") ;script can be stopped by pressing -Sleep(4000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct windowWhile 1 ;repeat endlessly Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait .80 seconds Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait 1 seconds Send("{7}") ;simluate 7 keypress Sleep(3000) ;wait 3 secondsWEnd ;repeatFunc TogglePause() $Paused = = $Paused While $Paused sleep(100) WEnd EndFuncFunc Stop() ;to allow the script to stopExit ;sameEndFunc ;samecan u adjust my script and post ? Link to comment Share on other sites More sharing options...
muhmuuh Posted March 8, 2008 Share Posted March 8, 2008 (edited) $Paused = = $Paused should be $Paused = not $Paused I believe this is just a typing mistake Edited March 8, 2008 by muhmuuh I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
Orcc Posted March 8, 2008 Author Share Posted March 8, 2008 (edited) #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: Beta Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("-", "Stop") ;script can be stopped by pressing - Sleep(4000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window While 1 ;repeat endlessly Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait .80 seconds Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait 1 seconds Send("{7}") ;simluate 7 keypress Sleep(3000) ;wait 3 seconds WEnd ;repeat Func TogglePause() $Paused = not $Paused While $Paused sleep(100) WEnd EndFunc Func Stop() ;to allow the script to stop Exit ;same EndFunc ;same i edited it but getting a error now? can someone review it and help edit the script? Edited March 8, 2008 by Orcc Link to comment Share on other sites More sharing options...
muhmuuh Posted March 8, 2008 Share Posted March 8, 2008 (edited) Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("-", "Stop") ;script can be stopped by pressing - Sleep(4000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window While 1 ;repeat endlessly ;Send("{F1}") ;simluate f1 keypress ;Sleep(800) ;wait .80 seconds ;Send("{F1}") ;simluate f1 keypress ;Sleep(800) ;wait 1 seconds ;Send("{7}") ;simluate 7 keypress ;Sleep(3000) ;wait 3 seconds ToolTip("runing") WEnd ;repeat Func TogglePause() $Paused = not $Paused While $Paused ToolTip("paused") sleep(100) WEnd EndFunc Func Stop() ;to allow the script to stop Exit ;same EndFunc ;same This works on my computer Can you tell what the error is? Edited March 8, 2008 by muhmuuh I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
Orcc Posted March 9, 2008 Author Share Posted March 9, 2008 (edited) That's the error I'm getting with your edited script, but mines is similar or it says something about pause. not being right. Edited March 9, 2008 by Orcc Link to comment Share on other sites More sharing options...
Achilles Posted March 9, 2008 Share Posted March 9, 2008 From your screen shot I would guess that you copied too much text when you highlighted his code. Try starting from Global $Paused and commenting out EVERYTHING above that. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Orcc Posted March 9, 2008 Author Share Posted March 9, 2008 From your screen shot I would guess that you copied too much text when you highlighted his code. Try starting from Global $Paused and commenting out EVERYTHING above that.No thats not it.. I started at global. also... someone find a answr? Link to comment Share on other sites More sharing options...
muhmuuh Posted March 9, 2008 Share Posted March 9, 2008 you missed #cs somewhere above line 13 I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. 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