Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Application created with Automator. Since the application starts a service in the background, I'd like to keep the application open even after the end of the workflow is reached. When the user quits the application, I'd like to execute a command to stop the service. How can I achieve the above?

share|improve this question
up vote 1 down vote accepted

I don't know of a way to make a "stay open" Automator app, but you could make a simple "stay open" AppleScript app that can launch an Automator app to start your service, then, when the user quits the AppleScript app, it can launch a 2nd Automator app to stop the service.

Such an AppleScript would look something like this:

on run
    tell application "1st Automator App" to activate
end run

on quit
    tell application "2nd Automator App" to activate
    continue quit
end quit

You could then replace "1st Automator App" with the name of the Automator app that will start the service, and replace "2nd Automator App" with the name of the Automator app that will stop the service.

You would then save the AppleScript as an application with the "stay open" option checked.

Depending on what else your Automator app needs to do, it may be possible to skip Automator altogether and start and stop the service directly in AppleScript.

share|improve this answer
Thanks. I've managed to skip Automator completely thanks to your tip. – Roberto Aloi Sep 1 '11 at 19:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.