1

I made an application on Automator (app x) that launches few applications (app a,b,c). I was wondering instead of creating another application to quit the apps(app a,b,c), is there a way I can get Automator to quit those apps when I quit app x?

note: when I launch app x it doesn't have the dot underneath it that indicates an application is active.

2

An Automator app doesn't usually stay open after its run if all it's doing is opening a few apps. That said, since you want to open and close the same apps with a single app that stays open and then closes the target apps when you quit the app that opened them, I would choose to do this with a stay open AppleScript application.

The following example AppleScript code, shown below, will open the three apps in the theseApps list and then close them when you close the app made from this code.

In Script Editor, copy an paste the example AppleScript into a new untitled document.

property theseApps : {"Contacts", "Dictionary", "Notes"}

on run
    repeat with thisApp in theseApps
        activate application thisApp
    end repeat
end run
on quit
    repeat with thisApp in theseApps
        quit application thisApp
    end repeat
    continue quit
end quit
  • Obviously, change the names of the app in the example AppleScript code to meet your needs.

Now save the script as an AppleScript application while checking the Stay open after run handler check box.

The example AppleScript code, shown above and as is, when saved as a stay open AppleScript application, worked for me without issue on macOS High Sierra.


Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.

1

An easy way to do this is with Keyboard Maestro which can run commands to open apps together or quit a group of apps when a particular app quits.

All you'd need to do is specify the app that you want to monitor when it quits, and then tell it to quit the other apps as well.

  • 1
    Keyboard Maestro cost $36.00 USD and seems a bit expensive and overkill, while the native solution, provided in my answer, is free! – user3439894 Jun 27 at 2:37
  • 1
    Keyboard Maestro does far, far more than this one example, of course. Hundreds of things, at least. It also actually does what the OP asked for (quits apps when another app quits). Yes, you could manually run something to quit them, but that defeats most of the point of trying to automate this, which is what it sounded like the OP was trying to do. – TJ Luoma Jun 27 at 3:07
  • I think you are not understanding the full scope of the question. The OP made an Automator app which opens 3 apps, and based on what else was said, it closes directly after it opens the 3 apps. However, he would like that app which opens the 3 apps to stay open and then when closing it, it closes the 3 apps it opened. That is exactly what the code in my answer does, simple, short, to the point, and free, not $36 USD and is so overkill for what was asked it's not even funny. Automator is not needed because a free and native stay open AppleScript app does exactly what he's asking for! – user3439894 Jun 27 at 4:19
  • Can you add a screenshot of the KM script you had in mind? Yes I know it's easy to create if one is used to work with KM, but it might be a bit more tricky for somebody new to it (be it the OP, be it somebody else who stumbles across this Q in the future) – nohillside Jun 27 at 5:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .