MacOS – iCal No Longer Runs Scripts

applescripticalmacos

I have some automated tasks in the form of AppleScripts which I would schedule to run overnight via an iCal event. The event would simply be set to "run script" at "0 minutes before the event" and I'd select the various scripts to run.

Ever since upgrading to Mountain Lion, however, "run script" is now just "open file" and the scripts don't run, they just open in AppleScript Editor.

I tried compiling the scripts into applications to see if I could select those to be opened instead, but they're not available to select from the event (they're greyed out).

  1. How can I get Calendar to run my scripts?
  2. Conversely, is there a better way to schedule scripts to run?

Best Answer

I wrote an answer to a question about scheduling jobs that could solve a few of the issues for you. That was mostly for a one off time though versus ongoing.

If you have an ongoing job, like one that you would have scheduled through iCal, launchd will work nicely as well.

But if you want an outright replacement to something similar to what you did with iCal/Calendar, it sounds like this great writeup on the Apple Discussions board explains using Automator's 'Calendar Alarm'. One user even said that this new way is even easier to use. I personally think with the extra power of Automator, it also adds new power.

From that site:

Here's a solution that works for me:

  1. In Automator, create a Calendar Alarm
  2. Select Utilities from the library pane
  3. Select & drag Run AppleScript into the workflow area
  4. Copy/paste the AppleScript into the Run AppleScript box
  5. Save the newly created Calendar Alarm
  6. Open Calendar.app, create a new event
  7. Select the Automator calendar as your reference calendar
  8. Select Open File for the alert, and select the file you created in Automator. By default, iCal is the file that comes up when you select Open File.
  9. Change that to the name of the Automator app you created.
  10. Select Other if the file name isn't shown.

enter image description here

The user attached some screenshots to their post, as well, but I have included a screenshot of what needs to be selected in Automator.