AC130 Posted August 29, 2012 Share Posted August 29, 2012 How do you stop a long period of sleep? For instance: Sleep(5000) What If I want to interrupt that sleep? I tried Sleep(1), but that didn't work. Maybe I can put sleep in a Do/Loop and declare a function that stops the loop? It would work, but I think there maybe other ways to achieve my goal. Any ideas? Link to comment Share on other sites More sharing options...
AZJIO Posted August 29, 2012 Share Posted August 29, 2012 (edited) Show task, and not something as you try to solve it. Set a smaller size sleep before you start function. You can run "Sleep" several times.Global $TrgStop = 0 HotKeySet("^1", "_Reset") Func _Reset() $TrgStop = 1 EndFunc _Sleep(60000) MsgBox(0, 'Yes?', '<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' />') Func _Sleep($iDelay, $iStep = 50) Local $iCount = Int($iDelay / $iStep) For $i = 1 To $iCount Sleep($iStep) If $TrgStop Then $TrgStop = 0 ExitLoop EndIf Next EndFunc Edited August 30, 2012 by AZJIO My other projects or all 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