IgorChete Posted December 29, 2010 Share Posted December 29, 2010 Basically, i want to test if a certain command in my script has completed in certain amount of time. Something like this: Timer starts Some commands if the timer hasn't reached 30 seconds, reset timer. I've read the Help file about _Timer_SetTimer, but i don't really understand how it works. Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 29, 2010 Share Posted December 29, 2010 Keep it simple. Stick with TimerInit() and TimerDiff(): Global $iTimer While 1 $iTimer = TimerInit() ; Do stuff If TimerDiff($iTimer) > 10000 Then MsgBox(16, "Timeout", "That took longer than 10 seconds.") ExitLoop EndIf WEnd Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
IgorChete Posted December 29, 2010 Author Share Posted December 29, 2010 $iTimer = TimerInit() resets the timer to 0, right? I've integrated your code into my script and now i wait for the IE to freeze at some point to see if it works properly. Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 29, 2010 Share Posted December 29, 2010 $iTimer = TimerInit() resets the timer to 0, right?No, it get the current value of an RT Clock. Then TimerDiff() will get you the difference between that saved value and the new current value of the RTC, which is approx the number of milliseconds elapsed. You can test that by displaying the value. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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