What is the opposite of launch?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sat Apr 17, 2010 9:21 am

What is the opposite of launch?

Post by Rob van der Sloot » Tue Jun 11, 2019 4:14 pm

I manage a number of LC Runtimes from one dashboard (also Runtime) with the launch command.
That works perfect.

But now I also want to close the runtimes from that same Dashboard.
How to do that?

Thanks
Rob van der Sloot

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5991
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: What is the opposite of launch?

Post by dunbarx » Tue Jun 11, 2019 6:17 pm

Hi.

Just a guess, but does the "close Process" command fit here?

Craig

Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sat Apr 17, 2010 9:21 am

Re: What is the opposite of launch?

Post by Rob van der Sloot » Wed Jun 12, 2019 2:13 pm

Hi dunbarx,

That won't work, because the close proces command is only applicable to files who were opened by the "open process" command and that's only for background processing data.

thanks anyway,
Rob

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1986
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: What is the opposite of launch?

Post by [-hh] » Wed Jun 12, 2019 4:10 pm

open process ... that's only for background processing ...
No. This is only a proposal of the dictionary.
But on Mac you can open only one instance of an app at one time.

After using open process you can check openProcesses() or openProcessIDs().
(Don't use LC 8, where openProcess is defunct).

For apps opened by open process that can NOT be closed by close process (as is the case on Mac*) you can try kill process (which works with LC 9 here also on Mac). Or, better, use the applescript given below by Thierry.

*[I opened erroneously a bug report: The dict already says, that close process is not supported on MacOS!]
Last edited by [-hh] on Thu Jun 13, 2019 6:43 pm, edited 1 time in total.
shiftLock happens

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1013
Joined: Thu Apr 11, 2013 11:27 am

Re: What is the opposite of launch?

Post by LCMark » Thu Jun 13, 2019 12:42 pm

@hh: Rob isn't entirely wrong in his assertion. The open process commands are designed to work with command-line / UNIX executables; rather than app bundles. From memory, the 'launch' command is more appropriate for app bundles.

@Rob: On macOS usually the best way to start and stop macOS apps (i.e. desktop apps) is using applescript I think... There's no direct way to 'cleanly' close a running macOS app - but applescript can be used to cause the system to send a 'close app' event which the app may or may not decide to honour.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 624
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: What is the opposite of launch?

Post by Thierry » Thu Jun 13, 2019 1:17 pm

LCMark wrote: There's no direct way to 'cleanly' close a running macOS app - but applescript can be used....
Here is how I do that in one of my LC tutorial:

Code: Select all

try
      get shell(format( \
            "osascript -e 'tell application \"MidiKeys\" to quit'"))
            
      get shell(format( \
            "osascript -e 'tell application \"MIDIMonitor.app\" to quit without saving'"))
            
end try
and both apps were opened via the launch command.

HTH,

Thierry
Thierry Douez - https://sunny-tdz.com
Pourquoi tant de notes lorsqu'il suffit de jouer les plus belles... [Barbara]

Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sat Apr 17, 2010 9:21 am

Re: What is the opposite of launch?

Post by Rob van der Sloot » Sat Jun 15, 2019 1:07 pm

OK, thanks again, but for the time being I am interested in a solution for W10.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”