Sardith Posted March 12, 2007 Posted March 12, 2007 $file = FileOpen("test.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) IS there anyway to read the last line of a .txt file? Or have it read a time stamp, which ever is closes to the current time thats the one it reads? Nothing is mentioned in the Help file. Format: 12:00:15 PM CPU Temp 31 PWMIC 36 NF4 Chipset 36 GPU 0 [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]
Moderators SmOke_N Posted March 12, 2007 Moderators Posted March 12, 2007 $file = FileOpen("test.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) IS there anyway to read the last line of a .txt file? Or have it read a time stamp, which ever is closes to the current time thats the one it reads? Nothing is mentioned in the Help file. Format: 12:00:15 PM CPU Temp 31 PWMIC 36 NF4 Chipset 36 GPU 0Nothing mentioned? FileReadLine() + _FileCountLines()? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
seandisanti Posted March 12, 2007 Posted March 12, 2007 $file = FileOpen("test.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) IS there anyway to read the last line of a .txt file? Or have it read a time stamp, which ever is closes to the current time thats the one it reads? Nothing is mentioned in the Help file. Format: 12:00:15 PM CPU Temp 31 PWMIC 36 NF4 Chipset 36 GPU 0you could use _FileReadToArray() and just check that last element of the array...
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