Smitro Posted March 17, 2008 Share Posted March 17, 2008 How do I get 2 loops rolling at once? For example: While 1 Msgbox (0, "Some Box", "Some Text") Sleep (3000) Wend While 1 Msgbox (0, "Another Box", "Some Other Text") Sleep (5000) Wend How do I make both work together? So every 3 seconds I get an message and every 5 seconds I get another, regardless of what the other is doing. The reason I want it, is so I can have something happen on one side of a window (in a label) and something else to happen on the other side (in another label). Link to comment Share on other sites More sharing options...
Vindicator209 Posted March 17, 2008 Share Posted March 17, 2008 (edited) I'm not sure thats possible, but heres a work around: $Timer1 = TimerInit() $Timer2 = TimerInit() While 1 If TimerDiff($Timer1) > 3000 Then ;Check timer 1 ">" because its not always dead-on Msgbox (0, "Some Box", "Some Text") $Timer1 = TimerInit() ;reset timer EndIf If TimerDiff($Timer2) > 5000 Then Msgbox (0, "Another Box", "Some Other Text") $Timer2 = TimerInit() EndIf WEnd Letme check this real quick, to make sure it works EDIT: made some changes but that should work XD Edited March 17, 2008 by MethodZero [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
FreeFry Posted March 17, 2008 Share Posted March 17, 2008 (edited) One other workaround is to have your script write two(or one if you wanna keep it "tight") temporary script(s), then run them from your (compiled) program, have a look in the help file under the section Using AutoIt -> Command Line Parameters. Edited March 17, 2008 by FreeFry Link to comment Share on other sites More sharing options...
Tomb Posted March 17, 2008 Share Posted March 17, 2008 i have always wondered this also. Link to comment Share on other sites More sharing options...
FreeFry Posted March 17, 2008 Share Posted March 17, 2008 Other than these workarounds there's no 'real' (real as in built-in) way to 'multi-task' like other multi-threaded languages do(autoit is single threaded, except for some functions) I'm afraid. :/ Link to comment Share on other sites More sharing options...
Tomb Posted March 17, 2008 Share Posted March 17, 2008 Other than these workarounds there's no 'real' (real as in built-in) way to 'multi-task' like other multi-threaded languages do(autoit is single threaded, except for some functions) I'm afraid. :/that is disapointing to read Link to comment Share on other sites More sharing options...
FreeFry Posted March 17, 2008 Share Posted March 17, 2008 Sorry. :/ There are some UDF's around on this forum somewhere that simulated multi-tasking by various methods though, worth to have a look into if you need to do several things at once. 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