Cambo Posted December 7, 2007 Share Posted December 7, 2007 (edited) 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 December 7, 2007 by Cambo Link to comment Share on other sites More sharing options...
Generator Posted December 7, 2007 Share Posted December 7, 2007 (edited) $Timer=TimerInit() Do Sleep(100) $Check = FileRead("log") Until StringInStr($Check, "RandomString") Or TimerDiff($Timer)>(1000*30) Edited December 7, 2007 by Generator Link to comment Share on other sites More sharing options...
Cambo Posted December 7, 2007 Author Share Posted December 7, 2007 Thanks so much! Will try it asap. 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