Sign in to follow this  
Followers 0
Sardith

FileREad

3 posts in this topic

$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]

Share this post


Link to post
Share on other sites



$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

Nothing mentioned?

FileReadLine() + _FileCountLines()?


[center]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.[/center]

Share this post


Link to post
Share on other sites

$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

you could use _FileReadToArray() and just check that last element of the array...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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
Sign in to follow this  
Followers 0