Quick AutoIT 3 parsing Engine
- Corey Schafer
- Oct 11, 2019
- 1 min read
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Author: Corey Schafer
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
MsgBox(0,"Starting to parse", "Starting to parse")
$file1 = FileOpen("C:\PreDev Refresh 032919\scriptletterdp thru z.sql", 0);0 = Read mode
$file2 = FileOpen("C:\PreDev Refresh 032919\Triggers P thru Z.sql", 2)
$foundString = 0
$Counter = 0
; Check if file opened for reading OK
If $file1 = -1 Then
MsgBox(0, "Error", "Unable to open input file.")
Exit
EndIf
If $file2 = -1 Then
MsgBox(0, "Error", "Unable to open output file.")
Exit
EndIf
;SplashTextOn("Status", "Parsing", -1, -1, -1, -1, "", "", 5)
; Read in lines of text until the EOF is reached
While 1
$Counter = $Counter + 1
$line = FileReadLine($file1)
$message = "Parsing Line " & $Counter
; SplashTextOn("Status", $message, -1, -1, -1, -1, "", "", 5)
; ControlSetText("Status", "", "Static1", $message)
;If @error = -1 Then
; ExitLoop
; endif
if $FoundString = 1 Then
FileWriteLine ( $file2, $line )
Else
If StringInStr ($line, "Trigger") Then
$foundstring = 1
;FileWriteLine ( $file2, $line )
$message = "Parsing Text Found " & $Counter
MsgBox(0,"Found File Write Trigger",$message)
EndIf
EndIf
Wend
FileClose($file1)
FileClose($file2)
;SplashOff();
MsgBox(0,"Parsing Complete","Parsing of File Complete")
Comments