BleedinFist Posted September 11, 2007 Share Posted September 11, 2007 Okay basically I'm running a script that uses Filereadline to read a line of text from a telnet logfile (*.txt) until it reaches the eof, at which point it sends the telnet window a command polling it for new data to log and read... but the problem is that filereadline's @error never =-1 and it keeps on going, even if the file has only one line!! I really need help figuring out how to do this (the program is supposed to be searching for specific strings within each line but if i cant get it to stop reading then i cant even progress to this) Ex.sleep(1000) If $turniton=1 Then $text=FileReadLine("TELNETLOG", $line) sleep(100) If Not @error=-1 Then $line=$line+1 MsgBox(0, "Keep on reading...", "havent reached eof yet!!!") Else ;else the last line is reached so poll it for more data MsgBox(0, "EoF Found", "ZOMG eof is found!!!") ;polling for data goes here EndIf Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 11, 2007 Share Posted September 11, 2007 I think you are getting an @error, but not -1. Because you are not hitting EOF, you are incrementing to an invalid line number with $line. The FileReadLine() command automatically reads the next line. Drop out the code where you are managing the line number. Let FileReadLine() take care of it. You could also watch for any non-zero @error by changing your check to just: $text = FileReadLine("TELNETLOG") If Not @error Then MsgBox(0, "Keep on reading...", $text) Else MsgBox(0, "EoF Found", "ZOMG eof is found!!!") EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
BleedinFist Posted September 11, 2007 Author Share Posted September 11, 2007 I think you are getting an @error, but not -1. Because you are not hitting EOF, you are incrementing to an invalid line number with $line. The FileReadLine() command automatically reads the next line. Drop out the code where you are managing the line number. Let FileReadLine() take care of it. You could also watch for any non-zero @error by changing your check to just: $text = FileReadLine("TELNETLOG") If Not @error Then MsgBox(0, "Keep on reading...", $text) Else MsgBox(0, "EoF Found", "ZOMG eof is found!!!") EndIf grrr this is driving me crazy, i tried what you said but it keeps doing the same thing... using your snippet of code it just keeps coming up with blank text boxes instead of realizing it has hit the last line... and i checked out the log in notepad but it only has one line so im completely lost. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 11, 2007 Share Posted September 11, 2007 grrr this is driving me crazy, i tried what you said but it keeps doing the same thing... using your snippet of code it just keeps coming up with blank text boxes instead of realizing it has hit the last line... and i checked out the log in notepad but it only has one line so im completely lost.How did you open the file? Is it still open to another app while you are doing this? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
BleedinFist Posted September 11, 2007 Author Share Posted September 11, 2007 Yeah the file is still open to telnet Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 11, 2007 Share Posted September 11, 2007 Yeah the file is still open to telnetHmm... that may have something to do with it... can you FileCopy() the log and work off the copy? I'm not sure a file still open in memory HAS an EOF yet (get's created on file write/close). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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