Combo

Q: Run automator script in a shell command

Hi,

 

I'd like to run an automator script in a shell command with the automator command (see man automator).

 

I'd like to pass an argument to the script (like a list of files) too with the -i parameters but my syntax has failed. Here is my test script written in AppleScript :

on run
  tell application "Finder"
  set theSelection to selection
  set theFile to theSelection's item 1 as alias
  set thePath to quoted form of POSIX path of theFile

  log thePath

  set theWorkflow to quoted form of "/Users/conmeubonailleuco/Library/Mobile Documents/com~apple~Automator/Documents/Encode Audio Files.workflow"
  set theAutomatorScript to "automator " & theWorkflow & " -i (" & thePath & ")"

  do shell script theAutomatorScript
  end tell
end run

 

And my error :

error "Erreur dans Finder : sh: -c: line 0: syntax error near unexpected token `('\rsh: -c: line 0: `automator '/Users/conmeubonailleuco/Library/Mobile Documents/com~apple~Automator/Documents/Encode Audio Files.workflow' -i ('/Users/conmeubonailleuco/Temporaire/(2005) The Darkness - One Way Ticket To ****...And Back [FLAC] - copie/01.One Way Ticket.flac')'" number 2

 

Any idea ?

 

Thx a lot.

Posted on Jan 30, 2016 6:18 AM

Close

Q: Run automator script in a shell command

  • All replies
  • Helpful answers