Hints & Tips

Hints & Tips

Call Automator Workflows from AppleScript

From Mac OS X Hints: “If you need to execute an Automator workflow from an AppleScript, have the application “Automator Launcher” open the saved workflow document.

A sample code snippet would look something like this:

tell application "Automator Launcher"
   open "... path to saved workflow document ..."
end tell

The workflow will execute without opening Automator, and you get the workflow status in the menu bar.

Comments

3 Comments »

  1. tell application “Automator” open “Xik:Library:Application Support:Automator:Workflows:ErasePrefs” end tell

    Opens automator with a window for a new workflow with the first and only step “get specified finder items” with the my ‘eraseprefs’ name and a blank path.

    Anything obviously in error? Thanks.

    Event log: tell application “Automator” open “Xik:Library:Application Support:Automator:Workflows:ErasePrefs” current application open “Xik:Library:Application Support:Automator:Workflows:ErasePrefs” end tell

    I go this way as no results are forthcoming when a workflow saved as an application is run, beyond the menu bar notification series.

    Comment by mark chapoton — July 11, 2005 @ 2:16 pm

  2. “Automator Launcher” gets an invalid connection error message.

    Proper path including the ‘apple’ folder still gets the new workflow window.

    Comment by mark chapoton — July 11, 2005 @ 2:25 pm

  3. Another way to the same resault is to save your Automator script as an application and open it with the tell application string in Apple Script.

    A small script for connecting a hot folder to a Automator script looks like this.


    on adding folder items to thisfolder after receiving theseitems tell application “The name of your Automator script” launch end tell end adding folder items to


    /Fredrik

    Comment by Fredrik Malvefors — August 29, 2005 @ 4:30 am


Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>