Version 2.0.0.7

master 2.0.0.7
Bernhard 2018-10-08 14:51:26 +02:00
parent aea53434e3
commit 4e7927518b
16 changed files with 3043 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.bak

BIN
Chatbox.zip Normal file

Binary file not shown.

44
Colored_Text_Test.au3 Normal file
View File

@ -0,0 +1,44 @@
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiRichEdit.au3>
#include <Color.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 345, 290, 192, 124)
$hRichEdit = _GUICtrlRichEdit_Create($Form1, "", 40, 16, 273, 175, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL,$ES_NOHIDESEL))
$Input1 = GUICtrlCreateInput("[Account]", 40, 202, 121, 21)
$Input2 = GUICtrlCreateInput("mein text", 40, 232, 121, 21)
$Input3 = GUICtrlCreateInput("zusatz", 40, 262, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 192, 232, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_GUICtrlRichEdit_SetSel($hRichEdit,-1,-1)
_GUICtrlRichEdit_AppendText($hRichEdit,GUICtrlRead($Input1))
_RichEdit_AddColoredText($hRichEdit, GUICtrlRead($Input2), 0xFF0000)
_RichEdit_AddColoredText($hRichEdit,"|", 0x000000)
_RichEdit_AddColoredText($hRichEdit,GUICtrlRead($Input3), 0x00FF00)
_RichEdit_AddColoredText($hRichEdit, @CR, 0x000000)
EndSwitch
WEnd
Func _RichEdit_AddColoredText($hRichEdit, $sText, $nColor)
;SEuBo
Local $aSel, $aNSel
$aSel = _GUICtrlRichEdit_GetSel($hRichEdit) ; aktuelle Cursorpos.
_GUICtrlRichEdit_AppendText($hRichEdit, $sText) ; Text ahängen
$aNSel = _GUICtrlRichEdit_GetSel($hRichEdit) ; Cursorpos nach dem Text einfügen
_GUICtrlRichEdit_SetSel($hRichEdit, $aSel[0], $aNSel[0], True) ; Geschriebenen Text wählen
_GUICtrlRichEdit_SetCharColor($hRichEdit, $nColor) ; Einfärben
_GUICtrlRichEdit_SetSel($hRichEdit, -1, -1) ; Und cursor ans ende setzen
EndFunc ;==>_RichEdit_AddColoredText

BIN
Icon256-32.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

219
Tail.au3 Normal file
View File

@ -0,0 +1,219 @@
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; ===============================================================================================================================
#include <GuiConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
; ===============================================================================================================================
Global Const $INI = @ScriptDir & "\Tail.ini"
Global Const $W = 750
Global Const $H = 500
Global Const $MinW = 600
Global Const $MinH = 400
; ===============================================================================================================================
Global $LogFile = ""
Global $LogPath = IniRead($INI, "Tail", "Path", "")
Global $MaxBytes = 1024
$aM = DllCall("User32.dll", "Int", "GetSystemMetrics", "Int", 15) ; SM_CYMENU = 15
$DH = 20 + $aM[0]
; ===============================================================================================================================
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", BitOR($GUI_DOCKSIZE, $GUI_DOCKLEFT, $GUI_DOCKBOTTOM))
$hGUI = GUICreate("Tail", $W, $H, -1, -1, BitOr($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$idFileMenu = GUICtrlCreateMenu("&File")
$idOpen = GUICtrlCreateMenuItem("&Open", $idFileMenu)
GUICtrlSetOnEvent(-1, "_Open")
$idRead = GUICtrlCreateMenuItem("&Read", $idFileMenu)
GUICtrlSetOnEvent(-1, "_Read")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateMenuItem("", $idFileMenu)
$idExit = GUICtrlCreateMenuItem("&Exit", $idFileMenu)
GUICtrlSetOnEvent(-1, "_Exit")
$idEditMenu = GUICtrlCreateMenu("&Edit")
$idClear = GUICtrlCreateMenuItem("&Clear", $idEditMenu)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, "_Clear")
$idSave = GUICtrlCreateMenuItem("&Save", $idEditMenu)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, "_Save")
$idTailMenu = GUICtrlCreateMenu("&Tail")
$idStart = GUICtrlCreateMenuItem("&Start", $idTailMenu)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, "_StartStop")
$idBytesMenu = GUICtrlCreateMenu("&Bytes")
$idBytes = GUICtrlCreateMenuItem($MaxBytes, $idBytesMenu)
GUICtrlSetOnEvent(-1, "_Bytes")
$idEdit = GUICtrlCreateEdit("", 0, 0, $W, $H - $DH, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY))
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
GUICtrlSetColor(-1, 0x000080)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 9, -1, -1, "Courier New")
GUICtrlSendMsg(-1, $EM_LIMITTEXT, 0, 0)
$idStatus = GUICtrlCreateInput("", 0, $H - $DH, $W, 20, $ES_READONLY)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKBOTTOM, $GUI_DOCKHEIGHT))
$idDummy = GUICtrlCreateDummy()
GUICtrlSetOnEvent(-1, "_Update")
GUIRegisterMsg($WM_GETMINMAXINFO, "_MinInfo")
GUISetState()
While True
Sleep(1000)
WEnd
; ===============================================================================================================================
; GUI & menu functions
; ===============================================================================================================================
Func _Exit()
AdlibUnRegister("_Tail_AdLib")
GUIDelete()
Sleep(250)
Exit
EndFunc
; ===============================================================================================================================
Func _MinInfo($hWnd, $iMsg, $wParam, $lParam)
Local $MINMAXINFO = DllStructCreate("LONG[10]", $lParam)
DllStructSetData($MINMAXINFO, 1, $MinW, 7)
DllStructSetData($MINMAXINFO, 1, $MinH, 8)
Return $GUI_RUNDEFMSG
EndFunc
; ===============================================================================================================================
Func _Update()
Local $Tail = _Tail_Content()
GUICtrlSendMsg($idEdit, $EM_SETSEL, -2, -1)
GUICtrlSetData($idEdit, $Tail, 1)
GUICtrlSetData($idStatus, StringLen($Tail) & " bytes read")
EndFunc
; ===============================================================================================================================
Func _Open()
GUICtrlSetData($idStatus, "")
Local $File, $Pos
$File = FileOpenDialog( "Tail - Open File", $LogPath, "Text (*.*)", 3, "" , $hGUI)
If @error Then Return
$Pos = StringInStr($File, "\", 0, -1)
$LogPath = StringLeft($File, $Pos)
IniWrite($INI, "Tail", "Path", $LogPath)
_Clear()
GUICtrlSetState($idRead, $GUI_ENABLE)
GUICtrlSetState($idClear, $GUI_ENABLE)
GUICtrlSetState($idSave, $GUI_ENABLE)
GUICtrlSetState($idStart, $GUI_ENABLE)
WinSetTitle($hGUI, "", "Tail - " & $File)
$LogFile = $File
_Tail($LogFile, $MaxBytes)
EndFunc
; ===============================================================================================================================
Func _Read()
_Clear()
_Tail($LogFile, $MaxBytes)
EndFunc
; ===============================================================================================================================
Func _Clear()
GUICtrlSetData($idStatus, "")
GUICtrlSetData($idEdit, "")
EndFunc
; ===============================================================================================================================
Func _Save()
GUICtrlSetData($idStatus, "")
Local $Sel, $File, $Handle, $Now
$Sel = ControlCommand($hGUI, "", $idEdit, "GetSelected")
If Not $Sel Then Return GUICtrlSetData($idStatus, "ERROR: Save - No text selected!")
$File = FileSaveDialog("Tail - Append Selection to File", @ScriptDir, "Text (*.txt)", 0, "Log.txt", $hGUI)
If @error Then Return
$Handle = FileOpen($File, 1)
If $Handle = -1 Then Return GUICtrlSetData($idStatus, "ERROR: Save - Cannot open file for writing!")
$Now = StringFormat("%04d-%02d-%02d %02d:%02d:%02d > ", @YEAR, @MON, @MDAY, @HOUR, @MIN, @SEC)
FileWrite($Handle, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" & @CRLF)
FileWrite($Handle, $Now & $LogFile & @CRLF)
FileWrite($Handle, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" & @CRLF)
FileWrite($Handle, $Sel & @CRLF)
FileClose($Handle)
GUICtrlSetData($idStatus, "Save: " & StringLen($Sel) & " chars saved to file " & $File)
EndFunc
; ===============================================================================================================================
Func _StartStop()
GUICtrlSetData($idStatus, "")
If GUICtrlRead($idStart, 1) = "&Start" Then
AdlibRegister("_Tail_AdLib", 500)
GUICtrlSetData($idStart, "&Stop")
$State = $GUI_DISABLE
Else
AdlibUnRegister("_Tail_AdLib")
GUICtrlSetData($idStart, "&Start")
$State = $GUI_ENABLE
EndIf
GUICtrlSetState($idOpen, $State)
GUICtrlSetState($idRead, $State)
GUICtrlSetState($idExit, $State)
GUICtrlSetState($idClear, $State)
GUICtrlSetState($idSave, $State)
GUICtrlSetState($idBytes, $State)
EndFunc
; ===============================================================================================================================
Func _Bytes()
Opt("GUIOnEventMode", 0)
GUISetState(@SW_DISABLE, $hGUI)
Local $hBytesGUI = Guicreate("Tail - Bytes", 300, 125, -1, -1, -1, -1, $hGUI)
GUICtrlCreateLabel("Initial number of bytes (max. 999999):", 20, 20, 260, 20)
Local $idInp = GUICtrlCreateInput($MaxBytes, 20, 40, 260, 20, $ES_NUMBER)
GUICtrlSetLimit(-1, 6)
Local $idBtn = GUICtrlCreateButton("OK", 20, 80, 260, 25)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
GUISetState()
While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idBtn
$MaxBytes = GUICtrlRead($idInp)
GUICtrlSetData($idBytes, $MaxBytes)
ExitLoop
EndSwitch
WEnd
Opt("GUIOnEventMode", 1)
GUISetState(@SW_ENABLE, $hGUI)
GUIDelete($hBytesGui)
EndFunc
; ===============================================================================================================================
; Tail functions
; ===============================================================================================================================
Func _Tail_AdLib()
_Tail()
EndFunc
; ===============================================================================================================================
Func _Tail_Content($bSet = False, $sNew = "")
Local Static $Tail = ""
If $bSet Then $Tail = $sNew
Return $Tail
EndFunc
; ===============================================================================================================================
Func _Tail($sFile = "", $nBytes = 1024)
Local Static $TailPos = 0
Local Static $TailFile = ""
Local $TailNew = ""
If $sFile Then
$TailFile = $sFile
$TailPos = 0
EndIf
Local $Handle = FileOpen($TailFile)
If $Handle = -1 Then Return
FileSetPos($Handle, 0, 2)
Local $Size = FileGetPos($Handle)
If $TailPos = 0 Then
If $Size > $nBytes Then
$TailPos = $Size - $nBytes
EndIf
ElseIf $Size < $TailPos Then
$TailPos = $Size
EndIf
If $Size > $TailPos Then
FileSetPos($Handle, $TailPos, 0)
$TailNew = FileRead($Handle)
$TailPos = FileGetPos($Handle)
EndIf
FileClose($Handle)
If $TailNew Then
_Tail_Content(True, $TailNew)
GUICtrlSendToDummy($idDummy)
EndIf
EndFunc

BIN
Tail.exe Normal file

Binary file not shown.

83
_ChatBox.au3 Normal file
View File

@ -0,0 +1,83 @@
#include-once
#include <GuiRichEdit.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <SendMessage.au3>
Local $__CB__filesstr="{\rtf1\utf8" & @CRLF & "{\colortbl;" & @CRLF & "}" & @CRLF & @CRLF & "}"
;Local $__CB__filesstr="{\rtf1\utf8"&@CRLF&"{\colortbl;"&@CRLF&"\red0\green0\blue0;"&@CRLF&@CRLF&"}"&@CRLF&@CRLF&"}"
Func _ChatBoxCreate($gui,$txt="",$x=0,$y=0,$w=100,$h=100,$bgc="0xFFFFFF",$readonly=True,$autodetecturl=True)
Local $ret;RichEdit
$ret=_GUICtrlRichEdit_Create($gui,"",$x,$y,$w,$h,BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
_GUICtrlRichEdit_AutoDetectURL($ret,$autodetecturl)
_GUICtrlRichEdit_SetLimitOnText($ret,-1)
_GUICtrlRichEdit_SetBkColor($ret,$bgc)
_GUICtrlRichEdit_SetReadOnly($ret,$readonly)
If $txt<>"" Then _ChatBoxAdd($ret,$txt)
Return $ret
EndFunc
Func _ChatBoxClear(ByRef $box)
If Not IsHWnd($box) Then Return SetError(101, 0, False)
_GUICtrlRichEdit_SetText($box,"")
EndFunc
Func _ChatBoxDestroy(ByRef $box)
If Not IsHWnd($box) Then Return SetError(101, 0, False)
_GUICtrlRichEdit_Destroy($box)
EndFunc
Func _ChatBoxAdd(ByRef $box,$txt)
If Not IsHWnd($box) Then Return SetError(101, 0, False)
If $txt="" Then Return 0
$txt=__ChatBoxConvert($txt)
_GUICtrlRichEdit_AppendTextUTF8($box,$txt)
EndFunc
Func __ChatBoxConvert($txt)
;~ $txt=StringReplace($txt,"{","\{")
;~ $txt=StringReplace($txt,"}","\}")
$txt = StringReplace($txt, @CRLF, "\line ")
$txt=StringRegExpReplace($txt,"(?i)\[b\](.*?)\[/b\]","{\\b $1}")
$txt=StringRegExpReplace($txt,"(?i)\[i\](.*?)\[/i\]","{\\i $1}")
$txt=StringRegExpReplace($txt,"(?i)\[u\](.*?)\[/u\]","{\\ul $1}")
$txt=StringRegExpReplace($txt,"(?i)\[s\](.*?)\[/s\]","{\\strike $1}")
$txt=StringRegExpReplace($txt,"(?i)\[size=(\d+?)\](.*?)\[/size\]","{\\fs$1 $2}")
Local $aColor = StringRegExp($txt, "(?i)\[c=#([0-9A-Fa-f]{6})\].*?\[/c\]", 3)
Local $sColor, $iColors
If Not @error Then
For $i = 0 To UBound($aColor) - 1
$sColor &= "\red" & Dec(StringMid($aColor[$i], 1, 2)) & "\green" & Dec(StringMid($aColor[$i], 3, 2)) & "\blue" & Dec(StringMid($aColor[$i], 5, 2)) & ";" & @CRLF
$iColors += 1
$txt = StringRegExpReplace($txt, "\[c=#" & $aColor[$i] & "\](.*?)\[/c\]", "\\cf" & $iColors & " $1\\cf0 ")
Next
EndIf
Local $sRTFString = StringMid($__CB__filesstr, 1, StringInStr($__CB__filesstr, "l;" & @CRLF) + 2) & _
$sColor & _
StringTrimRight(StringMid($__CB__filesstr, StringInStr($__CB__filesstr, "l;" & @CRLF, 1, 1) + 4), 4) & _
$txt & _
"}"
Return $sRTFString
EndFunc
; ProgAndy ; Edited
Func _GUICtrlRichEdit_AppendTextUTF8($hWnd, $sText)
If Not IsHWnd($hWnd) Then Return SetError(101, 0, False)
_GUICtrlRichEdit_SetSel($hWnd, -1, -1) ; go to end of text
Local $tSetText = DllStructCreate($tagSETTEXTEX)
DllStructSetData($tSetText, 1, $ST_SELECTION)
DllStructSetData($tSetText, 2, 65001)
Local $iRet = _SendMessage($hWnd, $EM_SETTEXTEX, DllStructGetPtr($tSetText), BinaryToString(StringToBinary($sText, 4), 1), 0, "ptr", "STR")
If Not $iRet Then Return SetError(700, 0, False)
Return True
EndFunc ;==>_GUICtrlRichEdit_AppendText

BIN
_ChatBox.exe Normal file

Binary file not shown.

31
test5.au3 Normal file
View File

@ -0,0 +1,31 @@
#include "_ChatBox.au3"
$data="[s]Hallo,[/s] [b][i]wie[/i] [u]gehts[/u]?[/b]"&@CRLF& _
"[c=#00FF00]Grün"&@CRLF&"![/c]"&@CRLF& _
"[c=#00FF00]Moinsen,[/c] schwarz"&@CRLF& _
"[c=#FF0000]Moinsen,[/c] schwarz"&@CRLF
$Form1 = GUICreate("__A__",588,413)
$Edit1 = _ChatBoxCreate($Form1,"",8,8,572,397,"0x99FFFF")
GUISetState()
_ChatBoxAdd($Edit1,$data)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
Sleep(10)
WEnd
_ChatBoxDestroy($Edit1)

375
znilTAIL-V2.kxf Normal file
View File

@ -0,0 +1,375 @@
<?xml version="1.0" encoding="windows-1251"?>
<object type="TAForm" name="Form_znilTail">
<properties>
<property name="Left" vt="Int16">488</property>
<property name="Top" vt="Int16">278</property>
<property name="Width" vt="Int16">998</property>
<property name="Height" vt="Int16">523</property>
<property name="Caption" vt="String">znilTail: zabbix_agentd.log</property>
<property name="Color" vt="Ident">clBlack</property>
<property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">MS Sans Serif</property>
<property name="Font.Style" vt="Set"/>
<property name="OldCreateOrder" vt="False">False</property>
<property name="Visible" vt="True">True</property>
<property name="Style" vt="Int32">-1798373376</property>
<property name="ExStyle" vt="Int16">256</property>
<property name="Version" vt="String">1.04</property>
<property name="Description" vt="String">A standard Windows Form.</property>
<property name="FormOptOnEvent" vt="False">False</property>
<property name="FormOptExpVars" vt="False">False</property>
<property name="FormOptPopulate" vt="True">True</property>
<property name="FormOptVarsForSet" vt="False">False</property>
<property name="FormOptIndentChar" vt="Int8">0</property>
<property name="FormOptIndentCount" vt="Int8">1</property>
<property name="FormOptIndentInit" vt="Int8">0</property>
<property name="FormOptVarScope" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockAuto, DockLeft, DockBottom</property>
<property name="PixelsPerInch" vt="Int8">96</property>
<property name="TextHeight" vt="Int8">13</property>
</properties>
<components>
<object type="TAEdit" name="EditTailText">
<properties>
<property name="Left" vt="Int8">0</property>
<property name="Top" vt="Int8">38</property>
<property name="Width" vt="Int16">983</property>
<property name="Height" vt="Int16">377</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set"/>
<property name="Lines.Strings" vt="List">
<list>
<li vt="String">Edit1</li>
</list>
</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">0</property>
<property name="CtrlStyle" vt="Int32">1412632772</property>
<property name="CtrlExStyle" vt="Int16">512</property>
<property name="Resizing" vt="Set">DockLeft, DockRight, DockTop, DockBottom</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonOpen">
<properties>
<property name="Left" vt="Int16">900</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">81</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Open another Textfile for tailing</property>
<property name="Caption" vt="String">Open File</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">1</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonStart">
<properties>
<property name="Left" vt="Int8">2</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">81</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">START tailing the file.</property>
<property name="Caption" vt="String">START</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clGreen</property>
<property name="Font.Height" vt="Int8">-16</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">2</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonStop">
<properties>
<property name="Left" vt="Int8">88</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">81</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">STOP tailing!</property>
<property name="Caption" vt="String">STOP</property>
<property name="Enabled" vt="False">False</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clRed</property>
<property name="Font.Height" vt="Int8">-16</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">3</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TACheckbox" name="CheckboxHighlight">
<properties>
<property name="Left" vt="Int8">5</property>
<property name="Top" vt="Int16">418</property>
<property name="Width" vt="Int8">17</property>
<property name="Height" vt="Int8">25</property>
<property name="TabOrder" vt="Int8">4</property>
<property name="CtrlStyle" vt="Int32">1342242819</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockAuto, DockLeft, DockBottom, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAInput" name="InputHighlightText">
<properties>
<property name="Left" vt="Int8">24</property>
<property name="Top" vt="Int16">420</property>
<property name="Width" vt="Int16">958</property>
<property name="Height" vt="Int8">20</property>
<property name="Color" vt="Ident">clMoneyGreen</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-12</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">5</property>
<property name="Text" vt="String">Highlight Lines with this Text</property>
<property name="CtrlStyle" vt="Int32">1342374016</property>
<property name="CtrlExStyle" vt="Int16">512</property>
<property name="Resizing" vt="Set">DockLeft, DockBottom, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonFontPlus">
<properties>
<property name="Left" vt="Int16">192</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">33</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">make Font bigger</property>
<property name="Caption" vt="String">+</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clBlack</property>
<property name="Font.Height" vt="Int8">-27</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">6</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonFontMinus">
<properties>
<property name="Left" vt="Int16">232</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">33</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">make Font smaler</property>
<property name="Caption" vt="String">-</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clBlack</property>
<property name="Font.Height" vt="Int8">-27</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">7</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TACheckbox" name="CheckboxHideText">
<properties>
<property name="Left" vt="Int8">5</property>
<property name="Top" vt="Int16">447</property>
<property name="Width" vt="Int8">17</property>
<property name="Height" vt="Int8">25</property>
<property name="TabOrder" vt="Int8">8</property>
<property name="CtrlStyle" vt="Int32">1342242819</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockAuto, DockLeft, DockBottom, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAInput" name="InputHidetext">
<properties>
<property name="Left" vt="Int8">24</property>
<property name="Top" vt="Int16">449</property>
<property name="Width" vt="Int16">958</property>
<property name="Height" vt="Int8">20</property>
<property name="Color" vt="Ident">clRed</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clYellow</property>
<property name="Font.Height" vt="Int8">-12</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">9</property>
<property name="Text" vt="String">Hide Lines with this Text</property>
<property name="CtrlStyle" vt="Int32">1342374016</property>
<property name="CtrlExStyle" vt="Int16">512</property>
<property name="Resizing" vt="Set">DockLeft, DockBottom, DockHeight</property>
</properties>
<components/>
</object>
<object type="TALabel" name="LabelCounter">
<properties>
<property name="Left" vt="Int16">768</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">123</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Number of Bytes that have been read since start.</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">LabelCounter</property>
<property name="Color" vt="Ident">clNavy</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWhite</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentColor" vt="False">False</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">10</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342313217</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockRight, DockTop</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonHelp">
<properties>
<property name="Left" vt="Int16">728</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">33</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">About Box with link to Homepage</property>
<property name="Caption" vt="String">?</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clBlack</property>
<property name="Font.Height" vt="Int8">-24</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">11</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonDebugLevel3">
<properties>
<property name="Left" vt="Int16">292</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int16">153</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Change the DebugLevel of Zabbix Agent to 3 (Warnings) and restart the Agent. If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights. If no Zabbix Agent was found this Button will not shown.</property>
<property name="Caption" vt="String">Restart Zabbix Agent with DebugLevel=3</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">12</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342382080</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonDebugLevel4">
<properties>
<property name="Left" vt="Int16">452</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int16">153</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Change the DebugLevel of Zabbix Agent to 3 (Debugging) and restart the Agent. If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights. If no Zabbix Agent was found this Button will not shown.</property>
<property name="Caption" vt="String">Restart Zabbix Agent with DebugLevel=4</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">13</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342382080</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonRestartAgent">
<properties>
<property name="Left" vt="Int16">610</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">113</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Just Restart the Zabbix Agent (without changing DebugLevel)</property>
<property name="Caption" vt="String">Restart Zabbix Agent</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">14</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342382080</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TALabel" name="LabelStatus">
<properties>
<property name="Left" vt="Int8">0</property>
<property name="Top" vt="Int16">477</property>
<property name="Width" vt="Int16">990</property>
<property name="Height" vt="Int8">19</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">LabelStatus</property>
<property name="Color" vt="Ident">clSilver</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-16</property>
<property name="Font.Name" vt="String">Lucida Console</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentColor" vt="False">False</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">15</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1350697216</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockBottom, DockHeight</property>
</properties>
<components/>
</object>
</components>
</object>

351
znilTAIL.kxf Normal file
View File

@ -0,0 +1,351 @@
<?xml version="1.0" encoding="windows-1251"?>
<object type="TAForm" name="Form_znilTail">
<properties>
<property name="Left" vt="Int16">488</property>
<property name="Top" vt="Int16">278</property>
<property name="Width" vt="Int16">1000</property>
<property name="Height" vt="Int16">517</property>
<property name="Caption" vt="String">znilTail: zabbix_agentd.log</property>
<property name="Color" vt="Ident">clBlack</property>
<property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">MS Sans Serif</property>
<property name="Font.Style" vt="Set"/>
<property name="OldCreateOrder" vt="False">False</property>
<property name="Visible" vt="True">True</property>
<property name="Style" vt="Int32">-1798373376</property>
<property name="ExStyle" vt="Int16">256</property>
<property name="Version" vt="String">1.04</property>
<property name="Description" vt="String">A standard Windows Form.</property>
<property name="FormOptOnEvent" vt="False">False</property>
<property name="FormOptExpVars" vt="False">False</property>
<property name="FormOptPopulate" vt="True">True</property>
<property name="FormOptVarsForSet" vt="False">False</property>
<property name="FormOptIndentChar" vt="Int8">0</property>
<property name="FormOptIndentCount" vt="Int8">1</property>
<property name="FormOptIndentInit" vt="Int8">0</property>
<property name="FormOptVarScope" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockAuto, DockLeft, DockBottom</property>
<property name="PixelsPerInch" vt="Int8">96</property>
<property name="TextHeight" vt="Int8">13</property>
</properties>
<components>
<object type="TAEdit" name="EditTailText">
<properties>
<property name="Left" vt="Int8">0</property>
<property name="Top" vt="Int8">38</property>
<property name="Width" vt="Int16">983</property>
<property name="Height" vt="Int16">377</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="Lines.Strings" vt="List">
<list>
<li vt="String">Edit1</li>
</list>
</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">0</property>
<property name="CtrlStyle" vt="Int32">1412632772</property>
<property name="CtrlExStyle" vt="Int16">512</property>
<property name="Resizing" vt="Set">DockLeft, DockRight, DockTop, DockBottom</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonOpen">
<properties>
<property name="Left" vt="Int16">900</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">81</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Open another Textfile for tailing</property>
<property name="Caption" vt="String">Open File</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">1</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonStart">
<properties>
<property name="Left" vt="Int8">2</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">81</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">START tailing the file.</property>
<property name="Caption" vt="String">START</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clGreen</property>
<property name="Font.Height" vt="Int8">-16</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">2</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonStop">
<properties>
<property name="Left" vt="Int8">88</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">81</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">STOP tailing!</property>
<property name="Caption" vt="String">STOP</property>
<property name="Enabled" vt="False">False</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clRed</property>
<property name="Font.Height" vt="Int8">-16</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">3</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TACheckbox" name="CheckboxHighlight">
<properties>
<property name="Left" vt="Int8">5</property>
<property name="Top" vt="Int16">418</property>
<property name="Width" vt="Int8">17</property>
<property name="Height" vt="Int8">25</property>
<property name="TabOrder" vt="Int8">4</property>
<property name="CtrlStyle" vt="Int32">1342242819</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockAuto, DockLeft, DockBottom, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAInput" name="InputHighlightText">
<properties>
<property name="Left" vt="Int8">24</property>
<property name="Top" vt="Int16">420</property>
<property name="Width" vt="Int16">958</property>
<property name="Height" vt="Int8">24</property>
<property name="Color" vt="Ident">clMoneyGreen</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-12</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">5</property>
<property name="Text" vt="String">Highlight Lines with this Text</property>
<property name="CtrlStyle" vt="Int32">1342374016</property>
<property name="CtrlExStyle" vt="Int16">512</property>
<property name="Resizing" vt="Set">DockLeft, DockBottom, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonFontPlus">
<properties>
<property name="Left" vt="Int16">192</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">33</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">make Font bigger</property>
<property name="Caption" vt="String">+</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clBlack</property>
<property name="Font.Height" vt="Int8">-27</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">6</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonFontMinus">
<properties>
<property name="Left" vt="Int16">232</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">33</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">make Font smaler</property>
<property name="Caption" vt="String">-</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clBlack</property>
<property name="Font.Height" vt="Int8">-27</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">7</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TACheckbox" name="CheckboxHideText">
<properties>
<property name="Left" vt="Int8">5</property>
<property name="Top" vt="Int16">447</property>
<property name="Width" vt="Int8">17</property>
<property name="Height" vt="Int8">25</property>
<property name="TabOrder" vt="Int8">8</property>
<property name="CtrlStyle" vt="Int32">1342242819</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockAuto, DockLeft, DockBottom, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAInput" name="InputHidetext">
<properties>
<property name="Left" vt="Int8">24</property>
<property name="Top" vt="Int16">449</property>
<property name="Width" vt="Int16">958</property>
<property name="Height" vt="Int8">24</property>
<property name="Color" vt="Ident">clRed</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clYellow</property>
<property name="Font.Height" vt="Int8">-12</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">9</property>
<property name="Text" vt="String">Hide Lines with this Text</property>
<property name="CtrlStyle" vt="Int32">1342374016</property>
<property name="CtrlExStyle" vt="Int16">512</property>
<property name="Resizing" vt="Set">DockLeft, DockBottom, DockHeight</property>
</properties>
<components/>
</object>
<object type="TALabel" name="LabelCounter">
<properties>
<property name="Left" vt="Int16">768</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">123</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Number of Bytes that have been read since start.</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">LabelCounter</property>
<property name="Color" vt="Ident">clNavy</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWhite</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentColor" vt="False">False</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">10</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342313217</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockRight, DockTop</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonHelp">
<properties>
<property name="Left" vt="Int16">728</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">33</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">About Box with link to Homepage</property>
<property name="Caption" vt="String">?</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clBlack</property>
<property name="Font.Height" vt="Int8">-27</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">11</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342373888</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonDebugLevel3">
<properties>
<property name="Left" vt="Int16">292</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int16">153</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Change the DebugLevel of Zabbix Agent to 3 (Warnings) and restart the Agent. If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights. If no Zabbix Agent was found this Button will not shown.</property>
<property name="Caption" vt="String">Restart Zabbix Agent with DebugLevel=3</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">12</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342382080</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonDebugLevel4">
<properties>
<property name="Left" vt="Int16">452</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int16">153</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Change the DebugLevel of Zabbix Agent to 3 (Debugging) and restart the Agent. If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights. If no Zabbix Agent was found this Button will not shown.</property>
<property name="Caption" vt="String">Restart Zabbix Agent with DebugLevel=4</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">13</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342382080</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TAButton" name="ButtonRestartAgent">
<properties>
<property name="Left" vt="Int16">610</property>
<property name="Top" vt="Int8">4</property>
<property name="Width" vt="Int8">113</property>
<property name="Height" vt="Int8">30</property>
<property name="Hint" vt="String">Just Restart the Zabbix Agent (without changing DebugLevel)</property>
<property name="Caption" vt="String">Restart Zabbix Agent</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">14</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342382080</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockLeft, DockTop, DockWidth, DockHeight</property>
</properties>
<components/>
</object>
</components>
</object>

263
znilTail-AboutBox.kxf Normal file
View File

@ -0,0 +1,263 @@
<?xml version="1.0" encoding="windows-1251"?>
<object type="TAForm" name="AboutForm">
<properties>
<property name="Left" vt="Int16">726</property>
<property name="Top" vt="Int16">446</property>
<property name="Width" vt="Int16">337</property>
<property name="Height" vt="Int16">278</property>
<property name="Caption" vt="String">About znilTail</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-11</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="OldCreateOrder" vt="False">False</property>
<property name="Visible" vt="True">True</property>
<property name="Style" vt="Int32">-1798700544</property>
<property name="ExStyle" vt="Int16">264</property>
<property name="Version" vt="String">1.04</property>
<property name="Description" vt="String">Standard &quot;AboutBox&quot; Dialog with Picture.</property>
<property name="FormOptOnEvent" vt="False">False</property>
<property name="FormOptExpVars" vt="False">False</property>
<property name="FormOptPopulate" vt="False">False</property>
<property name="FormOptVarsForSet" vt="False">False</property>
<property name="FormOptIndentChar" vt="Int8">0</property>
<property name="FormOptIndentCount" vt="Int8">1</property>
<property name="FormOptIndentInit" vt="Int8">0</property>
<property name="FormOptVarScope" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
<property name="PixelsPerInch" vt="Int8">96</property>
<property name="TextHeight" vt="Int8">14</property>
</properties>
<components>
<object type="TAGroup" name="AboutGroupBoxFreeware">
<properties>
<property name="Left" vt="Int8">8</property>
<property name="Top" vt="Int8">8</property>
<property name="Width" vt="Int16">305</property>
<property name="Height" vt="Int8">81</property>
<property name="CtrlStyle" vt="Int32">1342341127</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="TabOrder" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components>
<object type="TALabel" name="AboutLabelFreeware1">
<properties>
<property name="Left" vt="Int8">1</property>
<property name="Top" vt="Int8">8</property>
<property name="Width" vt="Int16">302</property>
<property name="Height" vt="Int8">35</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">This Tool is FREEWARE!</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-21</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">0</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342309121</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components/>
</object>
<object type="TALabel" name="AboutLabelFreeware2">
<properties>
<property name="Left" vt="Int8">1</property>
<property name="Top" vt="Int8">40</property>
<property name="Width" vt="Int16">302</property>
<property name="Height" vt="Int8">18</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">Copy it, give it away,</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">1</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342308609</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components/>
</object>
<object type="TALabel" name="AboutLabelFreeware3">
<properties>
<property name="Left" vt="Int8">1</property>
<property name="Top" vt="Int8">56</property>
<property name="Width" vt="Int16">302</property>
<property name="Height" vt="Int8">20</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">give it to others who need it!</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">2</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342308609</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components/>
</object>
</components>
</object>
<object type="TAButton" name="AboutButtonOK">
<properties>
<property name="Left" vt="Int16">238</property>
<property name="Top" vt="Int16">208</property>
<property name="Width" vt="Int8">75</property>
<property name="Height" vt="Int8">25</property>
<property name="Caption" vt="String">&amp;OK</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-16</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">1</property>
<property name="Color" vt="Ident">clBtnFace</property>
<property name="CtrlStyle" vt="Int32">1342242816</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set">DockWidth, DockHeight</property>
</properties>
<components/>
</object>
<object type="TALabel" name="AboutLabelWeblink">
<properties>
<property name="Left" vt="Int8">9</property>
<property name="Top" vt="Int16">212</property>
<property name="Width" vt="Int16">222</property>
<property name="Height" vt="Int8">20</property>
<property name="Cursor" vt="Ident">crHandPoint</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">http://znil.net</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clBlue</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsUnderline</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">2</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342308608</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components/>
</object>
<object type="TAGroup" name="AboutGroupboxCommandline">
<properties>
<property name="Left" vt="Int8">8</property>
<property name="Top" vt="Int16">160</property>
<property name="Width" vt="Int16">305</property>
<property name="Height" vt="Int8">41</property>
<property name="CtrlStyle" vt="Int32">1342341127</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Caption" vt="String"> Commandline Call: </property>
<property name="TabOrder" vt="Int8">3</property>
<property name="Resizing" vt="Set"/>
</properties>
<components>
<object type="TALabel" name="AboutLabelCommandline">
<properties>
<property name="Left" vt="Int8">4</property>
<property name="Top" vt="Int8">16</property>
<property name="Width" vt="Int16">299</property>
<property name="Height" vt="Int8">18</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">znilTail.exe [Path+Filename-to-Tail]</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set">fsBold</property>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">0</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342308608</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components/>
</object>
</components>
</object>
<object type="TALabel" name="AboutLabelAuthor">
<properties>
<property name="Left" vt="Int8">8</property>
<property name="Top" vt="Int8">96</property>
<property name="Width" vt="Int16">305</property>
<property name="Height" vt="Int8">18</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">2013/2014 by Bernhard Linz</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">4</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342308608</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components/>
</object>
<object type="TALabel" name="AboutLabelVersion">
<properties>
<property name="Left" vt="Int8">8</property>
<property name="Top" vt="Int8">116</property>
<property name="Width" vt="Int16">305</property>
<property name="Height" vt="Int8">18</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">Version: </property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">5</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342308608</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components/>
</object>
<object type="TALabel" name="AboutLabelContact">
<properties>
<property name="Left" vt="Int8">8</property>
<property name="Top" vt="Int16">136</property>
<property name="Width" vt="Int16">305</property>
<property name="Height" vt="Int8">18</property>
<property name="Cursor" vt="Ident">crHandPoint</property>
<property name="AutoSize" vt="False">False</property>
<property name="Caption" vt="String">Contact: Bernhard@znil.de</property>
<property name="Font.Charset" vt="Ident">ANSI_CHARSET</property>
<property name="Font.Color" vt="Ident">clWindowText</property>
<property name="Font.Height" vt="Int8">-13</property>
<property name="Font.Name" vt="String">Courier New</property>
<property name="Font.Style" vt="Set"/>
<property name="ParentFont" vt="False">False</property>
<property name="TabOrder" vt="Int8">6</property>
<property name="HaveVariable" vt="False">False</property>
<property name="CtrlStyle" vt="Int32">1342308608</property>
<property name="CtrlExStyle" vt="Int8">0</property>
<property name="Resizing" vt="Set"/>
</properties>
<components/>
</object>
</components>
</object>

906
znilTail-V2.au3 Normal file
View File

@ -0,0 +1,906 @@
#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Icon=Icon256-32.ico
#AutoIt3Wrapper_Res_Description=Simple Tail Programm as an Zabbix Tool
#AutoIt3Wrapper_Res_Fileversion=2.0.0.8
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=2015 Bernhard Linz / Bernhard@znil.de
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
#Region ;************ Includes ************
#Include <Inet.au3>
#Include <ButtonConstants.au3>
#Include <StaticConstants.au3>
;~ #include <EditConstants.au3>;~~~
;~ #include <GUIConstantsEx.au3>;~~~
;~ #include <WindowsConstants.au3>;~~~
#include "_ChatBox.au3"
#EndRegion ;************ Includes ************
#Region ------ Dim Variables ------------------------------
Global $Form_znilTail
Global $EditTailText
Global $ButtonStart
Global $ButtonStop
Global $ButtonOpen
Global $CheckboxHighlight
Global $CheckboxHideText
Global $InputHighlightText
Global $InputHidetext
Global $ButtonFontMinus
Global $ButtonFontPlus
Global $iFontsize = 9
Global $nMsg
Global $data
Global $bUseColorize = False
Global $bHideText = False
Global $sTailFileName = ""
Global $sFormTitle = "znilTail: No File selected"
Global $aWndPos
Global $iTextLength = 0
Global $LabelCounter
Global $iRichEditTextLimit = 2147483647 ; 2GB - 1 Byte
Global $ButtonHelp
Global $LabelStatus
Global $i
Global $zabbixAgentName
Global $zabbixAgentConfigFile
Global $hzabbixAgentConfigFile
Global $iCurrentDebugLevel = 99
Global $stemp
Global $sRegSubKey
Global $bShowZabbixAgentButtons = False
Global $bAdminrights = False
Global $ButtonDebugLevel3
Global $ButtonDebugLevel4
Global $ButtonRestartAgent
Global $iTimer
Global $hControl
Global $bAboutFormExit = False
Global $AboutForm, $AboutGroupBoxFreeware, $AboutLabelFreeware1, $AboutLabelFreeware2,$AboutLabelFreeware3
Global $AboutButtonOK, $AboutLabelWeblink, $AboutGroupboxCommandline, $AboutLabelCommandline
Global $AboutLabelAuthor, $AboutLabelVersion, $AboutLabelContact, $nMsg2
Global $aWndPosAboutForm
;Global $iRichEditTextLimit = 1048576
Global $aRegistryBaseServicePaths[3] = ["HKLM\SYSTEM\CurrentControlSet\", _
"HKLM64\SYSTEM\CurrentControlSet\", _
"HKLM\SOFTWARE\Wow6432Node\SYSTEM\CurrentControlSet\"]
Global $iRightRegistryPath
Global $iTailPos = 0
Global $nBytes = 1024
Global $TailNew = ""
Global $sFile
Global $iFileSizeLastRun = 0
Global $iFileSizeNow = 0
Global $iRefreshrate = 400
Global $aStatus[4]
$aStatus[0] = "-"
$aStatus[1] = "\"
$aStatus[2] = "|"
$aStatus[3] = "/"
#EndRegion --- Global Variables ------------------------------
Func _TailBoxCreate($gui,$txt,$x,$y,$w,$h,$bgc,$readonly,$autodetecturl, $style)
Local $ret;RichEdit
$ret=_GUICtrlRichEdit_Create($gui,"",$x,$y,$w,$h,$style)
_GUICtrlRichEdit_AutoDetectURL($ret,$autodetecturl)
;_GUICtrlRichEdit_SetLimitOnText($ret,-1)
_GUICtrlRichEdit_SetBkColor($ret,$bgc)
_GUICtrlRichEdit_SetReadOnly($ret,$readonly)
Return $ret
EndFunc
Func _znilTailAboutBox()
#Region ### START Koda GUI section ### Form=C:\_AutoIt\tail\znilTail-AboutBox.kxf
$AboutForm = GUICreate("About znilTail", 326, 244, 726, 446, BitOR($GUI_SS_DEFAULT_GUI,$DS_SETFOREGROUND), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
GUISetFont(8, 400, 0, "Courier New")
$AboutGroupBoxFreeware = GUICtrlCreateGroup("", 8, 8, 305, 81, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))
$AboutLabelFreeware1 = GUICtrlCreateLabel("This Tool is FREEWARE!", 9, 16, 302, 35, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 16, 800, 0, "Courier New")
$AboutLabelFreeware2 = GUICtrlCreateLabel("Copy it, give it away,", 9, 48, 302, 18, $SS_CENTER)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
$AboutLabelFreeware3 = GUICtrlCreateLabel("give it to others who need it!", 9, 64, 302, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AboutButtonOK = GUICtrlCreateButton("&OK", 238, 208, 75, 25, 0)
GUICtrlSetFont(-1, 12, 400, 0, "Courier New")
$AboutLabelWeblink = GUICtrlCreateLabel("http://znil.net", 9, 212, 222, 20)
GUICtrlSetFont(-1, 10, 400, 4, "Courier New")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
$AboutGroupboxCommandline = GUICtrlCreateGroup(" Commandline Call: ", 8, 160, 305, 41, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))
$AboutLabelCommandline = GUICtrlCreateLabel("znilTail.exe [Path+Filename-to-Tail]", 12, 176, 299, 18)
GUICtrlSetFont(-1, 10, 800, 0, "Courier New")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AboutLabelAuthor = GUICtrlCreateLabel("2013/2014 by Bernhard Linz", 8, 96, 305, 18)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
$AboutLabelVersion = GUICtrlCreateLabel("Version: ", 8, 116, 305, 18)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
$AboutLabelContact = GUICtrlCreateLabel("Contact: Bernhard@znil.de", 8, 136, 305, 18)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$bAboutFormExit = False
GUISetOnEvent($GUI_EVENT_CLOSE, "_CLOSEAboutForm", $AboutForm)
GUICtrlSetOnEvent($AboutButtonOK, "_CLOSEAboutForm")
GUICtrlSetOnEvent($AboutLabelContact, "_AboutLabelContact")
GUICtrlSetOnEvent($AboutLabelWeblink, "_AboutLabelWeblink")
GUICtrlSetData($AboutLabelVersion, "Version: " & FileGetVersion(@ScriptFullPath))
$aWndPosAboutForm = WinGetPos($AboutForm)
WinMove($AboutForm, "About znilTail", (@DesktopWidth - $aWndPosAboutForm[2]) / 2, (@DesktopHeight - $aWndPosAboutForm[3]) / 2, $aWndPosAboutForm[2], $aWndPosAboutForm[3])
;~ While $bAboutFormExit = False
;~ Sleep(100)
;~ WEnd
;~ Return
EndFunc
Func _CLOSEAboutForm()
GUISetState(@SW_HIDE,$AboutForm)
GUIDelete($AboutForm)
$bAboutFormExit = True
EndFunc
Func _AboutLabelContact()
_INetMail("Bernhard@znil.de", "- znilTail.exe - " & FileGetVersion(@ScriptFullPath), "")
EndFunc
Func _AboutLabelWeblink()
ShellExecute ("http://znil.net")
EndFunc
; #####################################################################################################################
Func _SetDebugLevelandRestartAgent($idebuglevel)
Local $aLinesInFile
Local $i
Local $bFoundLine = False
Local $hConfigFile
Local $oShell
_FileReadToArrayLocal($zabbixAgentConfigFile, $aLinesInFile)
For $i = 1 To $aLinesInFile[0]
If StringInStr($aLinesInFile[$i],"DebugLevel") > 0 And StringInStr($aLinesInFile[$i],"#") = 0 Then
If $bFoundLine = False Then
$aLinesInFile[$i] = "DebugLevel=" & $idebuglevel
$bFoundLine = True
Else
;ok we found it more than one time, set the other ones to a comment
$aLinesInFile[$i] = "#" & $aLinesInFile[$i]
EndIf
EndIf
Next
$hConfigFile = FileOpen($zabbixAgentConfigFile, 2)
For $i = 1 To $aLinesInFile[0]
FileWriteLine($hConfigFile, $aLinesInFile[$i])
Next
If $bFoundLine = False Then
;ok, we did not found the value, so we add him as last Entry
FileWriteLine($hConfigFile, "DebugLevel=" & $idebuglevel)
EndIf
FileClose($hConfigFile)
; File is rewritten, so restart the servcie
$i = Run(@ComSpec & ' /c net stop "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
$iTimer = TimerInit()
While ProcessExists("zabbix_agentd.exe") > 0
Sleep(100)
If TimerDiff($iTimer) > 10000 Then
ExitLoop
EndIf
WEnd
;Sleep(2000)
$i = Run(@ComSpec & ' /c net start "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
EndFunc ; ==>_SetDebugLevelandRestartAgent
; #####################################################################################################################
Func _GetDebugLevel()
Local $aLinesInFile
Local $i
Local $bFoundLine = False
Local $hConfigFile
Local $oShell
Local $iReturnValue
_FileReadToArrayLocal($zabbixAgentConfigFile, $aLinesInFile)
For $i = 1 To $aLinesInFile[0]
If StringInStr($aLinesInFile[$i],"DebugLevel") > 0 And StringInStr($aLinesInFile[$i],"#") = 0 Then
If $bFoundLine = False Then
$iReturnValue = StringReplace($aLinesInFile[$i],"DebugLevel=","")
$iReturnValue = StringReplace($aLinesInFile[$i]," ","")
$bFoundLine = True
EndIf
EndIf
Next
If $bFoundLine = False Then
$iReturnValue = 3
EndIf
Return $iReturnValue
EndFunc ; ==>_SetDebugLevelandRestartAgent
; #####################################################################################################################
Func _TailFile()
Local $atemp
Local $sSearchStringHighlight
Local $sSearchStringHide
Local $i
Local $WhoHasFocus = ControlGetHandle($Form_znilTail, '', ControlGetFocus($Form_znilTail))
Local $sLabelStatus
Local $Size
;~ _WinAPI_RedrawWindow($Form_znilTail)
_GUICtrlRichEdit_PauseRedraw($EditTailText)
;~ If $sFile Then
;~ $iTailPos = 0
;~ EndIf
; Schritt 1: Datei öffnen, die 256 steht für "UTF8 without BOM" Format, in dem Format schreibt auch der zabbix_agentd seine Log Datei
;~ $iFileSizeNow = FileGetSize($sTailFileName)
Local $hTailFile = FileOpen($sTailFileName, 256)
If $hTailFile = -1 Then ; Hat das Öffnen nicht geklappt!
MsgBox(0,"","Konnte nicht öffnen!")
Return
EndIf
; Wir gehen an das Ende der Datei
FileSetPos($hTailFile, 0, 2)
; Jetzt lesen wir diese Position aus, ergibt die Länge der Datei
$Size = FileGetPos($hTailFile)
; $iTailPos ist die Leseposition innerhalb der Datei.
; Ist TailPos = 0 dann haben wir noch gar nichts gelesen
If $iTailPos = 0 Then
; Jetzt schauen wir ob die Größe kleiner als $nBytes ist. $nBytes ist die Menge an Bytes die wir sonst initial einlesen
; Ist oben mit 1024 Bytes definiert = 1KByte
If $Size > $nBytes Then
; Die Datei ist größer als 1024 Bytes. Also ziehen wir vom Ende/der Größe der Datei 1024 Bytes ab und fangen dort an zu lesen
$iTailPos = $Size - $nBytes
EndIf
; Kein Else! Ist die Datei kleiner als 1024 Bytes fangen wir bei 0 an zu lesen
EndIf
; Falls die Größer kleiner ist als unserer Lese-Position (kann passieren bei einem Logrotate) springen wir wieder an den Anfang der Datei
If $Size < $iTailPos Then
;~ $iTailPos = $Size
$iTailPos = 0
EndIf
; Wenn $Size größer als unsere letzte Leseposition ist, gibt es etwas zum einlesen!
If $Size > $iTailPos Then
; Wir springen an die letzte Leseposition
FileSetPos($hTailFile, $iTailPos, 0)
; Wir lesen alles bis zum Ende ein, dafür steht die -1
$TailNew = FileRead($hTailFile, -1)
; Wir ermitteln wieder die Position in der Datei - müsste wieder das Ende sein
$iTailPos = FileGetPos($hTailFile)
; Dann machen wir die Datei zu
FileClose($hTailFile)
Else
; Es gibt nichts einzulesen - also raus aus der Funktion
FileClose($hTailFile)
$sLabelStatus = GUICtrlRead($LabelStatus)
If StringLen($sLabelStatus) < 96 Then
$sLabelStatus = $sLabelStatus & "-"
Else
$sLabelStatus = "-"
EndIf
GUICtrlSetData($LabelStatus, $sLabelStatus)
Return
EndIf
_WinAPI_SetFocus($WhoHasFocus)
; Testen wir ob wir etwas eingelesen haben
If StringLen($TailNew) > 0 Then
; _Tail_Content(True, $TailNew) hab nie verstanden wofür diese Funktion ist ...
$sLabelStatus = GUICtrlRead($LabelStatus)
If StringLen($sLabelStatus) < 96 Then
$sLabelStatus = $sLabelStatus & "#"
Else
$sLabelStatus = "#"
EndIf
GUICtrlSetData($LabelStatus, $sLabelStatus)
$iTextLength = $iTextLength + StringLen($TailNew)
If $bUseColorize = True Or $bHideText = True Then
$atemp = StringSplit($TailNew, @CRLF)
$sSearchStringHighlight = GUICtrlRead($InputHighlightText)
$sSearchStringHide = GUICtrlRead($InputHidetext)
;ConsoleWrite($sSearchString & @CRLF)
$TailNew = ""
_WinAPI_SetFocus($WhoHasFocus)
For $i = 1 To $atemp[0]
If $bHideText = True Then
If StringInStr($atemp[$i], $sSearchStringHide) > 1 Then
$atemp[$i] = ""
EndIf
_WinAPI_SetFocus($WhoHasFocus)
EndIf
If StringInStr($atemp[$i], $sSearchStringHighlight) > 1 Then
;$TailNew = $TailNew & "[b][c=#FF0000]" & $atemp[$i] & "[/b][/c]" & @CRLF
_ChatBoxAdd($EditTailText, "[b][c=#CC0000]" & $atemp[$i] & "[/b][/c]" & @CRLF)
;_GUICtrlRichEdit_SetSel($EditTailText, _GUICtrlRichEdit_GetTextLength($EditTailText) - StringLen($atemp[$i]), -1)
;_GUICtrlRichEdit_SetCharBkColor($EditTailText, 0x00FF00)
;_GUICtrlRichEdit_SetCharBkColor($EditTailText, 0xFFFFFF)
Else
If $atemp[$i] <> @CRLF And $atemp[$i] <> "" Then
_ChatBoxAdd($EditTailText, "[c=#666666]" & $atemp[$i] & "[/c]" & @CRLF)
EndIf
EndIf
_WinAPI_SetFocus($WhoHasFocus)
Next
Else
_ChatBoxAdd($EditTailText, $TailNew)
_WinAPI_SetFocus($WhoHasFocus)
EndIf
_GUICtrlRichEdit_SetSel($EditTailText, 0, -1) ; go to begin of text
_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Lucida Console")
_GUICtrlRichEdit_SetSel($EditTailText, -1, -1) ; go to end of text
;ConsoleWrite(StringLen($TailNew) & @CRLF)
EndIf
_WinAPI_SetFocus($WhoHasFocus)
GUICtrlSetData($LabelCounter, StringRegExpReplace(_StringReverse(StringRegExpReplace(_StringReverse($iTextLength),"\d{3}","\0.")),"(?<![0-9])\.","",1))
_WinAPI_SetFocus($WhoHasFocus)
If _GUICtrlRichEdit_GetTextLength($EditTailText) > ($iRichEditTextLimit - 524288) Then
_GUICtrlRichEdit_SetText($EditTailText, StringRight(_GUICtrlRichEdit_GetText($EditTailText, False, 1200), 524288))
EndIf
_GUICtrlRichEdit_ResumeRedraw($EditTailText)
_WinAPI_RedrawWindow($Form_znilTail)
EndFunc ;==>_TailFile
; #####################################################################################################################
;~ Func _Tail_Content($bSet = False, $sNew = "")
;~ Local Static $Tail = ""
;~ If $bSet Then $Tail = $sNew
;~ Return $Tail
;~ EndFunc
; #####################################################################################################################
Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
Local $aWndPos = WinGetPos($Form_znilTail)
Local $iWidth = _WinAPI_LoWord($lParam)
Local $iHeight = _WinAPI_HiWord($lParam)
If $iWidth < 991 Then
$iWidth = 995
WinMove($Form_znilTail, $sFormTitle, $aWndPos[0], $aWndPos[1], $iWidth, $iHeight)
Else
;nix zu tun
EndIf
If $iHeight < 300 Then
$iHeight = 350
WinMove($Form_znilTail, $sFormTitle, $aWndPos[0], $aWndPos[1], $iWidth, $iHeight)
EndIf
_WinAPI_MoveWindow($EditTailText, 0, 38, $iWidth - 2, $iHeight - 120)
GUICtrlSetPos($CheckboxHighlight, 5, $iHeight - 79)
GUICtrlSetPos($InputHighlightText, 24, $iHeight - 77, $iWidth - 29)
GUICtrlSetPos($CheckboxHideText, 5, $iHeight - 50)
GUICtrlSetPos($InputHidetext, 24, $iHeight - 48, $iWidth - 29)
GUICtrlSetPos($ButtonOpen, $iWidth - 85, 4, 81, 30)
GUICtrlSetPos($LabelCounter, $iWidth - 217, 4, 123, 30)
GUICtrlSetPos($ButtonHelp, $iWidth - 257, 4, 33, 30)
GUICtrlSetPos($LabelStatus, 0, $iHeight - 20, $iWidth - 1, 19)
Return 0
EndFunc ;==>WM_SIZE
; #FUNCTION# ====================================================================================================================
; Name...........: _StringReverse
; Description ...: Reverses the contents of the specified string.
; Syntax.........: _StringReverse($s_String)
; Parameters ....: $s_String - String to reverse
; Return values .: Success - Returns reversed string
; Failure - Returns an empty string and sets @error = 1
; |@Error - 0 = No error.
; |@Error - 1 = One of the parameters is invalid
; |@Error - 2 = Dll error
; Author ........: Jon
; Modified.......: SmOke_N (Re-written using msvcrt.dll for speed)
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _StringReverse($s_String)
Local $i_len = StringLen($s_String)
If $i_len < 1 Then Return SetError(1, 0, "")
Local $t_chars = DllStructCreate("char[" & $i_len + 1 & "]")
DllStructSetData($t_chars, 1, $s_String)
Local $a_rev = DllCall("msvcrt.dll", "ptr:cdecl", "_strrev", "struct*", $t_chars)
If @error Or $a_rev[0] = 0 Then Return SetError(2, 0, "")
Return DllStructGetData($t_chars, 1)
EndFunc ;==>_StringReverse
; #FUNCTION# ====================================================================================================================
; Name...........: _FileReadToArrayLocal
; Description ...: Reads the specified file into an array.
; Syntax.........: _FileReadToArrayLocal($sFilePath, ByRef $aArray)
; Parameters ....: $sFilePath - Path and filename of the file to be read.
; $aArray - The array to store the contents of the file.
; Return values .: Success - Returns a 1
; Failure - Returns a 0
; @Error - 0 = No error.
; |1 = Error opening specified file
; |2 = Unable to Split the file
; Author ........: Jonathan Bennett <jon at hiddensoft dot com>, Valik - Support Windows Unix and Mac line separator
; Modified.......: Jpm - fixed empty line at the end, Gary Fixed file contains only 1 line.
; Remarks .......: $aArray[0] will contain the number of records read into the array.
; Related .......: _FileWriteFromArray
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _FileReadToArrayLocal($sFilePath, ByRef $aArray)
Local $hFile = FileOpen($sFilePath, $FO_READ)
If $hFile = -1 Then Return SetError(1, 0, 0);; unable to open the file
;; Read the file and remove any trailing white spaces
Local $aFile = FileRead($hFile, FileGetSize($sFilePath))
;~ $aFile = StringStripWS($aFile, 2)
; remove last line separator if any at the end of the file
If StringRight($aFile, 1) = @LF Then $aFile = StringTrimRight($aFile, 1)
If StringRight($aFile, 1) = @CR Then $aFile = StringTrimRight($aFile, 1)
FileClose($hFile)
If StringInStr($aFile, @LF) Then
$aArray = StringSplit(StringStripCR($aFile), @LF)
ElseIf StringInStr($aFile, @CR) Then ;; @LF does not exist so split on the @CR
$aArray = StringSplit($aFile, @CR)
Else ;; unable to split the file
If StringLen($aFile) Then
Dim $aArray[2] = [1, $aFile]
Else
Return SetError(2, 0, 0)
EndIf
EndIf
Return 1
EndFunc ;==>_FileReadToArrayLocal
; ------------------------------------------------------------------------------------------
Func _CLOSEznilTail()
_WinAPI_SetFocus($hControl)
_ChatBoxDestroy($EditTailText)
AdlibUnRegister("_TailFile")
GUIDelete($Form_znilTail)
Sleep(250)
Exit 0
EndFunc
; ------------------------------------------------------------------------------------------
; --------------------------------------------------------------------------------------------------------
Func _ButtonOpen()
$sTailFileName = FileOpenDialog("Open File for Tail", @ScriptDir, "Textfiles (*.*)", 3, "", $Form_znilTail)
If $sTailFileName = "" Or @error = 1 Then
$sTailFileName = ""
$sFormTitle = "znilTail: No File selected"
Else
$sFormTitle = "znilTail: " & $sTailFileName
EndIf
_WinAPI_SetWindowText($Form_znilTail, $sFormTitle)
_WinAPI_SetFocus($hControl)
; nach dem Öffnen auch gleich loslegen!
$iTailPos = 0
_ButtonStart()
EndFunc
Func _ButtonStart()
If $sTailFileName <> "" Then
AdlibRegister("_TailFile", $iRefreshrate)
GUICtrlSetState($ButtonStart, $GUI_DISABLE)
GUICtrlSetState($ButtonStop, $GUI_ENABLE)
GUICtrlSetState($ButtonOpen, $GUI_DISABLE)
Else
MsgBox(262192,"znilTail: No file selected","You need to open a File first!",5)
EndIf
_WinAPI_SetFocus($hControl)
EndFunc
Func _ButtonStop()
AdlibUnRegister("_TailFile")
GUICtrlSetState($ButtonStart, $GUI_ENABLE)
GUICtrlSetState($ButtonOpen, $GUI_ENABLE)
GUICtrlSetState($ButtonStop, $GUI_DISABLE)
_WinAPI_SetFocus($hControl)
EndFunc
Func _ButtonFontMinus()
If $iFontsize > 6 Then
$iFontsize = $iFontsize - 1
_GUICtrlRichEdit_SetSel($EditTailText, 0, -1) ; go to begin of text
_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Lucida Console")
_GUICtrlRichEdit_SetSel($EditTailText, -1, -1) ; go to end of text
EndIf
_WinAPI_SetFocus($hControl)
EndFunc
Func _ButtonFontPlus()
$iFontsize = $iFontsize + 1
_GUICtrlRichEdit_SetSel($EditTailText, 0, -1) ; go to begin of text
_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Lucida Console")
_GUICtrlRichEdit_SetSel($EditTailText, -1, -1) ; go to end of text
_WinAPI_SetFocus($hControl)
EndFunc
Func _ButtonHelp()
;~ MsgBox(0,"","ButtonHelp!")
_znilTailAboutBox()
_WinAPI_SetFocus($hControl)
EndFunc
Func _ButtonDebugLevel3()
$iCurrentDebugLevel = 3
_WinAPI_SetFocus($hControl)
GUICtrlSetState($ButtonDebugLevel3, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel3, "Debug Level 3 is active")
GUICtrlSetState($ButtonDebugLevel4, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel4, "Restart Zabbix Agent with DebugLevel 4")
_SetDebugLevelandRestartAgent($iCurrentDebugLevel)
EndFunc
Func _ButtonDebugLevel4()
$iCurrentDebugLevel = 4
_WinAPI_SetFocus($hControl)
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel4, "Debug Level 4 is active")
GUICtrlSetState($ButtonDebugLevel3, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel3, "Restart Zabbix Agent with DebugLevel 3")
_SetDebugLevelandRestartAgent($iCurrentDebugLevel)
EndFunc
Func _ButtonRestartAgent()
_WinAPI_SetFocus($hControl)
;~ $i = Run(@ComSpec & ' /c net stop "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
;~ MsgBox(0,"",@ComSpec & ' /c net stop "' & $zabbixAgentName & '"')
GUICtrlSetData($LabelStatus, GUICtrlRead($LabelStatus) & " stopping zabbbix_agentd.exe ... ")
;~ SplashTextOn("Restart Zabbix Agent", "Zabbix Agent wird beendet ...", 400, 38, -1 ,-1, 0, "Lucida Console", 14)
$i = Run(@ComSpec & ' /c net stop "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
$iTimer = TimerInit()
While ProcessExists("zabbix_agentd.exe") > 0
Sleep(100)
If TimerDiff($iTimer) > 10000 Then
ExitLoop
EndIf
WEnd
;Sleep(2000)
;~ SplashOff()
;~ SplashTextOn("Restart Zabbix Agent", "Zabbix Agent wird gestartet ...", 400, 38, -1 ,-1, 0, "Lucida Console", 14)
$i = Run(@ComSpec & ' /c net start "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
;~ _TailFile()
GUICtrlSetData($LabelStatus, GUICtrlRead($LabelStatus) & " starting zabbbix_agentd.exe ... ")
Sleep(1000)
;~ SplashOff()
EndFunc
Func _GUI_HideShow()
_WinAPI_SetFocus($hControl)
GUISetState(@SW_HIDE,$Form_znilTail) ;Hide GUI
GUISetState(@SW_SHOW,$Form_znilTail) ;Show GUI
EndFunc
Func _CheckboxHighlight()
If GUICtrlRead($CheckboxHighlight) = $GUI_CHECKED Then
$bUseColorize = True
Else
$bUseColorize = False
EndIf
EndFunc
Func _CheckboxHideText()
If GUICtrlRead($CheckboxHideText) = $GUI_CHECKED Then
$bHideText = True
Else
$bHideText = False
EndIf
EndFunc
; --------------------------------------------------------------------------------------------------------
#Region ### START Koda GUI section ### Form=c:\_autoit\tail\zniltail-v2.kxf
$Form_znilTail = GUICreate("znilTail: zabbix_agentd.log", 991, 497, 488, 278, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))
GUISetBkColor(0x000000)
$EditTailText = GUICtrlCreateEdit("", 0, 38, 983, 377, BitOR($GUI_SS_DEFAULT_EDIT,$WS_CLIPSIBLINGS))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$ButtonOpen = GUICtrlCreateButton("Open File", 900, 4, 81, 30)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Open another Textfile for tailing")
$ButtonStart = GUICtrlCreateButton("START", 2, 4, 81, 30)
GUICtrlSetFont(-1, 12, 800, 0, "Lucida Console")
GUICtrlSetColor(-1, 0x008000)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "START tailing the file.")
$ButtonStop = GUICtrlCreateButton("STOP", 88, 4, 81, 30)
GUICtrlSetFont(-1, 12, 800, 0, "Lucida Console")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetTip(-1, "STOP tailing!")
$CheckboxHighlight = GUICtrlCreateCheckbox("", 5, 418, 17, 25)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$InputHighlightText = GUICtrlCreateInput("Highlight Lines with this Text", 24, 420, 958, 20)
GUICtrlSetFont(-1, 9, 800, 0, "Lucida Console")
GUICtrlSetBkColor(-1, 0xC0DCC0)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)
$ButtonFontPlus = GUICtrlCreateButton("+", 192, 4, 33, 30)
GUICtrlSetFont(-1, 20, 800, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "make Font bigger")
$ButtonFontMinus = GUICtrlCreateButton("-", 232, 4, 33, 30)
GUICtrlSetFont(-1, 20, 800, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "make Font smaler")
$CheckboxHideText = GUICtrlCreateCheckbox("", 5, 447, 17, 25)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$InputHidetext = GUICtrlCreateInput("Hide Lines with this Text", 24, 449, 958, 20)
GUICtrlSetFont(-1, 9, 800, 0, "Lucida Console")
GUICtrlSetColor(-1, 0xFFFF00)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)
$LabelCounter = GUICtrlCreateLabel("LabelCounter", 768, 4, 123, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_SUNKEN))
GUICtrlSetFont(-1, 10, 800, 0, "Lucida Console")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000080)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP)
GUICtrlSetTip(-1, "Number of Bytes that have been read since start.")
$ButtonHelp = GUICtrlCreateButton("?", 728, 4, 33, 30)
GUICtrlSetFont(-1, 18, 800, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "About Box with link to Homepage")
$ButtonDebugLevel3 = GUICtrlCreateButton("Restart Zabbix Agent with DebugLevel=3", 292, 4, 153, 30, $BS_MULTILINE)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Change the DebugLevel of Zabbix Agent to 3 (Warnings) and restart the Agent. If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights. If no Zabbix Agent was found this Button will not shown.")
$ButtonDebugLevel4 = GUICtrlCreateButton("Restart Zabbix Agent with DebugLevel=4", 452, 4, 153, 30, $BS_MULTILINE)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Change the DebugLevel of Zabbix Agent to 3 (Debugging) and restart the Agent. If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights. If no Zabbix Agent was found this Button will not shown.")
$ButtonRestartAgent = GUICtrlCreateButton("Restart Zabbix Agent", 610, 4, 113, 30, $BS_MULTILINE)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Just Restart the Zabbix Agent (without changing DebugLevel)")
$LabelStatus = GUICtrlCreateLabel("LabelStatus", 0, 477, 990, 19, $WS_BORDER)
GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console")
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
#Region ------ StartUp ------------------------------
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetOnEvent($GUI_EVENT_RESIZED, "_GUI_HideShow", $Form_znilTail)
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "_GUI_HideShow", $Form_znilTail)
GUISetOnEvent($GUI_EVENT_RESTORE, "_GUI_HideShow", $Form_znilTail)
GUISetOnEvent($GUI_EVENT_CLOSE, "_CLOSEznilTail", $Form_znilTail)
If GUICtrlSetOnEvent($ButtonOpen, "_ButtonOpen") = 0 Then MsgBox(0,"","Fehler _ButtonOpen")
If GUICtrlSetOnEvent($ButtonStart, "_ButtonStart") = 0 Then MsgBox(0,"","Fehler _ButtonStart")
If GUICtrlSetOnEvent($ButtonStop, "_ButtonStop") = 0 Then MsgBox(0,"","Fehler _ButtonStop")
If GUICtrlSetOnEvent($ButtonFontMinus, "_ButtonFontMinus") = 0 Then MsgBox(0,"","Fehler _ButtonFontMinus")
If GUICtrlSetOnEvent($ButtonFontPlus, "_ButtonFontPlus") = 0 Then MsgBox(0,"","Fehler _ButtonFontPlus")
If GUICtrlSetOnEvent($ButtonHelp, "_ButtonHelp") = 0 Then MsgBox(0,"","Fehler _ButtonHelp")
If GUICtrlSetOnEvent($ButtonDebugLevel3, "_ButtonDebugLevel3") = 0 Then MsgBox(0,"","Fehler _ButtonDebugLevel3")
If GUICtrlSetOnEvent($ButtonDebugLevel4, "_ButtonDebugLevel4") = 0 Then MsgBox(0,"","Fehler _ButtonDebugLevel4")
If GUICtrlSetOnEvent($ButtonRestartAgent, "_ButtonRestartAgent") = 0 Then MsgBox(0,"","Fehler _ButtonRestartAgent")
If GUICtrlSetOnEvent($CheckboxHighlight, "_CheckboxHighlight") = 0 Then MsgBox(0,"","Fehler _CheckbosHighlight")
If GUICtrlSetOnEvent($CheckboxHideText, "_CheckboxHideText") = 0 Then MsgBox(0,"","Fehler _CheckboxHideText")
GUICtrlSetData($LabelStatus,"")
GUICtrlDelete($EditTailText)
$EditTailText = _TailBoxCreate($Form_znilTail,"",0, 38, 983, 377,"0xFFFFFF", True, False, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_CLIPSIBLINGS))
_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Courier New")
_GUICtrlRichEdit_SetLimitOnText($EditTailText, $iRichEditTextLimit)
_WinAPI_SetWindowText($Form_znilTail, $sFormTitle)
GUICtrlSetData($LabelCounter, 0)
GUICtrlSetTip($ButtonDebugLevel3, "Change the DebugLevel of Zabbix Agent to 3 (Warnings) and restart the Agent." & @CRLF & _
"If this Button ist greyed out you need to start znilTail.exe with Adminisrator-Rights.")
GUICtrlSetTip($ButtonDebugLevel4, "Change the DebugLevel of Zabbix Agent to 3 (Debugging) and restart the Agent." & @CRLF & _
"If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights.")
;~ $data="[s]Hallo,[/s] [b][i]wie[/i] [u]gehts[/u]?[/b]"&@CRLF& _
;~ "[c=#00FF00]Grün"&@CRLF&"![/c]"&@CRLF& _
;~ "[c=#00FF00]Moinsen,[/c] schwarz"&@CRLF& _
;~ "[c=#FF0000]Moinsen,[/c] schwarz"&@CRLF
;~ _ChatBoxAdd($EditTailText,$data)
GUISetState(@SW_SHOW, $Form_znilTail)
$aWndPos = WinGetPos($Form_znilTail)
WinMove($Form_znilTail, $sFormTitle, (@DesktopWidth - $aWndPos[2]) / 2, (@DesktopHeight - $aWndPos[3]) / 2, $aWndPos[2], $aWndPos[3])
; Were we startet with Commandline Parameter? #########################################################################
If $CmdLine[0] > 0 Then
$sTailFileName = $CmdLine[1]
If FileExists($sTailFileName) = 0 Then
MsgBox(262144,"znilTail: File not found!","znilTail.exe was startet with a File as Commandline Parameter:" & @CRLF & _
@CRLF & $sTailFileName & @CRLF & @CRLF & "but the File did not exist!",10)
Else
;~ AdlibRegister("_TailFile", 250)
;~ GUICtrlSetState($ButtonStart, $GUI_DISABLE)
;~ GUICtrlSetState($ButtonStop, $GUI_ENABLE)
;~ GUICtrlSetState($ButtonOpen, $GUI_DISABLE)
;~ $sFormTitle = "znilTail: " & $sTailFileName
;~ _WinAPI_SetWindowText($Form_znilTail, $sFormTitle)
_ButtonStart()
EndIf
EndIf
; Is Zabbix the Zabbix Agent installed on this Computer? If yes: Name of Service and Path+Filename of his Config-File?
$sRegSubKey = RegRead($aRegistryBaseServicePaths[0] & "Control", "CurrentUser")
If $sRegSubKey = "" Then
$sRegSubKey = RegRead($aRegistryBaseServicePaths[1] & "Control", "CurrentUser")
If $sRegSubKey = "" Then
$sRegSubKey = RegRead($aRegistryBaseServicePaths[2] & "Control", "CurrentUser")
If $sRegSubKey = "" Then
$iRightRegistryPath = 99
Else
$iRightRegistryPath = 2
EndIf
Else
$iRightRegistryPath = 1
EndIf
Else
$iRightRegistryPath = 0
EndIf
$i = 0
$zabbixAgentName = ""
$zabbixAgentConfigFile = ""
While 1
$i = $i + 1
$sRegSubKey = RegEnumKey($aRegistryBaseServicePaths[$iRightRegistryPath] & "services", $i)
If @error <> 0 Then ExitLoop
If StringLeft($sRegSubKey,StringLen("Zabbix Agent")) = "Zabbix Agent" Then
$zabbixAgentName = RegRead($aRegistryBaseServicePaths[$iRightRegistryPath] & "services\" & $sRegSubKey, "DisplayName")
$zabbixAgentConfigFile = RegRead($aRegistryBaseServicePaths[$iRightRegistryPath] & "services\" & $sRegSubKey, "ImagePath")
;"C:\Program Files\Zabbix\zabbix_agentd.exe" --config "c:\Program Files\Zabbix\zabbix_agentd.win.conf" -m
$zabbixAgentConfigFile = StringRegExpReplace($zabbixAgentConfigFile, '.*(?i)--config "', "")
$zabbixAgentConfigFile = StringRegExpReplace($zabbixAgentConfigFile, '".*', "")
ExitLoop
EndIf
WEnd
If $zabbixAgentConfigFile <> "" And FileExists($zabbixAgentConfigFile) = 1 Then
$bShowZabbixAgentButtons = True
Else
$bShowZabbixAgentButtons = False
EndIf
If IsAdmin() = 1 Then
$bAdminrights = True
;MsgBox(0,"","Admin Rechte!")
Else
$bAdminrights = False
;MsgBox(0,"","Du darfst nichts")
EndIf
;MsgBox(0,"$zabbixAgentConfigFile",$zabbixAgentConfigFile)
If StringLen($zabbixAgentConfigFile) > 0 And $bAdminrights = False Then
GUICtrlSetState($ButtonDebugLevel3, $GUI_DISABLE)
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
EndIf
;~ If $bAdminrights = True Then
;~ MsgBox(0,"","Adminrechte!")
;~ Else
;~ MsgBox(0,"","Keine Rechte")
;~ EndIf
If StringLen($zabbixAgentConfigFile) > 0 Then
If IsAdmin() = 1 Then
$hzabbixAgentConfigFile = FileOpen($zabbixAgentConfigFile, 0)
While 1
$stemp = FileReadLine($hzabbixAgentConfigFile)
If @error = -1 Then ExitLoop
If StringInStr($stemp,"DebugLevel") > 0 And StringInStr($stemp,"#") = 0 Then
$iCurrentDebugLevel = Int(StringRegExpReplace($stemp,"[.\s]*[^0-9]", ""))
;MsgBox(0,"DebugLevel",$iCurrentDebugLevel)
ExitLoop
EndIf
WEnd
FileClose($hzabbixAgentConfigFile)
EndIf
EndIf
;MsgBox(0,"$iCurrentDebugLevel",$iCurrentDebugLevel)
If $iCurrentDebugLevel = 3 Then
GUICtrlSetState($ButtonDebugLevel3, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel3, "Debug Level 3 is active")
GUICtrlSetState($ButtonDebugLevel4, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel4, "Restart Zabbix Agent with DebugLevel 4")
ElseIf $iCurrentDebugLevel = 4 Then
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel4, "Debug Level 4 is active")
GUICtrlSetState($ButtonDebugLevel3, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel3, "Restart Zabbix Agent with DebugLevel 3")
ElseIf $iCurrentDebugLevel >= 0 And $iCurrentDebugLevel < 3 Then
GUICtrlSetState($ButtonDebugLevel3, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel3, "Restart Zabbix Agent with DebugLevel 3")
GUICtrlSetState($ButtonDebugLevel4, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel4, "Restart Zabbix Agent with DebugLevel 4")
EndIf
If $zabbixAgentConfigFile = "" Then
GUICtrlSetTip($ButtonDebugLevel3, "Unavailable - no Zabbix Agent Service found on this Computer." & @CRLF & _
"znilTail.exe has looked for Agent in the Registry but found nothing.")
GUICtrlSetData($ButtonDebugLevel3, "No installed Zabbix Agent found!")
GUICtrlSetTip($ButtonDebugLevel4, "Unavailable - no Zabbix Agent Service found on this Computer." & @CRLF & _
"znilTail.exe has looked for Agent in the Registry but found nothing.")
GUICtrlSetData($ButtonDebugLevel4, "No installed Zabbix Agent found!")
GUICtrlSetTip($ButtonRestartAgent, "Unavailable - no Zabbix Agent Service found on this Computer." & @CRLF & _
"znilTail.exe has looked for Agent in the Registry but found nothing.")
GUICtrlSetData($ButtonRestartAgent, "No Zabbix Agent found!")
GUICtrlSetState($ButtonDebugLevel3, $GUI_DISABLE)
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
GUICtrlSetState($ButtonRestartAgent, $GUI_DISABLE)
Else
$iCurrentDebugLevel = _GetDebugLevel()
If $iCurrentDebugLevel = 4 Then
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel4, "Debug Level 4 is active")
GUICtrlSetState($ButtonDebugLevel3, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel3, "Restart Zabbix Agent with DebugLevel 3")
EndIf
EndIf
$hControl = ControlGetHandle($Form_znilTail, '', ControlGetFocus($Form_znilTail))
#EndRegion --- StartUp ------------------------------
While 1
;~ Case $InputHighlightText
;~ If GUICtrlRead($InputHighlightText) = "Highlight Lines with this Text" Then
;~ GUICtrlSetData($InputHighlightText, "")
;~ GUICtrlSetData($CheckboxHighlight, $GUI_CHECKED)
;~ EndIf
Sleep(100)
If ControlGetHandle($Form_znilTail, '', $InputHighlightText) = ControlGetHandle($Form_znilTail, '', ControlGetFocus($Form_znilTail)) Then
If GUICtrlRead($InputHighlightText) = "Highlight Lines with this Text" Then
GUICtrlSetData($InputHighlightText, "")
GUICtrlSetState($CheckboxHighlight, $GUI_CHECKED)
$bUseColorize = True
EndIf
EndIf
If ControlGetHandle($Form_znilTail, '', $InputHidetext) = ControlGetHandle($Form_znilTail, '', ControlGetFocus($Form_znilTail)) Then
If GUICtrlRead($InputHidetext) = "Hide Lines with this Text" Then
GUICtrlSetData($InputHidetext, "")
GUICtrlSetState($CheckboxHideText, $GUI_CHECKED)
$bHideText = True
EndIf
EndIf
WEnd

