[ autoit ]
$path = @ScriptDir & "\default.txt" Case $Button1 $fod = FileOpenDialog("Select File", @ScriptDir, "Default Files(*.txt;*.cfg;*.dat;*.ini)|Text Files(*.txt)|Configuration Files(*.cfg)|Data Files(*.dat)|Windows Initialization Files(*.ini)|All Files(*.*)") If @error Then MsgBox(0, "Commander", "No file selected") Else $fo3 = FileOpen($path) If $fo3 = -1 Then FileWrite($path, $fod & @CRLF) $line2 = _FileCountLines($path) For $i2 = 1 To $line2 $rd2 = FileReadLine($fo3, $i2) If $rd2 == $fod Then MsgBox(0, "Commander", "This file exists") Else FileWriteLine($path, $fod) GUICtrlSetData($List1, $fod) EndIf If $i2 == $line2 Then ExitLoop Next EndIf
i need to write the path of the selected files only if the path doesent exist
right now its writeing the same line 2 times and gives File exists error 2 times