Turning off and on app in automator
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)
Want to highlight a helpful answer? Upvote!
Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >
Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >
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)
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"
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.
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.
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?
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.
Turning off and on app in automator