If Ubound($CmdLine) < 2 Then ConsoleWrite("This program checks and waits for a given File to be opened for appending (write access check). Please provide a valid full path to an existing file as first and only parameter"&@CRLF) exit(1) EndIf If FileExists($CmdLine[1]) Then ;just go on Else ConsoleWrite("The file "&$CmdLine[1]&" doesn not exist. Please provide a valid full path to an existing file as first and only parameter"&@CRLF) exit(1) EndIf While (1) ConsoleWrite("Trying to open"&$CmdLine[1]&@CRLF) Local $hFileOpen = FileOpen ( $CmdLine[1] ,1) ;open for appending If $hFileOpen = -1 Then ConsoleWrite("File not yet ready"&@CRLF) sleep(5000) ContinueLoop EndIf FileClose($hFileOpen); ExitLoop WEnd ConsoleWrite($CmdLine[1] & " could successfully be opened for appending"&@CRLF)