znilTail/znilTail-V2.au3

907 lines
38 KiB
AutoIt
Raw Permalink Normal View History

2018-10-08 14:51:26 +02:00
#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