Re: Launch of multiple application instances (Mac vs Win)

2022-05-08 Thread Paul Dupuis via use-livecode
Nevermind. I found the "Relaunch Sampler.rev" stack referred to in the 
Dictionary entry and it explains how the message is used further.



On 5/8/2022 12:08 PM, Paul Dupuis via use-livecode wrote:

The LC 9.6.7 Dictionary entry to 'relaunch" states:

It can be used in the following three ways:

|1. If the message is passed, then the new instance continues running. 
2. If "background" is returned, then the new instance is terminated. 
3. If nothing is returned but the message is not passed, then the new 
instance is terminated and the existing instance's "defaultStack" is 
made the foreground window.|


If there are no existing instances, the new instance will run.

1. seems pretty straightforward:

on relaunch

  pass relaunch

end relaunch

Would allow the 2nd (or whatever number) instance to continue to start up


3. Seems obvious as well:

on relaunch

  -- trap the message

end relaunch

Here, the message is not passed, so the new instance is terminated and 
the "defaultStack" of the existing instance is brought to the foreground



However, I do not understand 2. What the heck does ;If "background" is 
returned" mean in the context of this handler? Returned from what? The 
only example given is:


onrelaunch pDocument openDocument pDocument endrelaunch

And the Dictionary states that actually multiple parameters can be 
passed (for example if multiple documents where dragged onto the app 
to launch it). I feel there is something missing in the Dictionary entry!



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Launch of multiple application instances (Mac vs Win)

2022-05-08 Thread Paul Dupuis via use-livecode

The LC 9.6.7 Dictionary entry to 'relaunch" states:

It can be used in the following three ways:

|1. If the message is passed, then the new instance continues running. 
2. If "background" is returned, then the new instance is terminated. 3. 
If nothing is returned but the message is not passed, then the new 
instance is terminated and the existing instance's "defaultStack" is 
made the foreground window.|


If there are no existing instances, the new instance will run.

1. seems pretty straightforward:

on relaunch

  pass relaunch

end relaunch

Would allow the 2nd (or whatever number) instance to continue to start up


3. Seems obvious as well:

on relaunch

  -- trap the message

end relaunch

Here, the message is not passed, so the new instance is terminated and 
the "defaultStack" of the existing instance is brought to the foreground



However, I do not understand 2. What the heck does ;If "background" is 
returned" mean in the context of this handler? Returned from what? The 
only example given is:


onrelaunch pDocument openDocument pDocument endrelaunch

And the Dictionary states that actually multiple parameters can be 
passed (for example if multiple documents where dragged onto the app to 
launch it). I feel there is something missing in the Dictionary entry!



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Launch of multiple application instances (Mac vs Win)

2022-05-08 Thread Paul Dupuis via use-livecode

On 5/8/2022 11:47 AM, Colin Holgate via use-livecode wrote:

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



Thanks!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Launch of multiple application instances (Mac vs Win)

2022-05-08 Thread Paul Dupuis via use-livecode

On 5/8/2022 11:37 AM, Klaus major-k via use-livecode wrote:

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! I was unaware of 'relaunch' and it looks like I can make it 
do exactly what I want (warn the user and let them bring the 1st 
instance to the foreground or continue). Much appreciated!



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Launch of multiple application instances (Mac vs Win)

2022-05-08 Thread Colin Holgate via use-livecode
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 
>  wrote:
> 
> Hi Paul,
> 
>> Am 08.05.2022 um 17:32 schrieb Paul Dupuis via use-livecode 
>> :
>> 
>> 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/bass 
> kl...@major-k.de 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com 
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode 
> 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Launch of multiple application instances (Mac vs Win)

2022-05-08 Thread Klaus major-k via use-livecode
Hi Paul,

> Am 08.05.2022 um 17:32 schrieb Paul Dupuis via use-livecode 
> :
> 
> 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/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode