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

FileOpen detect already opened file

$
0
0
Hi Folks,


I have a small GUI application that writes to a text file. This is basically the part of the script:
[ autoit ]      
$fh = FileOpen("Test.txt", 9) ;Append at the end of the File and create the dir structure if it doesn't exist FilewriteLine($fh, "Bli bla blubb...") ;Write 1 - many lines to the file FileClose($fh)

So ... sometimes while that application is running, there is another file that does something like this:
[ autoit ]      
$fh = FileOpen("Test.txt", 2) ;Open file, erase the contents FileClose($fh)

Okay, so basically that is bad, because it results in the first script writing several "NULL"s to the file, so if I try to read that file with another script and _FileReadToArray() it basically exits with RC 2 (Unable to split the file).

So the question is: Can I detect that the first file is already opened by an application?

Maybe I need to mention that the files is stored on a network drive.

Any comments are welcome.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



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