770
znilTail.au3 Normal file
View File

@ -0,0 +1,770 @@
#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Icon=Icon256-32.ico
#AutoIt3Wrapper_Res_Description=Simple Tail Programm as an Zabbix Tool
#AutoIt3Wrapper_Res_Fileversion=1.0.1.12
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=2013 Bernhard Linz / Bernhard@znil.de
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt('MustDeclareVars', 1)
#Region ;************ Includes ************
#Include <Inet.au3>
#Include <ButtonConstants.au3>
#Include <StaticConstants.au3>
;~ #include <EditConstants.au3>;~~~
;~ #include <GUIConstantsEx.au3>;~~~
;~ #include <WindowsConstants.au3>;~~~
#include "_ChatBox.au3"
#EndRegion ;************ Includes ************
#Region ------ Dim Variables ------------------------------
Global $Form_znilTail
Global $EditTailText
Dim $ButtonStart
Dim $ButtonStop
Dim $ButtonOpen
Global $CheckboxHighlight
Global $CheckboxHideText
Global $InputHighlightText
Global $InputHidetext
Dim $ButtonFontMinus
Dim $ButtonFontPlus
Global $iFontsize = 9
Dim $nMsg
Dim $data
Global $bUseColorize = False
Global $bHideText = False
Global $TailFile = ""
Global $sFormTitle = "znilTail: No File selected"
Dim $aWndPos
Global $iTextLength = 0
Global $LabelCounter
Global $iRichEditTextLimit = 2147483647 ; 2GB - 1 Byte
Dim $ButtonHelp
Dim $i
Dim $zabbixAgentName
Dim $zabbixAgentConfigFile
Dim $hzabbixAgentConfigFile
Dim $iCurrentDebugLevel = 99
Dim $stemp
Dim $sRegSubKey
Global $bShowZabbixAgentButtons = False
Global $bAdminrights = False
Global $ButtonDebugLevel3
Global $ButtonDebugLevel4
Global $ButtonRestartAgent
Global $iTimer
Global $hControl
;Global $iRichEditTextLimit = 1048576
Dim $aRegistryBaseServicePaths[3] = ["HKLM\SYSTEM\CurrentControlSet\", _
"HKLM64\SYSTEM\CurrentControlSet\", _
"HKLM\SOFTWARE\Wow6432Node\SYSTEM\CurrentControlSet\"]
Dim $iRightRegistryPath
#EndRegion --- Dim Variables ------------------------------
Func _TailBoxCreate($gui,$txt,$x,$y,$w,$h,$bgc,$readonly,$autodetecturl, $style)
Local $ret;RichEdit
$ret=_GUICtrlRichEdit_Create($gui,"",$x,$y,$w,$h,$style)
_GUICtrlRichEdit_AutoDetectURL($ret,$autodetecturl)
;_GUICtrlRichEdit_SetLimitOnText($ret,-1)
_GUICtrlRichEdit_SetBkColor($ret,$bgc)
_GUICtrlRichEdit_SetReadOnly($ret,$readonly)
Return $ret
EndFunc
Func _znilTailAboutBox()
Local $AboutForm, $AboutGroupBoxFreeware, $AboutLabelFreeware1, $AboutLabelFreeware2,$AboutLabelFreeware3
Local $AboutButtonOK, $AboutLabelWeblink, $AboutGroupboxCommandline, $AboutLabelCommandline
Local $AboutLabelAuthor, $AboutLabelVersion, $AboutLabelContact, $nMsg2
Local $aWndPos
#Region ### START Koda GUI section ### Form=C:\_AutoIt\tail\znilTail-AboutBox.kxf
$AboutForm = GUICreate("About znilTail", 326, 244, 726, 446, BitOR($GUI_SS_DEFAULT_GUI,$DS_SETFOREGROUND), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
GUISetFont(8, 400, 0, "Courier New")
$AboutGroupBoxFreeware = GUICtrlCreateGroup("", 8, 8, 305, 81, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))
$AboutLabelFreeware1 = GUICtrlCreateLabel("This Tool is FREEWARE!", 9, 16, 302, 35, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 16, 800, 0, "Courier New")
$AboutLabelFreeware2 = GUICtrlCreateLabel("Copy it, give it away,", 9, 48, 302, 18, $SS_CENTER)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
$AboutLabelFreeware3 = GUICtrlCreateLabel("give it to others who need it!", 9, 64, 302, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AboutButtonOK = GUICtrlCreateButton("&OK", 238, 208, 75, 25, 0)
GUICtrlSetFont(-1, 12, 400, 0, "Courier New")
$AboutLabelWeblink = GUICtrlCreateLabel("http://znil.net", 9, 212, 222, 20)
GUICtrlSetFont(-1, 10, 400, 4, "Courier New")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
$AboutGroupboxCommandline = GUICtrlCreateGroup(" Commandline Call: ", 8, 160, 305, 41, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))
$AboutLabelCommandline = GUICtrlCreateLabel("znilTail.exe [Path+Filename-to-Tail]", 12, 176, 299, 18)
GUICtrlSetFont(-1, 10, 800, 0, "Courier New")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AboutLabelAuthor = GUICtrlCreateLabel("2013/2014 by Bernhard Linz", 8, 96, 305, 18)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
$AboutLabelVersion = GUICtrlCreateLabel("Version: ", 8, 116, 305, 18)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
$AboutLabelContact = GUICtrlCreateLabel("Contact: Bernhard@znil.de", 8, 136, 305, 18)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlSetData($AboutLabelVersion, "Version: " & FileGetVersion(@ScriptFullPath))
$aWndPos = WinGetPos($AboutForm)
WinMove($AboutForm, "About znilTail", (@DesktopWidth - $aWndPos[2]) / 2, (@DesktopHeight - $aWndPos[3]) / 2, $aWndPos[2], $aWndPos[3])
While 1
$nMsg2 = GUIGetMsg()
Switch $nMsg2
Case $GUI_EVENT_CLOSE, $AboutButtonOK
GUISetState(@SW_HIDE,$AboutForm)
GUIDelete($AboutForm)
Return
Case $AboutLabelContact
_INetMail("Bernhard@znil.de", "- znilTail.exe -", "")
Case $AboutLabelWeblink
ShellExecute ("http://znil.net")
EndSwitch
WEnd
EndFunc
; #####################################################################################################################
Func _SetDebugLevelandRestartAgent($idebuglevel)
Local $aLinesInFile
Local $i
Local $bFoundLine = False
Local $hConfigFile
Local $oShell
_FileReadToArray($zabbixAgentConfigFile, $aLinesInFile)
For $i = 1 To $aLinesInFile[0]
If StringInStr($aLinesInFile[$i],"DebugLevel") > 0 And StringInStr($aLinesInFile[$i],"#") = 0 Then
If $bFoundLine = False Then
$aLinesInFile[$i] = "DebugLevel=" & $idebuglevel
$bFoundLine = True
Else
;ok we found it more than one time, set the other ones to a comment
$aLinesInFile[$i] = "#" & $aLinesInFile[$i]
EndIf
EndIf
Next
$hConfigFile = FileOpen($zabbixAgentConfigFile, 2)
For $i = 1 To $aLinesInFile[0]
FileWriteLine($hConfigFile, $aLinesInFile[$i])
Next
If $bFoundLine = False Then
;ok, we did not found the value, so we add him as last Entry
FileWriteLine($hConfigFile, "DebugLevel=" & $idebuglevel)
EndIf
FileClose($hConfigFile)
; File is rewritten, so restart the servcie
$i = Run(@ComSpec & ' /c net stop "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
$iTimer = TimerInit()
While ProcessExists("zabbix_agentd.exe") > 0
Sleep(100)
If TimerDiff($iTimer) > 10000 Then
ExitLoop
EndIf
WEnd
;Sleep(2000)
$i = Run(@ComSpec & ' /c net start "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
EndFunc ; ==>_SetDebugLevelandRestartAgent
; #####################################################################################################################
Func _GetDebugLevel()
Local $aLinesInFile
Local $i
Local $bFoundLine = False
Local $hConfigFile
Local $oShell
Local $iReturnValue
_FileReadToArray($zabbixAgentConfigFile, $aLinesInFile)
For $i = 1 To $aLinesInFile[0]
If StringInStr($aLinesInFile[$i],"DebugLevel") > 0 And StringInStr($aLinesInFile[$i],"#") = 0 Then
If $bFoundLine = False Then
$iReturnValue = StringReplace($aLinesInFile[$i],"DebugLevel=","")
$iReturnValue = StringReplace($aLinesInFile[$i]," ","")
$bFoundLine = True
EndIf
EndIf
Next
If $bFoundLine = False Then
$iReturnValue = 3
EndIf
Return $iReturnValue
EndFunc ; ==>_SetDebugLevelandRestartAgent
; #####################################################################################################################
Func _TailFile()
Local Static $TailPos = 0
Local $nBytes = 1024
Local $TailNew = ""
Local $sFile
Local $atemp
Local $sSearchStringHighlight
Local $sSearchStringHide
Local $i
Local $WhoHasFocus = ControlGetHandle($Form_znilTail, '', ControlGetFocus($Form_znilTail))
_GUICtrlRichEdit_PauseRedraw($EditTailText)
If $sFile Then
$TailPos = 0
EndIf
Local $Handle = FileOpen($TailFile)
If $Handle = -1 Then Return
FileSetPos($Handle, 0, 2)
Local $Size = FileGetPos($Handle)
If $TailPos = 0 Then
If $Size > $nBytes Then
$TailPos = $Size - $nBytes
EndIf
ElseIf $Size < $TailPos Then
$TailPos = $Size
EndIf
If $Size > $TailPos Then
FileSetPos($Handle, $TailPos, 0)
$TailNew = FileRead($Handle)
$TailPos = FileGetPos($Handle)
EndIf
FileClose($Handle)
_WinAPI_SetFocus($WhoHasFocus)
If $TailNew Then
_Tail_Content(True, $TailNew)
;_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Courier New")
;GUICtrlSendToDummy($idDummy)
$iTextLength = $iTextLength + StringLen($TailNew)
If $bUseColorize = True Or $bHideText = True Then
$atemp = StringSplit($TailNew, @CRLF)
$sSearchStringHighlight = GUICtrlRead($InputHighlightText)
$sSearchStringHide = GUICtrlRead($InputHidetext)
;ConsoleWrite($sSearchString & @CRLF)
$TailNew = ""
_WinAPI_SetFocus($WhoHasFocus)
For $i = 1 To $atemp[0]
If $bHideText = True Then
If StringInStr($atemp[$i], $sSearchStringHide) > 1 Then
$atemp[$i] = ""
EndIf
_WinAPI_SetFocus($WhoHasFocus)
EndIf
If StringInStr($atemp[$i], $sSearchStringHighlight) > 1 Then
;$TailNew = $TailNew & "[b][c=#FF0000]" & $atemp[$i] & "[/b][/c]" & @CRLF
_ChatBoxAdd($EditTailText, "[b][c=#CC0000]" & $atemp[$i] & "[/b][/c]" & @CRLF)
;_GUICtrlRichEdit_SetSel($EditTailText, _GUICtrlRichEdit_GetTextLength($EditTailText) - StringLen($atemp[$i]), -1)
;_GUICtrlRichEdit_SetCharBkColor($EditTailText, 0x00FF00)
;_GUICtrlRichEdit_SetCharBkColor($EditTailText, 0xFFFFFF)
Else
If $atemp[$i] <> @CRLF And $atemp[$i] <> "" Then
_ChatBoxAdd($EditTailText, "[c=#666666]" & $atemp[$i] & "[/c]" & @CRLF)
EndIf
EndIf
_WinAPI_SetFocus($WhoHasFocus)
Next
Else
_ChatBoxAdd($EditTailText, $TailNew)
_WinAPI_SetFocus($WhoHasFocus)
EndIf
_GUICtrlRichEdit_SetSel($EditTailText, 0, -1) ; go to end of text
_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Courier New")
_GUICtrlRichEdit_SetSel($EditTailText, -1, -1) ; go to end of text
;ConsoleWrite(StringLen($TailNew) & @CRLF)
EndIf
_WinAPI_SetFocus($WhoHasFocus)
GUICtrlSetData($LabelCounter, StringRegExpReplace(_StringReverse(StringRegExpReplace(_StringReverse($iTextLength),"\d{3}","\0.")),"(?<![0-9])\.","",1))
_WinAPI_SetFocus($WhoHasFocus)
If _GUICtrlRichEdit_GetTextLength($EditTailText) > ($iRichEditTextLimit - 524288) Then
_GUICtrlRichEdit_SetText($EditTailText, StringRight(_GUICtrlRichEdit_GetText($EditTailText, False, 1200), 524288))
EndIf
_GUICtrlRichEdit_ResumeRedraw($EditTailText)
;_WinAPI_RedrawWindow($Form_znilTail)
EndFunc ;==>_TailFile
; #####################################################################################################################
Func _Tail_Content($bSet = False, $sNew = "")
Local Static $Tail = ""
If $bSet Then $Tail = $sNew
Return $Tail
EndFunc
; #####################################################################################################################
Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
Local $aWndPos = WinGetPos($Form_znilTail)
Local $iWidth = _WinAPI_LoWord($lParam)
Local $iHeight = _WinAPI_HiWord($lParam)
If $iWidth < 500 Then
$iWidth = 500
WinMove($Form_znilTail, $sFormTitle, $aWndPos[0], $aWndPos[1], $iWidth, $iHeight)
Else
EndIf
If $iHeight < 300 Then
$iHeight = 300
WinMove($Form_znilTail, $sFormTitle, $aWndPos[0], $aWndPos[1], $iWidth, $iHeight)
EndIf
_WinAPI_MoveWindow($EditTailText, 0, 38, $iWidth - 2, $iHeight - 102)
GUICtrlSetPos($CheckboxHighlight, 5, $iHeight - 61)
GUICtrlSetPos($InputHighlightText, 24, $iHeight - 59, $iWidth - 29)
GUICtrlSetPos($CheckboxHideText, 5, $iHeight - 32)
GUICtrlSetPos($InputHidetext, 24, $iHeight - 30, $iWidth - 29)
GUICtrlSetPos($ButtonOpen, $iWidth - 85, 4, 81, 30)
GUICtrlSetPos($LabelCounter, $iWidth - 217, 4, 123, 30)
GUICtrlSetPos($ButtonHelp, $iWidth - 257, 4, 33, 30)
Return 0
EndFunc ;==>WM_SIZE
; #FUNCTION# ====================================================================================================================
; Name...........: _StringReverse
; Description ...: Reverses the contents of the specified string.
; Syntax.........: _StringReverse($s_String)
; Parameters ....: $s_String - String to reverse
; Return values .: Success - Returns reversed string
; Failure - Returns an empty string and sets @error = 1
; |@Error - 0 = No error.
; |@Error - 1 = One of the parameters is invalid
; |@Error - 2 = Dll error
; Author ........: Jon
; Modified.......: SmOke_N (Re-written using msvcrt.dll for speed)
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _StringReverse($s_String)
Local $i_len = StringLen($s_String)
If $i_len < 1 Then Return SetError(1, 0, "")
Local $t_chars = DllStructCreate("char[" & $i_len + 1 & "]")
DllStructSetData($t_chars, 1, $s_String)
Local $a_rev = DllCall("msvcrt.dll", "ptr:cdecl", "_strrev", "struct*", $t_chars)
If @error Or $a_rev[0] = 0 Then Return SetError(2, 0, "")
Return DllStructGetData($t_chars, 1)
EndFunc ;==>_StringReverse
; #FUNCTION# ====================================================================================================================
; Name...........: _FileReadToArray
; Description ...: Reads the specified file into an array.
; Syntax.........: _FileReadToArray($sFilePath, ByRef $aArray)
; Parameters ....: $sFilePath - Path and filename of the file to be read.
; $aArray - The array to store the contents of the file.
; Return values .: Success - Returns a 1
; Failure - Returns a 0
; @Error - 0 = No error.
; |1 = Error opening specified file
; |2 = Unable to Split the file
; Author ........: Jonathan Bennett <jon at hiddensoft dot com>, Valik - Support Windows Unix and Mac line separator
; Modified.......: Jpm - fixed empty line at the end, Gary Fixed file contains only 1 line.
; Remarks .......: $aArray[0] will contain the number of records read into the array.
; Related .......: _FileWriteFromArray
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _FileReadToArray($sFilePath, ByRef $aArray)
Local $hFile = FileOpen($sFilePath, $FO_READ)
If $hFile = -1 Then Return SetError(1, 0, 0);; unable to open the file
;; Read the file and remove any trailing white spaces
Local $aFile = FileRead($hFile, FileGetSize($sFilePath))
;~ $aFile = StringStripWS($aFile, 2)
; remove last line separator if any at the end of the file
If StringRight($aFile, 1) = @LF Then $aFile = StringTrimRight($aFile, 1)
If StringRight($aFile, 1) = @CR Then $aFile = StringTrimRight($aFile, 1)
FileClose($hFile)
If StringInStr($aFile, @LF) Then
$aArray = StringSplit(StringStripCR($aFile), @LF)
ElseIf StringInStr($aFile, @CR) Then ;; @LF does not exist so split on the @CR
$aArray = StringSplit($aFile, @CR)
Else ;; unable to split the file
If StringLen($aFile) Then
Dim $aArray[2] = [1, $aFile]
Else
Return SetError(2, 0, 0)
EndIf
EndIf
Return 1
EndFunc ;==>_FileReadToArray
#Region ### START Koda GUI section ### Form=C:\_AutoIt\tail\znilTAIL.kxf
$Form_znilTail = GUICreate("znilTail: zabbix_agentd.log", 989, 483, 488, 278, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))
GUISetBkColor(0x000000)
$EditTailText = GUICtrlCreateEdit("", 0, 38, 983, 377, BitOR($GUI_SS_DEFAULT_EDIT,$WS_CLIPSIBLINGS))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$ButtonOpen = GUICtrlCreateButton("Open File", 900, 4, 81, 30)
GUICtrlSetFont(-1, 8, 400, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Open another Textfile for tailing")
$ButtonStart = GUICtrlCreateButton("START", 2, 4, 81, 30)
GUICtrlSetFont(-1, 12, 800, 0, "Courier New")
GUICtrlSetColor(-1, 0x008000)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "START tailing the file.")
$ButtonStop = GUICtrlCreateButton("STOP", 88, 4, 81, 30)
GUICtrlSetFont(-1, 12, 800, 0, "Courier New")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetTip(-1, "STOP tailing!")
$CheckboxHighlight = GUICtrlCreateCheckbox("", 5, 418, 17, 25)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$InputHighlightText = GUICtrlCreateInput("Highlight Lines with this Text", 24, 420, 958, 24)
GUICtrlSetFont(-1, 9, 800, 0, "Courier New")
GUICtrlSetBkColor(-1, 0xC0DCC0)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)
$ButtonFontPlus = GUICtrlCreateButton("+", 192, 4, 33, 30)
GUICtrlSetFont(-1, 20, 800, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "make Font bigger")
$ButtonFontMinus = GUICtrlCreateButton("-", 232, 4, 33, 30)
GUICtrlSetFont(-1, 20, 800, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "make Font smaler")
$CheckboxHideText = GUICtrlCreateCheckbox("", 5, 447, 17, 25)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$InputHidetext = GUICtrlCreateInput("Hide Lines with this Text", 24, 449, 958, 24)
GUICtrlSetFont(-1, 9, 800, 0, "Courier New")
GUICtrlSetColor(-1, 0xFFFF00)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)
$LabelCounter = GUICtrlCreateLabel("LabelCounter", 768, 4, 123, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_SUNKEN))
GUICtrlSetFont(-1, 10, 800, 0, "Courier New")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000080)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP)
GUICtrlSetTip(-1, "Number of Bytes that have been read since start.")
$ButtonHelp = GUICtrlCreateButton("?", 728, 4, 33, 30)
GUICtrlSetFont(-1, 20, 800, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "About Box with link to Homepage")
$ButtonDebugLevel3 = GUICtrlCreateButton("Restart Zabbix Agent with DebugLevel=3", 292, 4, 153, 30, $BS_MULTILINE)
GUICtrlSetFont(-1, 8, 400, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Change the DebugLevel of Zabbix Agent to 3 (Warnings) and restart the Agent. If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights. If no Zabbix Agent was found this Button will not shown.")
$ButtonDebugLevel4 = GUICtrlCreateButton("Restart Zabbix Agent with DebugLevel=4", 452, 4, 153, 30, $BS_MULTILINE)
GUICtrlSetFont(-1, 8, 400, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Change the DebugLevel of Zabbix Agent to 3 (Debugging) and restart the Agent. If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights. If no Zabbix Agent was found this Button will not shown.")
$ButtonRestartAgent = GUICtrlCreateButton("Restart Zabbix Agent", 610, 4, 113, 30, $BS_MULTILINE)
GUICtrlSetFont(-1, 8, 400, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Just Restart the Zabbix Agent (without changing DebugLevel)")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
#Region ------ StartUp ------------------------------
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUICtrlDelete($EditTailText)
$EditTailText = _TailBoxCreate($Form_znilTail,"",0, 38, 983, 377,"0xFFFFFF", True, False, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_CLIPSIBLINGS))
_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Courier New")
_GUICtrlRichEdit_SetLimitOnText($EditTailText, $iRichEditTextLimit)
_WinAPI_SetWindowText($Form_znilTail, $sFormTitle)
GUICtrlSetData($LabelCounter, 0)
GUICtrlSetTip($ButtonDebugLevel3, "Change the DebugLevel of Zabbix Agent to 3 (Warnings) and restart the Agent." & @CRLF & _
"If this Button ist greyed out you need to start znilTail.exe with Adminisrator-Rights.")
GUICtrlSetTip($ButtonDebugLevel4, "Change the DebugLevel of Zabbix Agent to 3 (Debugging) and restart the Agent." & @CRLF & _
"If this Button ist greyed Out you need to start znilTail.exe with Adminisrator-Rights.")
;~ $data="[s]Hallo,[/s] [b][i]wie[/i] [u]gehts[/u]?[/b]"&@CRLF& _
;~ "[c=#00FF00]Grün"&@CRLF&"![/c]"&@CRLF& _
;~ "[c=#00FF00]Moinsen,[/c] schwarz"&@CRLF& _
;~ "[c=#FF0000]Moinsen,[/c] schwarz"&@CRLF
;~ _ChatBoxAdd($EditTailText,$data)
$aWndPos = WinGetPos($Form_znilTail)
WinMove($Form_znilTail, $sFormTitle, (@DesktopWidth - $aWndPos[2]) / 2, (@DesktopHeight - $aWndPos[3]) / 2, $aWndPos[2], $aWndPos[3])
; Were we startet with Commandline Parameter? #########################################################################
If $CmdLine[0] > 0 Then
$TailFile = $CmdLine[1]
If FileExists($TailFile) = 0 Then
MsgBox(262144,"znilTail: File not found!","znilTail.exe was startet with a File as Commandline Parameter:" & @CRLF & _
@CRLF & $TailFile & @CRLF & @CRLF & "but the File did not exist!",10)
Else
AdlibRegister("_TailFile", 1200)
GUICtrlSetState($ButtonStart, $GUI_DISABLE)
GUICtrlSetState($ButtonStop, $GUI_ENABLE)
GUICtrlSetState($ButtonOpen, $GUI_DISABLE)
$sFormTitle = "znilTail: " & $TailFile
_WinAPI_SetWindowText($Form_znilTail, $sFormTitle)
EndIf
EndIf
; Is Zabbix the Zabbix Agent installed on this Computer? If yes: Name of Service and Path+Filename of his Config-File?
$sRegSubKey = RegRead($aRegistryBaseServicePaths[0] & "Control", "CurrentUser")
If $sRegSubKey = "" Then
$sRegSubKey = RegRead($aRegistryBaseServicePaths[1] & "Control", "CurrentUser")
If $sRegSubKey = "" Then
$sRegSubKey = RegRead($aRegistryBaseServicePaths[2] & "Control", "CurrentUser")
If $sRegSubKey = "" Then
$iRightRegistryPath = 99
Else
$iRightRegistryPath = 2
EndIf
Else
$iRightRegistryPath = 1
EndIf
Else
$iRightRegistryPath = 0
EndIf
$i = 0
$zabbixAgentName = ""
$zabbixAgentConfigFile = ""
While 1
$i = $i + 1
$sRegSubKey = RegEnumKey($aRegistryBaseServicePaths[$iRightRegistryPath] & "services", $i)
If @error <> 0 Then ExitLoop
If StringLeft($sRegSubKey,StringLen("Zabbix Agent")) = "Zabbix Agent" Then
$zabbixAgentName = RegRead($aRegistryBaseServicePaths[$iRightRegistryPath] & "services\" & $sRegSubKey, "DisplayName")
$zabbixAgentConfigFile = RegRead($aRegistryBaseServicePaths[$iRightRegistryPath] & "services\" & $sRegSubKey, "ImagePath")
;"C:\Program Files\Zabbix\zabbix_agentd.exe" --config "c:\Program Files\Zabbix\zabbix_agentd.win.conf" -m
$zabbixAgentConfigFile = StringRegExpReplace($zabbixAgentConfigFile, '.*(?i)--config "', "")
$zabbixAgentConfigFile = StringRegExpReplace($zabbixAgentConfigFile, '".*', "")
ExitLoop
EndIf
WEnd
If $zabbixAgentConfigFile <> "" And FileExists($zabbixAgentConfigFile) = 1 Then
$bShowZabbixAgentButtons = True
Else
$bShowZabbixAgentButtons = False
EndIf
If IsAdmin() = 1 Then
$bAdminrights = True
;MsgBox(0,"","Admin Rechte!")
Else
$bAdminrights = False
;MsgBox(0,"","Du darfst nichts")
EndIf
;MsgBox(0,"$zabbixAgentConfigFile",$zabbixAgentConfigFile)
If StringLen($zabbixAgentConfigFile) > 0 And $bAdminrights = False Then
GUICtrlSetState($ButtonDebugLevel3, $GUI_DISABLE)
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
EndIf
;~ If $bAdminrights = True Then
;~ MsgBox(0,"","Adminrechte!")
;~ Else
;~ MsgBox(0,"","Keine Rechte")
;~ EndIf
If StringLen($zabbixAgentConfigFile) > 0 Then
If IsAdmin() = 1 Then
$hzabbixAgentConfigFile = FileOpen($zabbixAgentConfigFile, 0)
While 1
$stemp = FileReadLine($hzabbixAgentConfigFile)
If @error = -1 Then ExitLoop
If StringInStr($stemp,"DebugLevel") > 0 And StringInStr($stemp,"#") = 0 Then
$iCurrentDebugLevel = Int(StringRegExpReplace($stemp,"[.\s]*[^0-9]", ""))
;MsgBox(0,"DebugLevel",$iCurrentDebugLevel)
ExitLoop
EndIf
WEnd
FileClose($hzabbixAgentConfigFile)
EndIf
EndIf
;MsgBox(0,"$iCurrentDebugLevel",$iCurrentDebugLevel)
If $iCurrentDebugLevel = 3 Then
GUICtrlSetState($ButtonDebugLevel3, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel3, "Debug Level 3 is active")
GUICtrlSetState($ButtonDebugLevel4, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel4, "Restart Zabbix Agent with DebugLevel 4")
ElseIf $iCurrentDebugLevel = 4 Then
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel4, "Debug Level 4 is active")
GUICtrlSetState($ButtonDebugLevel3, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel3, "Restart Zabbix Agent with DebugLevel 3")
ElseIf $iCurrentDebugLevel >= 0 And $iCurrentDebugLevel < 3 Then
GUICtrlSetState($ButtonDebugLevel3, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel3, "Restart Zabbix Agent with DebugLevel 3")
GUICtrlSetState($ButtonDebugLevel4, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel4, "Restart Zabbix Agent with DebugLevel 4")
EndIf
If $zabbixAgentConfigFile = "" Then
GUICtrlSetTip($ButtonDebugLevel3, "Unavailable - no Zabbix Agent Service found on this Computer." & @CRLF & _
"znilTail.exe has looked for Agent in the Registry but found nothing.")
GUICtrlSetData($ButtonDebugLevel3, "No installed Zabbix Agent found!")
GUICtrlSetTip($ButtonDebugLevel4, "Unavailable - no Zabbix Agent Service found on this Computer." & @CRLF & _
"znilTail.exe has looked for Agent in the Registry but found nothing.")
GUICtrlSetData($ButtonDebugLevel4, "No installed Zabbix Agent found!")
GUICtrlSetTip($ButtonRestartAgent, "Unavailable - no Zabbix Agent Service found on this Computer." & @CRLF & _
"znilTail.exe has looked for Agent in the Registry but found nothing.")
GUICtrlSetData($ButtonRestartAgent, "No Zabbix Agent found!")
GUICtrlSetState($ButtonDebugLevel3, $GUI_DISABLE)
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
GUICtrlSetState($ButtonRestartAgent, $GUI_DISABLE)
Else
$iCurrentDebugLevel = _GetDebugLevel()
If $iCurrentDebugLevel = 4 Then
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel4, "Debug Level 4 is active")
GUICtrlSetState($ButtonDebugLevel3, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel3, "Restart Zabbix Agent with DebugLevel 3")
EndIf
EndIf
$hControl = ControlGetHandle($Form_znilTail, '', ControlGetFocus($Form_znilTail))
#EndRegion --- StartUp ------------------------------
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_WinAPI_SetFocus($hControl)
_ChatBoxDestroy($EditTailText)
AdlibUnRegister("_TailFile")
GUIDelete($Form_znilTail)
Sleep(250)
Exit 0
Case $ButtonOpen
$TailFile = FileOpenDialog("Open File for Tail", @ScriptDir, "Textfiles (*.*)", 3, "", $Form_znilTail)
If $TailFile = "" Or @error = 1 Then
$TailFile = ""
$sFormTitle = "znilTail: No File selected"
Else
$sFormTitle = "znilTail: " & $TailFile
EndIf
_WinAPI_SetWindowText($Form_znilTail, $sFormTitle)
_WinAPI_SetFocus($hControl)
Case $ButtonStart
If $TailFile <> "" Then
AdlibRegister("_TailFile", 1200)
GUICtrlSetState($ButtonStart, $GUI_DISABLE)
GUICtrlSetState($ButtonStop, $GUI_ENABLE)
GUICtrlSetState($ButtonOpen, $GUI_DISABLE)
Else
MsgBox(262192,"znilTail: No file selected","You need to open a File first!",5)
EndIf
_WinAPI_SetFocus($hControl)
Case $ButtonStop
AdlibUnRegister("_TailFile")
GUICtrlSetState($ButtonStart, $GUI_ENABLE)
GUICtrlSetState($ButtonOpen, $GUI_ENABLE)
GUICtrlSetState($ButtonStop, $GUI_DISABLE)
_WinAPI_SetFocus($hControl)
Case $ButtonFontMinus
;_GUICtrlRichEdit_ChangeFontSize($EditTailText, -1)
If $iFontsize > 6 Then
$iFontsize = $iFontsize - 1
_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Courier New")
EndIf
_WinAPI_SetFocus($hControl)
Case $ButtonFontPlus
;_GUICtrlRichEdit_ChangeFontSize($EditTailText, 1)
$iFontsize = $iFontsize + 1
_GUICtrlRichEdit_SetFont($EditTailText, $iFontsize, "Courier New")
_WinAPI_SetFocus($hControl)
Case $ButtonHelp
_znilTailAboutBox()
_WinAPI_SetFocus($hControl)
Case $ButtonDebugLevel3
$iCurrentDebugLevel = 3
_WinAPI_SetFocus($hControl)
GUICtrlSetState($ButtonDebugLevel3, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel3, "Debug Level 3 is active")
GUICtrlSetState($ButtonDebugLevel4, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel4, "Restart Zabbix Agent with DebugLevel 4")
_SetDebugLevelandRestartAgent($iCurrentDebugLevel)
Case $ButtonDebugLevel4
$iCurrentDebugLevel = 4
_WinAPI_SetFocus($hControl)
GUICtrlSetState($ButtonDebugLevel4, $GUI_DISABLE)
GUICtrlSetData($ButtonDebugLevel4, "Debug Level 4 is active")
GUICtrlSetState($ButtonDebugLevel3, $GUI_ENABLE)
GUICtrlSetData($ButtonDebugLevel3, "Restart Zabbix Agent with DebugLevel 3")
_SetDebugLevelandRestartAgent($iCurrentDebugLevel)
Case $ButtonRestartAgent
_WinAPI_SetFocus($hControl)
$i = Run(@ComSpec & ' /c net stop "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
$iTimer = TimerInit()
While ProcessExists("zabbix_agentd.exe") > 0
Sleep(100)
If TimerDiff($iTimer) > 10000 Then
ExitLoop
EndIf
WEnd
;Sleep(2000)
$i = Run(@ComSpec & ' /c net start "' & $zabbixAgentName & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
Case $GUI_EVENT_RESIZED
_WinAPI_SetFocus($hControl)
GUISetState(@SW_HIDE,$Form_znilTail) ;Hide GUI
GUISetState(@SW_SHOW,$Form_znilTail) ;Show GUI
Case $GUI_EVENT_MAXIMIZE
_WinAPI_SetFocus($hControl)
GUISetState(@SW_HIDE,$Form_znilTail) ;Hide GUI
GUISetState(@SW_SHOW,$Form_znilTail) ;Show GUI
Case $GUI_EVENT_RESTORE
_WinAPI_SetFocus($hControl)
GUISetState(@SW_HIDE,$Form_znilTail) ;Hide GUI
GUISetState(@SW_SHOW,$Form_znilTail) ;Show GUI
;~ Case -7
;~ GUISetState(@SW_HIDE,$Form_znilTail) ;Hide GUI
;~ GUISetState(@SW_SHOW,$Form_znilTail) ;Show GUI
;~ Case $InputHighlightText
;~ If GUICtrlRead($InputHighlightText) = "Highlight Lines with this Text" Then
;~ GUICtrlSetData($InputHighlightText, "")
;~ GUICtrlSetData($CheckboxHighlight, $GUI_CHECKED)
;~ EndIf
EndSwitch
If ControlGetHandle($Form_znilTail, '', $InputHighlightText) = ControlGetHandle($Form_znilTail, '', ControlGetFocus($Form_znilTail)) Then
If GUICtrlRead($InputHighlightText) = "Highlight Lines with this Text" Then
GUICtrlSetData($InputHighlightText, "")
GUICtrlSetState($CheckboxHighlight, $GUI_CHECKED)
EndIf
EndIf
If ControlGetHandle($Form_znilTail, '', $InputHidetext) = ControlGetHandle($Form_znilTail, '', ControlGetFocus($Form_znilTail)) Then
If GUICtrlRead($InputHidetext) = "Hide Lines with this Text" Then
GUICtrlSetData($InputHidetext, "")
GUICtrlSetState($CheckboxHideText, $GUI_CHECKED)
EndIf
EndIf
If GUICtrlRead($CheckboxHighlight) = $GUI_CHECKED Then
$bUseColorize = True
Else
$bUseColorize = False
EndIf
If GUICtrlRead($CheckboxHideText) = $GUI_CHECKED Then
$bHideText = True
Else
$bHideText = False
EndIf
WEnd

BIN
znilTail.exe Normal file

Binary file not shown.

BIN
znilTail.zip Normal file

Binary file not shown.