ghettochild Posted May 24, 2004 Share Posted May 24, 2004 I need help using: Function: _FileCountLines( $sFilePath ) It was in the help file. Can someone make it read a file and report back in msgbox? just so i can get the gist of it. i keep trying something to the effect of: $linecount = Function: _FileCountLines( $sFilePath ) yes, yes i do know that the $sfilepath is default (in my script the file path is perfect.) Link to comment Share on other sites More sharing options...
kalayaan Posted May 24, 2004 Share Posted May 24, 2004 _filecountlines is a user-defined function (UDF) that counts the number of lines in a file. The syntax would be something like: $linecount = _FileCountLines( $sFilePath ) Where $sFilePath is the name of the file you wish to analyze. But you'll net to include this line somewhere on the top of your script: #include <file.au3> You can try this: #include <file.au3> $A = _filecountlines("mytextfile.txt") MsgBox(0,"","The file has " & $A & "lines.") Hope that helped. Link to comment Share on other sites More sharing options...
scriptkitty Posted May 24, 2004 Share Posted May 24, 2004 if you want to do it yourself, lines are simply @CRLF or @CR, or @LF. if it is a normal windows text file, you can simply count the @CR in a file. $file=FileRead("c:\myfile.txt",Filegetsize("c:\myfile.txt")) $x=Stringsplit($file,@CR) msgbox(1,"Line count","There are " & $x[0] & " lines.") AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
redndahead Posted May 24, 2004 Share Posted May 24, 2004 Wouldn't the last line not have a @CR so it would be the total lines + 1? red 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