Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

(re)Enable iCalendar ability to execute AppleScript

Hi there fellow early adopters of ML (i'm talking to those who wait the final release and never installed ML DP).


I were using tons of AppleScript with Calendar ability to run script. Is there any way to recover this ability in Mountain Lion ?


Thanks,

MacBook Pro, OS X Mountain Lion

Posted on Jul 26, 2012 2:36 AM

Reply
37 replies

Apr 16, 2013 11:05 AM in response to smkd

I use Script Debugger to write scripts, as I am sure many of you do as well. Why do I have to copy and paste a serious script into a toy program like Automator to get it to run? It's offensive.


Second, if Apple has decided to disallow running scripts in iCal, why won't they disable it in Automator next? Why is it not the same? In fact, you can even run scripts on a remote computer with Automator - now there's a security issue. Will it be 10.4 or 10.5? Then we would have to start all over again.


It's probably not security at all, its moving us to "Finderless" applications like Automator - because we apparently can't do real business apps like the people who use PC's. I've been doing business apps on the Mac since 1985 and I am so getting tired of this.


I guess I have to learn launchd after all....

Apr 16, 2013 8:24 PM in response to smkd

Hi,


Note that you don't need to choose 'open file' from the Automator calendar. You can choose the Automator Calendar workflow with 'open file', directly from within any Calendar. Someone had posted the location of where your Calendar workflows are stored. Also, note that you need to be able to access your home folder Library from with the choose file dialog. Just add the user Lirary folder to the sidebar.


gl,

Apr 16, 2013 11:44 PM in response to Mark Saper

Hi Mark,


You can get the event 'summary' (Calendar dictionary term) by ui scripting the alert window in Notification Center.


You might be able to get it from the temporary file created whose reference is passed as a parameter to the run handler of the Calendar workflow script. Although I haven't tried looking at this temporary file yet. Here's an example of getting the passed parameters:


on run {input, parameters}


(* Your script goes here *)

display dialog "It works!"

--set c to class of parameters

--set c to (count input)

--display dialog (c as string)

tell application "Finder"

activate

set the clipboard to parameters

end tell

activate me


return input

end run


After the parameters are sent to the clipboard, you can get them with this from the Script Editor:


--set r to {a:1, b:2, c:3}

tell application "Finder"


activate


--set the clipboard to ""

set c to the clipboard

end tell

list of c

--


The result is something like this:


{"temporary items path", "/var/folders/r9/0t1l8pd17kd1275j1dwnbrdw0000gn/T/572D6A11-9937-4EB9-82AA-1DCBC CDE4AF3/1/com.apple.Automator.RunScript", "ignoresInput", false, "source", "on run {input, parameters}


(* Your script goes here *)

display dialog \"It works!\"

--set c to class of parameters

--set c to (count input)

--display dialog (c as string)

tell application \"Finder\"

activate

set the clipboard to parameters

end tell

activate me


return input

end run", "action", item id 1 of application "Finder"}


I wonder what is in that file? A simple read of that file might work.


gl,

(re)Enable iCalendar ability to execute AppleScript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.