Skip navigation

(re)Enable iCalendar ability to execute AppleScript

8422 Views 37 Replies Latest reply: Apr 16, 2013 11:44 PM by kelhak1 RSS
  • LinuxGeek3447 Level 1 Level 1 (20 points)
    Currently Being Moderated
    Aug 15, 2012 9:17 PM (in response to Jorsta)

    I totally didn't stop to look at saving the automator script as a .app file. I just went with what I knew about Automator's ability to run applescript files. I tried your suggestion, and it works (I didn't expect it to fail). Thanks for catching that - it simplifies the process, and I learned something new.

  • LinuxGeek3447 Level 1 Level 1 (20 points)
    Currently Being Moderated
    Aug 15, 2012 9:22 PM (in response to Jorsta)

    Duplicate comment removed

  • Mark Saper Level 1 Level 1 (10 points)
    Currently Being Moderated
    Aug 27, 2012 1:38 PM (in response to smkd)

    Has anyone figured out a way to get information of the Calendar event that opens the Applescript/automator application? 

  • ozymandias1 Calculating status...

    If you are talking about trying to pass an argument to the script, I have the same question.  Any luck?

  • SU Level 1 Level 1 (105 points)

    have you found this to be a bit flakey in 10.8.2 and 10.8.3?  Not always running. 

  • Lenny Eiger Calculating status...
    Currently Being Moderated
    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....

  • kelhak1 Level 1 Level 1 (135 points)
    Currently Being Moderated
    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,

  • kelhak1 Level 1 Level 1 (135 points)

    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,

1 2 3 Previous Next

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.