Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Find Text from ReadFile

$
0
0
Hi, everybody. I am new to this so bear with me. As part of my sysadmin responsibilities, I monitor several logs. I decided to try my hand at making a script that would combine them into one window for viewing and be able to use some tools within the same interface. So far, I am trying this with just one log. I want to be able to read the log, search within the log for certain strings of text, and be able to launch a network tool called Fing. I have all of this working except for the find function. I open the file, then read the file within a text box that is generated by Koda form generator. I want to be able to search within the text of that file. Any help is appreciated. I will post the code below.

Edit** Forgot to paste the #include portion.


[ autoit ]         
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> Local $file = FileOpen("z:\logs\server.log", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $text = FileRead($file) #Region ### START Koda GUI section ### Form=c:\program files\autoit3\scripts\form.kxf $Form1_1 = GUICreate("Server Log", 615, 438, 192, 124) $Fing = GUICtrlCreateButton("Fing", 440, 24, 113, 57, $BS_ICON) $Find = GUICtrlCreateButton("Find", 440, 112, 113,57) $hEdit= GUICtrlCreateEdit($text, 64, 24, 505, 233, _ BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL, $ES_NOHIDESEL)) GUICtrlSetImage(-1, "C:\Users\User1\Downloads\overlook-fing-2.1.exe", -1) $Edit1 = GUICtrlCreateEdit("", 32, 0, 393, 417) GUICtrlSetData(-1, $text) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### MouseMove (232, 156) MouseClick ("left", 232, 156) Send ("{CTRLDOWN}" & "{END}") sleep (15) Send ("{CTRLUP}") While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg=$Fing Run(@ComSpec & " /c " & "C:\fing.lnk") Case $nMsg=$Find _GUICtrlEdit_Find($hEdit) EndSelect WEnd FileClose($file)

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>