Skip navigation

(re)Enable iCalendar ability to execute AppleScript

8439 Views 37 Replies Latest reply: Apr 16, 2013 11:44 PM by kelhak1 RSS
  • Pondini Level 8 Level 8 (38,710 points)

    LinuxGeek3447 wrote:

    . . .

    Open Calendar.app, create a new event

     

              Select the Automator calendar as your reference calendar

     

              Select Open File for the alert, and select the file you created in Automator.

    For me, all those steps were already done after I saved it as a Calendar Alarm -- so it's even easier.  Just set the time & repeat frequency.

     

    Very cool!  

     

     

    Now, a question:  since you only have 10 points here, you're not authorized to create a User Tip (see https://discussions.apple.com/static/apple/tutorial/reputation.html).

     

    But this would be good one.  If you haven't seen them, click the User Tips tab at the top of the forum list:

     

    Screen Shot 2012-07-30 at 6.57.32 PM.png

     

     

    If you'd like to rewrite your instructions in a fashion similar to the first 3 (mine just link to my website), perhaps including the screenshots "in line," I'd be happy to copy it and make it a User Tip, crediting you prominently as the author of course (although it will show me).

     

    Then not only will some folks find it on their own, but others can post links to it.

     

    EDIT: And I'll link to it from my Changes in Mountain Lion page.

     

    .

     

    Message was edited by: Pondini

  • LinuxGeek3447 Level 1 Level 1 (20 points)
    Currently Being Moderated
    Jul 30, 2012 7:31 PM (in response to Pondini)

    Let me know if this rewrite works.

     

    If you have AppleScripts designed to execute from Calendar, you may find that they no longer work in Mountain Lion. Fortunately, there is a work-around that will restore the Calendar's ability to run your scripts by using Automator.

     

    I use an AppleScript to provide an alarm clock function. Here's how I used Automator to allow execution of the script:

     

    In Automator, create a Calendar Alarm

     

    1a.png

    Select Utilities from the library pane

     

              Select & drag Run AppleScript into the workflow area

     

              Copy/paste the AppleScript into the Run AppleScript box

    2a.png

     

              Save the newly created Calendar Alarm

     

    Open Calendar.app, create a new event

     

              Select the Automator calendar as your reference calendar

    3.png

              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. Change that to the name of the Automator           app you created. Select Other if the file name isn't shown.

  • Pondini Level 8 Level 8 (38,710 points)

    Yup. Looking good.   A few suggestions:

     

    Screenshots shrink when posted, so get difficult to read.  And if a user enlarges them, they tend to get fuzzy.   So you might want to trim them down with Preview or the like to just the window (or important part of the window), so what the user needs to see is clearer and more prominent.

     

    Especially for the second one, while folks don't really need to able to read the Applescript, it would be much clearer.

     

    Adding things like a red circle around the Calendar Alarm in the first sample really draws attention to it.

     

    And you might want to mention in the last paragraph that all those things should or may be there already (at least they were for me!).

     

    Great!

  • Pondini Level 8 Level 8 (38,710 points)

    Hi,

     

    I had a few minutes, so took a crack at it myself:  https://discussions.apple.com/docs/DOC-4082

     

    See what you think.  Unlike the normal forums, there's no time limit for edits, so I can make any changes you want.

     

    Thanks!

  • LinuxGeek3447 Level 1 Level 1 (20 points)
    Currently Being Moderated
    Jul 31, 2012 10:10 AM (in response to Pondini)

    Looks good. I can see what you were referring to about the screenshots being fuzzy. I had to reduce them from their original size (1280x800) to fit properly into the document I used as the template for my post. I can try to produce clearer screenshots. If I get those done, I will forward them to you. Otherwise, I wouldn't change a thing. Thanks for adding your tweaks in. The past few days have been busy for me.

  • Pondini Level 8 Level 8 (38,710 points)

    Great. 

  • Diggerdantheman Calculating status...
    Currently Being Moderated
    Aug 4, 2012 2:59 PM (in response to smkd)

    This is the clearest, most concise fix out there at the moment.  In essence it replaces all our custom scripts (written to run in iCal) with ones dedicated to iCal - as far as I can tell.  Thanks for posting.

  • autnagrag Level 1 Level 1 (45 points)

    If anyone else gets frustrated with this, I found I had to quit Calendar.app and then relaunch it for each new Calendar_Alarm.app I wanted to attach.

     

    Without this step, the apps I had created would be unselectable/unattachable.

     

    ?????

  • Jorsta Calculating status...
    Currently Being Moderated
    Aug 11, 2012 10:10 AM (in response to Pondini)

    The simple solution is to just save the script as an application inside Applescript Editor.

    Then choose "Open file" (intstead of the missing "Run script") in the calendar event and select the app you created.

  • autnagrag Level 1 Level 1 (45 points)
    Currently Being Moderated
    Aug 11, 2012 1:58 PM (in response to Jorsta)

    Jorsta,

     

    If your posting is to me, what you suggest is exactly what I was doing, and what I describe was the result. The apps I had created in Automator were grayed out/unselectable as targets for a reminder of the "open file" type in the Automator-name calendar in Calendar.app. After quitting Calendar.app and relaunching it, I could, with success, select one of the three apps I had created to be such a target.

     

    Thanks, though.

  • Jorsta Level 1 Level 1 (0 points)

    Well, I haven't read the whole thread here - but I did read the original post.

     

    I just wonder why you have to use Automator at all – when it's applescripts you wan't to execute. Just open your script in the AppleScript Editor, and save as/export it choosing "application" as file format.

     

    Using Automator is an unnecessary step.

  • Pondini Level 8 Level 8 (38,710 points)
    Currently Being Moderated
    Aug 11, 2012 4:53 PM (in response to Jorsta)

    Jorsta wrote:

    . . .

    I just wonder why you have to use Automator at all – when it's applescripts you wan't to execute. Just open your script in the AppleScript Editor, and save as/export it choosing "application" as file format.

    That didn't work in the beta versions of Mountain Lion -- you couldn't select an applescript app for the Open File option. 

     

    Now it does (which makes no sense, since they responded to bug reports saying they removed the AppleScript option for "security reasons").

     

    Very odd. 

  • autnagrag Level 1 Level 1 (45 points)
    Currently Being Moderated
    Aug 11, 2012 5:29 PM (in response to Pondini)

    How odd indeed. The reason I looked for this thread, steered here by another forum, was that the "open file" alert in ML was doing that and only that. I would find my unexecuted AppleScriptMy.scpt open. ("Gosh, thanks.")

     

    I can't recall if I tried pointing open file at an AppleScripteMy.app.

     

    It seems now this whole thread hinges on the detail: "If the AppleScript you ran as a 'run script' alert under iCal/Lion won't run under Calendar/Mountain Lion, save it in the .app format from AppleScript editor and then point the 'open script' alert at that."

     

    It is easy to change the .scpt into a .app for an extant script. For me, at least, it was a bit of a struggle to get these Automator Calendar Alerts to work. They do work, but they have little or no elegance.

     

    How dense of me and perhaps others to miss the detail that Apple did not 'refuse' to let an alert run an AppleScript, but did impose a new format requirement on such scripts.

     

    I hope others find this part of this thread before duplicating some or any the efforts exerted by all those who contributed here.

  • Jorsta Level 1 Level 1 (0 points)

    It wouldn't make any sense for Apple to, for "security reasons", stop Applescript apps from being executed by Calendar events – and at the same time allow the same thing for Automator apps (or other apps).

     

    But to exclude compiled scriptfiles does make a sense: The new Gatekeeper choice to only allow downloaded apps from Mac App Store or certified developers would block a harmful app but miss a harmful scriptfile.

  • nothin7 Level 1 Level 1 (10 points)

    Thanks LinuxGeek3447!

     

    When I saved the Calendar Alarm in Automator, it was automatically added to my Calendar at the current time.

     

    If anyone else is wondering how to edit their Calendar Alarms, these Automator apps are stored in ~/Library/Workflows/Applications/Calendar. I tried moving the .app file to another folder, and Calendar was no longer able to select it in the event details popup. Seems like it's gotta stay there.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (2)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.