How to prevent multiple instances of a non-LC Windows app?
Graham Samuel
livfoss at mac.com
Wed May 18 16:06:35 EDT 2011
Hi
The app I'm writing is sometimes required to launch an existing Windows app on quitting. The Dictionary entry for 'launch' says
> When the launch command executes, the application being launched comes to the foreground. When the user quits, LiveCode comes to the foreground.
>
> If the application is already running, the launch command does nothing, and "Process is already open." is placed in the result function.
This doesn't seem to be true. I find that if the Windows app is already running, 'launch' will just happily start up a new instance, and nothing will appear in 'the result'. What I want to do is to make sure that if a single instance is running, it comes to the foreground as my LC app quits.
I am aware of 'the openProcesses', but this doesn't find processes which were not launched by LC (from the IDE it doesn't even find an instance of an LC standalone running in the same machine, but I suppose this is a digression). Perhaps there is a shell equivalent to the openProcesses which will list whether or not the Windows app is already running, how can I make sure it is frontmost when my LC app quits? Even if 'launch' worked as described, it wouldn't help, since it would apparently do nothing at all.
Can anyone say how they solved this problem?
Graham
More information about the use-livecode
mailing list