tom13 Posted April 15, 2007 Share Posted April 15, 2007 (edited) Hi, I've setup a loop that will execute some piece of script whenever some piece of text is found in some text file. The problem is that when I run the script while the text file has the text in it, it does run the piece of script, but when I then empty the text file it will not "recheck", but it still assumes that the text is in it for the next loop. How can I fix this? $TexttobeRead = FileRead("C:\Documents and Settings\Tom\Bureaublad\Spel\example.log");text to be read Func DeleteLog();Function to delete log files FileDelete("C:\Documents and Settings\Tom\Bureaublad\Spel\example.log") EndFunc While 1;Start Loop If StringInStr($TexttobeRead, "text") Then MsgBox(64, "Tutorial", "The file has the specified text.") DeleteLog() EndIf Wend;End Loop EDIT: I fixed it myself =) Func DeleteLog();Function to delete log files FileDelete("C:\Documents and Settings\Tom\Bureaublad\Spel\example.log") EndFunc While 1;Start Loop $TexttobeRead = FileRead("C:\Documents and Settings\Tom\Bureaublad\Spel\example.log");text to be read If StringInStr($TexttobeRead, "text") Then MsgBox(64, "Tutorial", "The file has the specified text.") DeleteLog() EndIf Wend;End Loop Edited April 15, 2007 by tom13 Link to comment Share on other sites More sharing options...
Paulie Posted April 15, 2007 Share Posted April 15, 2007 (edited) Hi, I've setup a loop that will execute some piece of script whenever some piece of text is found in some text file. The problem is that when I run the script while the text file has the text in it, it does run the piece of script, but when I then empty the text file it will not "recheck", but it still assumes that the text is in it for the next loop. How can I fix this? (Snip) Put the FileRead in the loop: Func DeleteLog();Function to delete log files FileDelete("C:\Documents and Settings\Tom\Bureaublad\Spel\example.log") EndFunc While 1;Start Loop $TexttobeRead = FileRead("C:\Documents and Settings\Tom\Bureaublad\Spel\example.log");text to be read If StringInStr($TexttobeRead, "text") Then MsgBox(64, "Tutorial", "The file has the specified text.") DeleteLog() EndIf Wend;End Loop EDIT: I see you found your problem Edited April 15, 2007 by Paulie 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