All,
Below is the code that I have written in AutoIT.
$fileToWrite = FileOpen("C:\output.txt", 1)
If FileExists("C:\test.csv") Then
$fileHandle= FileOpen("test.csv", 0)
If ($fileHandle = -1) Then
MsgBox (0, "Error", "Error occured while reading the file")
Exit
Else
While 1
$currentLine = FileReadLine($fileHandle)
If @error = -1 Then ExitLoop
$days = StringSplit($currentLine, ",")
FileWrite($fileToWrite,$days[2] & ", " & $days[9] & @CRLF)
EndIf
Wend
EndIf
Else
MsgBox (0, "Error", "Input file does not exist")
EndIf
FileClose($fileToWrite)
FileClose($fileHandle)
And the set of error:
C:\ReadCSV.au3(14,4) : ERROR: missing Wend.
EndIf
^
C:\ReadCSV.au3(9,3) : REF: missing Wend.
While
^
C:\ReadCSV.au3(15,3) : ERROR: missing EndIf.
Wend
^
C:\ReadCSV.au3(3,34) : REF: missing EndIf.
If FileExists("C:\test.csv") Then
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\ReadCSV.au3(15,3) : ERROR: syntax error
Wend
^
C:\ReadCSV.au3 - 3 error(s), 0 warning(s)
>Exit code: 0 Time: 3.601
I am not able to understand the issue here since I do have a Wend and EndIf for every While loop and an If condition. Am I missing something here?