kkurniawan Posted January 16, 2006 Share Posted January 16, 2006 Hi there, I want to use _FileCountLines to count how many lines in the file and show the number of the lines with the message box. I looked at AutoIt help file and found _FileCountLines function, but when I tried the example, nothing happens. Did I miss something? #include<file.au3> $CountLines = _FileCountLines("C:\error.log") MsgBox(64, "Error log recordcount", "There are " & $CountLines & " in the error.log.") Exit Thanks. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2006 Moderators Share Posted January 16, 2006 (edited) Is there actually an 'error.log' file at that path location? Edit: Also, are you using the beta 'include'? I think that UDF is in the beta #include <file.au3> Edited January 16, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
kkurniawan Posted January 16, 2006 Author Share Posted January 16, 2006 Yes, there is an error.log under C:. I changed the script and I got error message "Unknown Function for line 2" $sFilePath = FileOpen("C:\error.log", 0) $CountLines = _FileCountLines($sFilePath ) MsgBox(64, "Error log recordcount", "There are " & $CountLines & " in the error.log.") Exit Thanks. Link to comment Share on other sites More sharing options...
Micha1405 Posted January 16, 2006 Share Posted January 16, 2006 (edited) Use it like this with AutoIt Beta !! #include <File.au3> $Importfile="c:\error.log" $file=FileOpen($ImportFile,0) ;for read $CountLines = _FileCountLines($ImportFile) MsgBox(64, "Error log recordcount", "There are " & $CountLines & " in the error.log.") FileClose($file) Edited January 16, 2006 by Micha1405 My TrayToolBar Link to comment Share on other sites More sharing options...
Developers Jos Posted January 16, 2006 Developers Share Posted January 16, 2006 (edited) Use it like this with AutoIt Beta !! #include <File.au3>$Importfile="c:\error.log"$file=FileOpen($ImportFile,0) ;for read $CountLines = _FileCountLines($ImportFile)MsgBox(64, "Error log recordcount", "There are " & $CountLines & " in the error.log.")FileClose($file)You don't need the FileOpen() and FileCLose() lines... _FileCountLines() will handle that.... Edited January 16, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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