Menu

#288 Test whether a file is in use

3.x Stable
open
nobody
None
5
2018-02-21
2018-02-21
No

I've found simply using FileOpen to see if a file is in use only works if the file has been opened with exclusive access. Here's a new macro, for use with logiclib, for that tries to open a file with exclusive access (and immediately close it). So, if anything has the file open, even if it is a shared open, this will return false.

Sample below

${IF} ${FileLocked} "text.txt"
MessageBox MB_OK|MB_ICONSTOP "File is locked"
${ELSE}
MessageBox MB_OK "File is not locked"
${ENDIF}

1 Attachments

Discussion


Log in to post a comment.