0

I created a workflow in Automator consisting of a single action, "Convert Format of Word Documents" (provided by Microsoft Word). I saved this in ~/Documents/convert_word_to_pdf.app. I can run it by dragging a word file over this app, and it will generate a PDF for me. However, I can't figure out how to run it through the command line. I tried running automator convert_word_to_pdf.app foo.docx and I get Unable to open workflow.. I also tried convert_word_to_pdf and convert_word_to_pdf/document.wflow as arguments to automator, with the same results. What am I missing here?

  • And ~/Documents/convert_word_to_pdf.app foo.docx ? – Thomas Ayoub Apr 21 '14 at 20:16
  • That didn't work either :( – limp_chimp Apr 23 '14 at 18:05
  • And what's the error ? – Thomas Ayoub Apr 23 '14 at 18:28
1

Use -i:

automator -i foo.docx ~/Documents/convert_word_to_pdf.app

Or if there are multiple arguments:

printf %s\\n foo.docx bar.docx|automator -i - ~/Documents/convert_word_to_pdf.app

See the man page:

SYNOPSIS
     automator [-v] [-i input] [-D name=value ...] workflow

DESCRIPTION
     automator runs the specified workflow.  To create or edit a workflow, use
     the Automator application.

     The following options are available:

     -D name=value
              Set variable name to value for this run of workflow.

     -i input
              Set input as the input to workflow If input is - then the con-
              tents of standard input is used.  The newline character (\n) is
              the delimiter for multiple strings.

     -v       Run in verbose mode.
0

Bundles on OSX are just directories, so to run a program You have to call executable. It'll look like:

~/Documents/convert_word_to_pdf.app/Contents/MacOS/Application\ Stub path/to/foo.docx

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .