newbie01 Posted March 24, 2009 Posted March 24, 2009 (edited) My Script like: CODEGlobal $UnPaused HotKeySet("{pause}", "TogglePause") HotKeySet("{ESC}", "Terminate") hotkeyset("^1","aaa") hotkeyset("^2","bbb") While 1 Sleep(100) ToolTip("Script is Paused",0,0) WEnd Func aaa() #include "....1.au3" endfunc Func bbb() #include "....2.au3" endfunc Func TogglePause() $UnPaused = NOT $UnPaused While $UnPaused ToolTip("Sending...",0,0) WEnd EndFunc Func Terminate() Exit 0 EndFunc when I press ctrl+1, script 1 run normally, but when I pause, script 1 quit, to run it again must press Ctrl+1 So how to pause script 1 or 2 and can run it again by press pause again?? Thanks Edited March 24, 2009 by newbie01
Authenticity Posted March 24, 2009 Posted March 24, 2009 Why are you using #include to run the other scripts? This is how it should be done, in my opinion ;] HotKeySet('^1', 'aaa') Func aaa() ; Call Script1 Script1() EndFunc Func Script1 ; What script 1 should do. EndFuncoÝ÷ ض§Ýý²"Ù^²ËhºÇi¨§²×vÜjYb®*mÔíçâ®Ëlr¸©¶+Åç.¶)àr^Ýývf¤zǧ±ëhw%¹×¢¶)íè^i׫në]yø§x-ë®*mßÛ-jÉ"Èy§îËb¢v§uÆ¥)à×ë¢fi«¢+ØìQ¡¥Ì¥ÌÍÉ¥ÁÐĹÔÌ((ìM½µ±½°ÙÉ¥±Ì(¥¹±Õµ½¹)Õ¹}5¥¸ ¤ìQ¡¥Ìչѥ½¸¹µ¡ÌѼչ¥ÅÕ¸(ìMÉ¥Áе¥¸½)¹Õ¹oÝ÷ Ø Ý¶§jëh×6#include "Script.au3" HotKeySet('^1', 'aaa') . . . Func aaa() _Main() EndFunc Hope I'm making sense. ;=]
Spiff59 Posted March 24, 2009 Posted March 24, 2009 (edited) As to your pause issue... Don't you just have your Paused and UnPaused loops, messages and test reversed? I think you're out-of-sync with the actual state of the key. You'll come into the script in a running state and hit the main loop, so that should be your "running" loop, and the other loop would be the paused state. expandcollapse popupGlobal $Paused HotKeySet("{pause}", "TogglePause") HotKeySet("{ESC}", "Terminate") hotkeyset("^1","aaa") hotkeyset("^2","bbb") While 1 For $x = 1 to 999 Sleep(1) ToolTip($x & " - Running",200,200) Next WEnd Func aaa() $Paused = 0 For $z = 1 to 100 Beep(400,50) Next Endfunc Func bbb() $Paused = 0 For $z = 1 to 100 Beep(800,50) Next Endfunc Func TogglePause() $Paused = NOT $Paused While $Paused ToolTip($x & " - Paused",200,200) Wend EndFunc Func Terminate() Exit 0 EndFunc Edit: reworked my explanation (a couple times!) Edited March 26, 2009 by Spiff59
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