Launch app when another app is closed

How do I have a specific app open when another app is closed automatically?


I am using Moneydance which quits when clicking the upper left red window button (unlike other apps that have to be quit). The other app is Safari.


Safari will never be running when Moneydance is running as I have it quit via an AppleScript when launching Moneydance, so it's "just" a matter of launching Safari when Moneydance is closed with its red close window button which quits the app.


Is the an AppleScript way to accomplish this?


Thanks



iMac (2017 – 2020)

Posted on Aug 10, 2023 1:58 PM

Reply
32 replies

Aug 11, 2023 2:38 AM in response to mrokloricred37

Most interesting and Yes Moneydance will Close / Quite if the Red Button on top left of Moneydance is clicked


But in the same location as in above there is the Yellow button and the Green button


As I write, I too have Moneydance open as well as Safari


I can Minimize Moneydance to the dock using the Yellow button and still have Safari Open as I write this reply


In my case, no needs for any scripts and such


Refer to images below







Aug 10, 2023 2:05 PM in response to mrokloricred37

The red traffic light button doesn't close Safari, it essentially "sleeps" the app. Open Safari, and click the red button. If you have it set up, the Safari icon on the dock will have a tiny dot underneath it. That signifies the app is still running but minimized.


To actually close Safari (and most apps): Click Safari in the menu and select "Quit Safari".

Aug 15, 2023 10:56 AM in response to Owl-53

Hi,


I have made this much simpler I hope :)


I would like to add to the script below that if "Moneydance " is running, the script should NOT eject the disc "tom". Otherwise, if Moneydance is not running, it would run the script below and eject the disc if it exists.


Seems, I need an if statement before the script below, but can't figure the code to do so. Also,"tom" would always exist if Moneydance is running, since Moneydance resides in the disc "tom"


Thanks



tell application "Finder"

if exists disk "tom" then eject disk "tom"

end tell

Aug 15, 2023 5:21 PM in response to Old Toad

Is the same thing true with my previous post?


I would like to add to the script below that if "Moneydance " is running, the script should NOT eject the disc "tom". Otherwise, if Moneydance is not running, it would run the script below and eject the disc if it exists.


Seems, I need an if statement before the script below, but can't figure the code to do so. Also,"tom" would always exist if Moneydance is running, since Moneydance resides in the disc "tom"


Thanks



tell application "Finder"

if exists disk "tom" then eject disk "tom"

end tell





Aug 18, 2023 10:29 AM in response to Barney-15E

Hi.


Still working on this with your suggestion.

Wonder how to stop the script from running any further if Moneydance is running. (see below)

If it is not running then the script should proceed.


Many thanks




tell application "Finder"

set runningApps to name of application processes as list

if runningApps contains "MoneyDance" then


WOULD LIKE TO END IF AND NOT PROCEED WITH THE REST OF SCRIPT IF MONEYDANCE IS RUNNING


end if

end tell


tell application "Finder"

if exists disk "tom" then eject disk "tom"

end tell

Aug 19, 2023 7:31 AM in response to mrokloricred37

property AppList : {"MoneyDance", "TextEdit"}

tell application "Finder"
	set runningApps to name of application processes as list
	set ejectDisk to true
	repeat with anApp in AppList
		if runningApps contains anApp then set ejectDisk to false
	end repeat
	if ejectDisk then
		if exists disk "tom" then eject disk "tom"
	end if
end tell


You can add as many apps as you want to AppList.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Launch app when another app is closed

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.