MuffettsMan Posted October 24, 2006 Posted October 24, 2006 i have found a few posts on getting auto it to tail log files and hacked together something workable (in a test platform) however when I try to implement it with the actual log file autoit just... fails >.< hoping there is simply a flaw in my tail logic (though it works great if you are tail'ing a file that you have open with notepad need help.. mental help lol Dim $Prev_Line Dim $Curr_Line HotKeySet("+!d", "ClearToolTip") ;Shift-Alt-d while 1 $aSplit = StringSplit(StringStripCR(FileRead('test.txt')), @LF) $Curr_Line = $aSplit[$aSplit[0]] if $Curr_Line <> $Prev_Line Then ; MsgBox(64, 'Last Line Changed:', $Curr_Line, 1) ; ToolTip("Curr: " & $Curr_Line & "Prev: " & $Prev_Line) ; ToolTip($Curr_Line) $Prev_Line = $Curr_Line $WhisperArray = StringRegExp($Curr_Line, "\|h\[(.*)\]\|h whispers\: (.*)",1) If @error == 0 Then ; Example line trying to regex... ; 6:37 PM [9:37:26] |HType:Status|h[Status]|h Link: Random Data Message Here.... MsgBox(0, "Regex Example", $WhisperArray[0] & "Link: " & $WhisperArray[1]) ; SoundPlay(@WindowsDir & "\media\tada.wav",1) EndIf Sleep(1000) EndIf WEnd Func ClearToolTip() ToolTip(""); Get rid of the tooltip on the screen EndFunc Don't let that status fool you, I am no advanced memeber!
MuffettsMan Posted October 24, 2006 Author Posted October 24, 2006 under normal circumstances i would just use perl... however with all of autoit's bells and whistles... assuming i can get a tail working there shows much promise. also on a side note i haven't found anything funky with the log ifile itself (ie its not locked out... it can be deleted / additional lines can be saved to it via notepad....) autoit can even copy it to a new file which is why i was hoping there is just some funkiness to my tail that STINKS all puns intended lol Don't let that status fool you, I am no advanced memeber!
GaryFrost Posted October 24, 2006 Posted October 24, 2006 maybe? #include <File.au3> Dim $Prev_Line Dim $Curr_Line Dim $LogFile = @ScriptDir & "\test.txt" HotKeySet("+!d", "ClearToolTip") ;Shift-Alt-d While 1 $Curr_Line = FileReadLine($LogFile, _FileCountLines($LogFile)) If $Curr_Line <> $Prev_Line Then ; MsgBox(64, 'Last Line Changed:', $Curr_Line, 1) ; ToolTip("Curr: " & $Curr_Line & "Prev: " & $Prev_Line) ToolTip($Curr_Line) $Prev_Line = $Curr_Line $WhisperArray = StringRegExp($Curr_Line, "\|h\[(.*)\]\|h whispers\: (.*)", 1) If @error == 0 Then ; Example line trying to regex... ; 6:37 PM [9:37:26] |HType:Status|h[Status]|h Link: Random Data Message Here.... MsgBox(0, "Regex Example", $WhisperArray[0] & "Link: " & $WhisperArray[1]) ; SoundPlay(@WindowsDir & "\media\tada.wav",1) EndIf EndIf Sleep(200) WEnd Func ClearToolTip() ToolTip(""); Get rid of the tooltip on the screen EndFunc ;==>ClearToolTip SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
MuffettsMan Posted October 24, 2006 Author Posted October 24, 2006 maybe? $Curr_Line = FileReadLine($LogFile, _FileCountLines($LogFile)) AWESOME that did it... now on to learning more regex ehhehe ty ty Don't let that status fool you, I am no advanced memeber!
randallc Posted October 24, 2006 Posted October 24, 2006 hi, or if it is a huge log file (100+mb eg), and filecountlines itself takes a few secs, try my tailRW.au3 udf from my sig; lightning fast. Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
MuffettsMan Posted October 24, 2006 Author Posted October 24, 2006 hi,or if it is a huge log file (100+mb eg), and filecountlines itself takes a few secs, try my tailRW.au3 udf from my sig; lightning fast.Best, Randalli actually found that first though i am an autoit noob and couldn't make sense of it for the life of me... luckily i'm only having to deal with small files Don't let that status fool you, I am no advanced memeber!
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