Scinner Posted February 26, 2009 Share Posted February 26, 2009 Is there a way to time limit a While WEnd loop? Eg. do this until 4 minutes have passed. Link to comment Share on other sites More sharing options...
Authenticity Posted February 26, 2009 Share Posted February 26, 2009 Yes: Dim $iInit = TimerInit() Do . . If $fSatisfied Then ExitLoop . Until TimerDiff($iInit)/1000 > 4 Link to comment Share on other sites More sharing options...
jvanegmond Posted February 26, 2009 Share Posted February 26, 2009 Yes: Dim $iInit = TimerInit() Do . . If $fSatisfied Then ExitLoop . Until TimerDiff($iInit)/1000 > 4oÝ÷ Ûú®¢×¸)îµëßÙ¬º·²¢é'£î²Ù)à²êÞ~íãjëh×6Dim $iInit = TimerInit() Do . . If $fSatisfied Then ExitLoop . Until TimerDiff($iInit)/1000 > 4*60 github.com/jvanegmond Link to comment Share on other sites More sharing options...
Scinner Posted February 26, 2009 Author Share Posted February 26, 2009 Dim $iInit = TimerInit() Do . . If $fSatisfied Then ExitLoop . Until TimerDiff($iInit)/1000 > 4*60oÝ÷ Ûú®¢×£&m«`¢Z¶Øb²ì¥tÈiÖ¶¬jëh×6Dim $iInit = TimerInit() Do While 1 ;some malicious code here ;) If $fSatisfied Then ExitLoop WEnd Until TimerDiff($iInit)/1000 > 4*60 Should it look like that and if so, what do I declare $fSatisfied as? Link to comment Share on other sites More sharing options...
qazwsx Posted February 26, 2009 Share Posted February 26, 2009 u are putting the while loop inside the do until. Get rid of the while loop and it will work. $satisfied is whatever you want it to be to make it exit you loop. Dim $iInit = TimerInit() Do ;put what you want to run for 4 minutes in here, no while loop is needed, the Do Until takes care of it Until TimerDiff($iInit)/1000 > 4*60 Link to comment Share on other sites More sharing options...
jvanegmond Posted February 26, 2009 Share Posted February 26, 2009 u are putting the while loop inside the do until. Get rid of the while loop and it will work. $satisfied is whatever you want it to be to make it exit you loop. Dim $iInit = TimerInit() Do ;put what you want to run for 4 minutes in here, no while loop is needed, the Do Until takes care of it Until TimerDiff($iInit)/1000 > 4*60What the .... ? Dim $iInit = TimerInit() While TimerDiff($iInit)/1000 < 4*60 ;put what you want to run for 4 minutes in here, no while loop is needed, the Do Until takes care of it Wend The only argument able difference between Do .. Until and While .. Wend is that Do .. Until always executes at least once, because the expression is checked at the end of the loop instead of at the start. github.com/jvanegmond Link to comment Share on other sites More sharing options...
qazwsx Posted February 26, 2009 Share Posted February 26, 2009 Do While 1 ;some malicious code here wink.gif If $fSatisfied Then ExitLoop WEnd Until TimerDiff($iInit)/1000 > 4*60 I was commenting on him having the While inside the do until. I realize he could have just used a while. Link to comment Share on other sites More sharing options...
Scinner Posted February 26, 2009 Author Share Posted February 26, 2009 u are putting the while loop inside the do until. Get rid of the while loop and it will work. $satisfied is whatever you want it to be to make it exit you loop. Dim $iInit = TimerInit() Do ;put what you want to run for 4 minutes in here, no while loop is needed, the Do Until takes care of it Until TimerDiff($iInit)/1000 > 4*60 Thank you for explaining!! 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