Jump to content

Recommended Posts

Posted

Hi. I want to read the last line of a text file . How can I find the number of the last line to do this?

I use

$lineIwant = FileReadLine($file,$lastline) How can I make $lastline?

Posted (edited)

#Include <File.au3>
$NumberOfLines = _FileCountLines($file)
$ReadLastLine = FileReadLine($file, $NumberOfLines)

Kurt

EDIT: Forgot the File.au3 include

Edited by _Kurt

Awaiting Diablo III..

Posted

Hi. I want to read the last line of a text file . How can I find the number of the last line to do this?

I use

$lineIwant = FileReadLine($file,$lastline) How can I make $lastline?

Maybe...

; Read the last line of a text file
; author - SmOke_N

$aSplit = StringSplit(StringStripCR(FileRead('FileLocation.Name')), @LF)
MsgBox(64, 'Last Line', $aSplit[$aSplit[0]])

There are many helpful additions to your script here

Autoit Wrappers ... Just the Best of the Best!!!

8)

NEWHeader1.png

Posted

#Include <File.au3>
$NumberOfLines = _FileCountLines($file)
$ReadLastLine = FileReadLine($file, $NumberOfLines)

Kurt

EDIT: Forgot the File.au3 include

Thanks to all. I was trying about an hour to do this... This works excellent for me. It needs the File.au3 include. Thanks again.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...