Simucal Posted April 10, 2006 Posted April 10, 2006 Ok... so I am attempting to use the function _FileCountLines, but every time I would on my particular log file it would return "1" line. So, after opening the log file in notepad... I think the problem is the character used to indicate a new line in my file is just @CR and needs to be @CRLF. Because in notepad it is all on one line basically. I was thinking I would need to use StringReplace but I dont want to alter the original log file. How could I have this output the modified text to a temp file? AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
GaryFrost Posted April 10, 2006 Posted April 10, 2006 might work for you. #include <file.au3> Dim $aRecords If Not _FileReadToArray(@ScriptDir & "\readme.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf MsgBox(0,'Line Count',$aRecords[0]) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Simucal Posted April 10, 2006 Author Posted April 10, 2006 That was a clever idea.. however, it is still returning 1. I think the problem still lies in the @CR being used as the character to specify the end of a line vs the @CRLF character. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
GaryFrost Posted April 10, 2006 Posted April 10, 2006 Simucal said: That was a clever idea.. however, it is still returning 1. I think the problem still lies in the @CR being used as the character to specify the end of a line vs the @CRLF character.hmmm, works for me in release and beta, and made sure I had a file that only had @cr,might be a null character in the file your trying to get info from. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Moderators SmOke_N Posted April 10, 2006 Moderators Posted April 10, 2006 (edited) You could try this:$hFileOpen = FileOpen('FileLocationName', 0) $hFileRead = FileRead($hFileOpen , FileGetSize($hFileOpen)) $aSplit = StringSplit($hFileRead, @LF) FileClose($hFileOpen) MsgBox(0, 'Total Lines', 'The Total Lines were: ' & Ubound($aSplit) - 1)And relplace @LF with @CR / @CRLF until you find the right combination I guess. Edit: I didn't have the total lines in there. Edited April 10, 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.
Simucal Posted April 10, 2006 Author Posted April 10, 2006 Attached is the file I am attemping to find the line number of.LogFile.txt AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
GaryFrost Posted April 10, 2006 Posted April 10, 2006 Simucal said: Attached is the file I am attemping to find the line number of.hmmm, it's treating the whole file as 1 line even with the cr's SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
GaryFrost Posted April 10, 2006 Posted April 10, 2006 (edited) $file = FileRead(@ScriptDir & "\LogFile.txt ") $file = StringSplit($file,@CR,1) Msgbox(0,"Line Count", $file[0]) ;For $x = 1 to $file[0] ; Msgbox(0,'Record:' & $x, $file[$x]) ;Next Edit: forgot, my code uses the beta Edited April 10, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Moderators SmOke_N Posted April 10, 2006 Moderators Posted April 10, 2006 This worked too:#include <file.au3> $Location = @DesktopDir & '\Au3Test.txt' Local $aSplit = '' _FileReadToArray($Location, $aSplit) MsgBox(0, '', UBound($aSplit) - 1)442 lines... 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.
Simucal Posted April 10, 2006 Author Posted April 10, 2006 They both work beautifully.. thanks for the solutions! AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
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