Running AppleScripts from Automator
These days, I’ve been using Automator more and more to run AppleScripts (especially since Mountain Lion came out and disallowed Calendar, née iCal, from triggering AppleScripts directly: http://apple.stackexchange.com/questions/59257/ical-no-longer-runs-scripts).
I began copying and pasting scripts into my workflows, which is a messy solution. I kept the scripts around, because it’s easier to write and debug them in AppleScript Editor, and especially since I converted them to plaintext scripts and uploaded them to GitHub, it’s very useful to be able to easily diff them, as well.
But there’s a better way. A much better way, in fact. AppleScripts can call other AppleScripts, and this works from within the Run AppleScript workflow action, as well. The full solution looks like this:
on run {input, parameters}
run script file "Macintosh HD:Some Directory On Disk:a cool script.applescript"
end run
Doing it that way, the Automator is a simple wrapper – you can set it and forget it. I’ve even confirmed that this works with scripts in the plain text .applescript format and compiled AppleScripts (.scpt).
Update
You can also pass the input and parameters arguments into your scripts from Automator as well. Just use the same on run handler that the Run AppleScript action defaults to (as shown above) in your script file, and pass the arguments from Automator like so:
run script file "path to script like above" with parameters {input, parameters}








