Using SHELL to get a list of processes

Hugh Senior h at FlexibleLearning.com
Fri Feb 6 03:16:11 EST 2009


Thank you... I must have missed the introduction of the 'relaunch' message
in 2.7.3 which certainly makes things a LOT easier than using shell or file
locks!

/H

Hugh Senior wrote:
> I just found TASKLIST which works... get shell("TASKLIST").
>
> And the processID returns the id of the app.
>
> So I think I have got the necessary bits to check for multiple instances
> now.

Jacqueline Landman Gay:
You might want to look at the "relaunch" command instead of using shell.
It is specifically designed to catch multiple app instances and redirect
to the one that was running first. No shell command necessary.

Mark Schonewille:
If you want to run only one instance of your standalone at a time, you
need to include a relaunch handler in your stack script. Assuming that
you want the existing instance to come to the foreground when the
second instance is launched and that you want the second instance to
quit immediately, all you need is to catch the message and not pass it:

on relaunch
  return empty -- just for clarity, if you like
end relaunch

If you return "background", the second instance is terminated, but the
first instance won't be activated. If you pass the message, the second
instance will run.





More information about the use-livecode mailing list