Jump to content

While...WEnd loop time limited?


Scinner
 Share

Recommended Posts

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

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

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
What 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.

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...