How to prevent multiple instances of a non-LC Windows app?

Mark Schonewille m.schonewille at economy-x-talk.com
Wed May 18 16:15:08 EDT 2011


Hi Graham,

Use tasklist to check if the programme is already running.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

New: Download the Installer Maker Plugin 1.6 for LiveCode here http://qery.us/ce

On 18 mei 2011, at 22:06, Graham Samuel wrote:

> 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