Jump to content

Do...Until OR 30 secs [How To?]


Cambo
 Share

Recommended Posts

I have a Do...Until loop that constantly reads a file for a certain line. Sometimes this doesn't show up, depending on certain circumstances. It looks like this:

Do
Sleep(100)
$Check = FileRead("log")
Until StringInStr($Check, "RandomString")

but sometimes RandomString, doesn't show up. I want it to run this loop until that shows up OR until a set time (like 30 secs) has gone by. I know after 30 secs it is safe to go on, even if RandomString hasn't shown up. I'm not quite sure how to do this. I could put a counter in it, and have it up date the variable and when the variable reaches 300 (30 secs with a Sleep(100)) have an OR $var = 300 at in the Until line, but that seems like a lot of work for something that simple. Any other ideas?

Any help would be greatly appreciated!!

Edited by Cambo
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...