IgorChete 0 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. Share this post Link to post Share on other sites
PsaltyDS 39 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 Share this post Link to post Share on other sites
IgorChete 0 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. Share this post Link to post Share on other sites
PsaltyDS 39 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 Share this post Link to post Share on other sites