5 Replies Latest reply: Jun 3, 2013 3:59 PM by Barney-15E
lburech Level 1 Level 1 (0 points)

I would like the actions necessary in automator to turn off an application in the morning and turn it back on in the afternoon each day.


MacBook Pro, OS X Mountain Lion (10.8.2)
  • Barney-15E Level 8 Level 8 (43,295 points)

    You need more than Automator.

    You need to create a LaunchCtl plist that will activate at the time you want.

    You could use it to call an Automator workflow that uses an Applescript Action to run the app and to quit the app.

     

    tell application "Pages" to open


    tell application "Pages" to quit

     

    Lingon is a good app to use to create launchCtl items.

    Here's some examples of how to do it manually.

    http://alvinalexander.com/mac-os-x/launchd-examples-launchd-plist-file-examples- mac

     

    For the run command, you can use

    open -a AppName

     

    To quit, you have to call Applescript using osascript (although there might be another way):

    osascript -e "ignoring application responses" -e "tell application \"AppName\" to quit with saving" -e "end ignoring"

  • lburech Level 1 Level 1 (0 points)

    I guess I am confused as to why if I pick calender as the "Type" I cannot use automator to activate the times I want. 

  • Barney-15E Level 8 Level 8 (43,295 points)

    Use Launch Application and Quit Application. They are in the Utilities library.

     

    Note that you can repeate each of those in the same workflow to open (quit) many apps at once.

  • lburech Level 1 Level 1 (0 points)

    You certainly solved my question.  It raised two additional questions which I hope you can address.

    1. Once I scheduled the Automator in Calendar by saving my workflow, it sends an audible signal on my iPhones whenever it runs to open or quit the application.  If I shut off the sound in the calendar, the application does not run.  If I deselect the automator calendar on the iPhone, it reselects it as soon as it runs.  I can live with this annoyance but wondered if this is  an inherent property if I select the Calender as the "Type" before starting to develop my workflows.

    2. The App that I lauched with the workflow requires a password.  Can I modify the lauchworkflow to put in the password, so the application is up and about or must I put the password in manually?

  • Barney-15E Level 8 Level 8 (43,295 points)

    1) I had never looked into Calendar Alerts in Automator before you asked (hence my confusion). One guess I have is that it sends a Notification. Since you only need this on your Mac, put the event in an ON MY MAC calendar. Mine was automatically created there, so it didn't go to my iCloud devices.

    If you don't have an ON MY MAC calendar, the only way I've found to create one is to turn on the Birthdays calendar in the preferences, select it from the list of Calendars, then right-click below it and select New Calendar.

    The Automator Action actually created an Automator Calendar for me.

     

    2) I don't know if that is possible.