I have a data file eg, test.jpg
If I use getfolderitem(“test.jpg”).launch
It will open it with the associated program.
However, I need to know when the program ends so I can check the data file for changes (ignore they may save it elsewhere)
However launch does not seem to have a way to inform me when its lauched process completes.
So, I could create an interactive shell, but what OSX/Win command do you use to lauch a datafiles associated application?
or is this possible somehow in Xojo.
[quote=107722:@dave duke]I have a data file eg, test.jpg
If I use getfolderitem(“test.jpg”).launch
It will open it with the associated program.
However, I need to know when the program ends so I can check the data file for changes (ignore they may save it elsewhere)
However launch does not seem to have a way to inform me when its lauched process completes.
So, I could create an interactive shell, but what OSX/Win command do you use to lauch a datafiles associated application?
or is this possible somehow in Xojo.[/quote]
Open and start wait until the app designated to open / edit them quits
And both you can start a new instance of the app even if one is already running - so you can be sure when that one quits it was the one you started.
What you cannot easily tell is if the person opened another file & closed the one you started the process with.
Well you might be able to monitor busy files and such using OS event handling - on OS X FS Events not sure about Windows.
Then you could tell when / if the file you started the app with was still in use - thats really what you want to know.
On a Mac the command to list open files is lsof <PID>. I just fiddled with that for a while. It lists an impressive number of files for a given process down to the most peculiar temporary file and even network connections. BUT it does not list files open for editing for instance in Photoshop or Preview.
Then still with the same test files I tried to see if the system somehow locks them to prevent deletions or moving, or after opening a file from a removable media, if the system does not want to eject because a file is busy. Neither. So it seems that both these apps do not lock the files while they are edited.
I am afraid you are after something that is impossible. When apps do not lock files while they are using them, I see absolutely no way to find out when a user is finished with them. The only thing you can detect reliably is when the process you initiated is terminated (the editing app has been quit).
Thats why open -Wn on OS X might be the best
You can force a new copy of the app to open and edit the file but still all you can tell is that instance ended
Windows has a similar thing but again same problem