Jump to content

funcing stupid piece of script


Recommended Posts

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

_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. :D

Link to comment
Share on other sites

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

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
 Share

  • Recently Browsing   0 members

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