cueclub Posted March 19, 2010 Share Posted March 19, 2010 is it possible to have a sleep command on 1 function set and while that is sleeping, run another? could some one point me in the right direction, or if they have done this plz give an example. guess what i am wanting is something like : $next1 = next() sleep(180000(next1)) would that happen or will it wait out the 3 min and then goto the next func? ps: looked in help file. not there that i could see. Thanks Cue Link to comment Share on other sites More sharing options...
MvGulik Posted March 19, 2010 Share Posted March 19, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Spiff59 Posted March 19, 2010 Share Posted March 19, 2010 (edited) Sleep (in effect) pauses the execution of your script. You can not be doing other things in the same process while a Sleep() is executing. You would need to spawn separate child processes and then monitor them from the parent script. You can, however, execute multiple concurrent timers from within a single script. I think you can likely accomplish what you want to do with a few instances of TimerInit() and TimerDiff(). Edited March 19, 2010 by Spiff59 Link to comment Share on other sites More sharing options...
l3ill Posted March 19, 2010 Share Posted March 19, 2010 Or perhaps a HOTKEYSET... that way all of your functions are "asleep" until you call them one at a time. If you could elaborate more maybe some have other suggestions. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
cueclub Posted March 19, 2010 Author Share Posted March 19, 2010 it was a question asked to me by a family member. I will suggest the hot keys. But for an easier approach perhaps the timerinit might be the way to go. I will try all 3 suggestions and post any findings. Thanks Link to comment Share on other sites More sharing options...
Spiff59 Posted March 19, 2010 Share Posted March 19, 2010 Here's the concept I was talking about: #Include <Timers.au3> $delay1 = 2000 ; milliseconds $delay2 = 10000 ; milliseconds $timer1 = _Timer_Init() $timer2 = $timer1 Tooltip(@HOUR & ":" & @MIN & ":" & @SEC) While 1 ; Process your mouse-clicks, keystrokes, or other events, in this $msg switch statement ; $msg = GUIGetMsg() ; Switch $msg ; Case $Button_Whatever ; Do the voodoo that you do here ; Case $Button_Exit, $GUI_EVENT_CLOSE ; ExitLoop ; EndSwitch If _Timer_Diff($timer1) > $delay1 Then Beep(800,50) ; refresh the auditory nerve $timer1= _Timer_Init() EndIf If _Timer_Diff($timer2) > $delay2 Then Tooltip(@HOUR & ":" & @MIN & ":" & @SEC) ; update the tooltip $timer2= _Timer_Init() EndIf Wend Exit This example maintains two timers. One to beep every 2 seconds, and the other to update a display every 10 seconds. Enabling the GUIGetMsg() logic would allow you to process user-initiated events in real time. Is that the sort of functionality you're looking for? Link to comment Share on other sites More sharing options...
cueclub Posted March 20, 2010 Author Share Posted March 20, 2010 I will try to work with this example and present it. not sure why I am the one doing the research on it. but we will see. thx Link to comment Share on other sites More sharing options...
Fubarable Posted March 20, 2010 Share Posted March 20, 2010 It sounds like you're looking to do multi-threaded application, but AFAIK, this can't be done from within one AutoIt program, that you have to instead use the suggestions given above. 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