If we need to wait another process has finished working with a file, how can we be notified when the process closed the file ?
In Terminal, type
lsofis installed in Mac OS X, but if you want to look at the source code, it's available here, also of interest see (topics 2.4 and 2.6)
Form.docopened in the
As usual, such a command is easily "piped" or even executed from an AppleScript using
lsof +D /tmp | grep Form.doc
do shell script.