cypher175 Posted April 9, 2009 Share Posted April 9, 2009 what would the code look like if i wanted to "Do/Loop" Some Functions For a Certain Amount of Time..?? Say for 20Min and then after that then do something else..?? Link to comment Share on other sites More sharing options...
NBJ Posted April 9, 2009 Share Posted April 9, 2009 (edited) You could try: #include <GUIConstants.au3> $timer = TimerInit() While 1 $Msg = GUIGetMsg() Switch TimerDiff($timer) Case 1 To 5000 Function1() Case 5001 To 10000 Function2() Case 10001 To 20000 Exit EndSwitch If $Msg = $GUI_EVENT_CLOSE Then Exit WEnd Func Function1() ConsoleWrite(@CR & " Function 1 for 5000 ms ") EndFunc ;==>Function1 Func Function2() ConsoleWrite(@CR & " Function 2 for 5000 ms ") EndFunc ;==>Function2 Hope that helps Cheers NBJ Edited April 9, 2009 by NBJ Link to comment Share on other sites More sharing options...
cypher175 Posted April 9, 2009 Author Share Posted April 9, 2009 is there any other way to do this..?? yer code looks like it will only do 2 function for 2 specific time periods.. I want to do a flow of functions in a loop for 20Min.. is there anyway to do it so i don't have to specify time periods for each specific function that i want to perform..?? that way each function can perform without a time constraint, but when the 20Min is up it moves on to the next code/functions out of the loop in the script.. is there any other way to do this like i want to do..?? Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 9, 2009 Share Posted April 9, 2009 #include <GUIConstants.au3> $timer = TimerInit() While 1 $Msg = GUIGetMsg() Switch TimerDiff($timer) Case 1 To 10000 Function1() Function2() Case 10001 To 20000 Exit EndSwitch If $Msg = $GUI_EVENT_CLOSE Then Exit WEnd Func Function1() ConsoleWrite(@CR & " Function 1 for 5000 ms ") EndFunc ;==>Function1 Func Function2() ConsoleWrite(@CR & " Function 2 for 5000 ms ") EndFunc ;==>Function2 ? Giggity 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