Launch of multiple application instances (Mac vs Win)

Colin Holgate colinholgate at gmail.com
Sun May 8 11:47:36 EDT 2022


I wonder if the relaunch approach would leave the user in File Explorer, and would not switch across to the existing app instance? Hopefully it will be that simple.

If it isn’t, try this approach:

https://use-livecode.runrev.narkive.com/wOjpGm5V/external-for-running-one-instance-on-windows


> On May 8, 2022, at 9:37 AM, Klaus major-k via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Hi Paul,
> 
>> Am 08.05.2022 um 17:32 schrieb Paul Dupuis via use-livecode <use-livecode at lists.runrev.com>:
>> 
>> Seeking help:
>> 
>> On MacOS when you try to launch a second instance of an application, the macOS just brings the open app to the front (for example, if it is hidden on minimized).
>> On Windows, when you try to launch a second instance of an application, Windows launches a second (or 3rd or 4th or ...) instance of the application.
>> 
>> All well and good, but here is my problem. We have some users of our application that, on Windows, are accidentally launching more than once instance of our application and then getting confused (our users are often not very computer literate).. This confusion can lead to them thinking they have lost data or other problems caused by doing some work in one instance and some in another and not recognizing they have multiple instances running.
>> 
>> I would like to add some start up code to application, that on Windows, detects if our app is already running and  (a) shuts the 2nd instance down OR (b) [PREFERABLY] warns the user they are launching a second instance and offers to (1) bring the existing instance to the foreground (and shut itself down) or actually continue and launch a seconds instance (for power users who know what they are doing)
>> 
>> Has anyone written code to do this?
>> i.e. code to detect an already running instance and code to bring that instance to the foreground?
>> If so, are you willing to share the code?
>> 
>> Just looking to not have to reinvent the wheel here.
> 
> just add this "dummy" handler to your stack:
> ----------------------------
> on relaunch
>  ## Nada :-)
> end relaunch
> -----------------------------
> That will prevent the launching of multiple instances on Windows!
> 
>> Thank you in advance!
> 
> Best
> 
> Klaus
> 
> --
> Klaus Major
> https://www.major-k.de <https://www.major-k.de/>
> https://www.major-k.de/bass <https://www.major-k.de/bass>
> klaus at major-k.de <mailto:klaus at major-k.de>
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode <http://lists.runrev.com/mailman/listinfo/use-livecode>


More information about the use-livecode mailing list