Orgins Posted October 20, 2006 Share Posted October 20, 2006 How can I put a time limit on loops? I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 20, 2006 Moderators Share Posted October 20, 2006 Look at TimerInit() and TimerDiff(). You're question is broad, if you just want to know what functions you would probably use, I gave that to you. If you want someone to write it for you, you'll need to show what you did to try and use those 2 functions first. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Orgins Posted October 20, 2006 Author Share Posted October 20, 2006 (edited) Ok so I looked them over and figer it should be something like this: $begin = TimerInit() $dif = TimerDiff($begin) $Value2 = PixelChecksum(249, 216, 249, 216) While $Value2 = PixelChecksum(249, 216, 249, 216) Sleep(1000) If $Dif > 300000 Then Send("Exit") WEnd Or is that jsut F'ed up? or more like this? TimerInit() TimerDiff($begin) $Value2 = PixelChecksum(249, 216, 249, 216) While $Value2 = PixelChecksum(249, 216, 249, 216) Sleep(1000) If $Dif > 300000 Then Send("Exit") WEnd Edited October 20, 2006 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
Paulie Posted October 20, 2006 Share Posted October 20, 2006 Ok so I looked them over and figer it should be something like this:I don't know why you want to send Exit on the end, but other then that, you're pretty close. Sleep(3000) $Begin = TimerInit() $Value2 = PixelChecksum(249, 216, 249, 216) While $Value2 = PixelChecksum(249, 216, 249, 216) Sleep(1000) TimerDiff($begin) If $Dif > 300000 Then Send("Exit");do you just want to exit? WEnd Does that suit you needs better? Link to comment Share on other sites More sharing options...
The Kandie Man Posted October 20, 2006 Share Posted October 20, 2006 (edited) More like this: $begin = TimerInit() $Value2 = PixelChecksum(249, 216, 249, 216) While $Value2 = PixelChecksum(249, 216, 249, 216) Sleep(1000) If TimerDiff($begin)/1000 > 300 Then Exitloop WEnd oÝ÷ Øhmºw^®ËZÜ!jܨ¹ªÞ¶¼¢hv"¶®¢Ý7éV¥¹í Edited October 20, 2006 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
Paulie Posted October 20, 2006 Share Posted October 20, 2006 Perhaps you mean this: $begin = TimerInit() $Value2 = PixelChecksum(249, 216, 249, 216) While 1 $Value2 = PixelChecksum(249, 216, 249, 216) Sleep(1000) If TimerDiff($begin)/1000 > 300 Then Exitloop WEndNo, because that would redefine the checksum and make his script not work He got his script from another thread, and he wanted to have a script wait to do something until that particular pixel changed, hes now just trying to put the 300 second timeout if nothing changes for 300 seconds Link to comment Share on other sites More sharing options...
Orgins Posted October 20, 2006 Author Share Posted October 20, 2006 (edited) I like you guys people actually help here. Thxs. Edit* Truns out TimerInit()/TimerDiff doesn't like loops. Guess it uses the old dif. Anyways I figerd how it fix it. $x = 0 Do $x = $x + 1 $begin = TimerInit() $Value2 = PixelChecksum(249, 216, 249, 216) While $Value2 = PixelChecksum(249, 216, 249, 216) Sleep(1000) If TimerDiff($begin)/1000 > 300 Then Exitloop WEnd Until $x = 1 Edited October 20, 2006 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. 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