Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

accessing multiple Automator variables in a Run Applescript action

I have an Automator app set up with 4 variables feeding into a Run Shell Script with the following code. And it runs perfectly.


/Applications/Adobe\ After\ Effects\ CC/aerender -sound ON -project $1 -comp "$2" -output $3/$4



However, I need to be able to see the progress of the Script while it processes in the Terminal window. So, I'm setting up a Run AppleScript to tell Terminal to run the script, but I'm getting two problems.


code:

on run {input, parameters}


set aVar to item 1 of input

set bVar to item 2 of input

set cVar to item 3 of input

set dVar to item 4 of input


tell application "Terminal"


activate

do script "/Applications/Adobe\ After\ Effects\ CC/aerender -sound ON -project aVar -comp \"bVar\" -output cVar/dVar"

end tell

end run



Problem 1--Either my syntax or method of setting the 4 variables to access the array of 4 input variables is wrong. And I don't know enough about AppleScript to figure it out.


Problem 2-- AppleScript really doesn't like the spaces in "Adobe\ After\ Effects\ CC" even though the Terminal has no problem with it. But it errors out before it even gets to Terminal.


Any help that anyone can give will be greatly appreciated.

Automator-OTHER

Posted on Jul 22, 2013 8:54 PM

Reply
Question marked as Best reply

Posted on Jul 22, 2013 9:29 PM

The backslash is also used as the escape character in an AppleScript string, so to actually get the character you need to escape it (you can also use the term quoted form of to let AppleScript figure out how to quote the string). To use the variables, you need to use the concatentation operator to mix the variables and text pieces - by putting a variable inside the string the identifier just becomes text.


Your string should look something like:


"/Applications/Adobe\\ After\\ Effects\\ CC/aerender -sound ON -project " & aVar & " -comp " & bVar & " -output " & cVar & "/" & dVar

or perhaps


quoted formof"/Applications/Adobe After Effects CC/aerender" & " -sound ON -project " & aVar & " -comp " & bVar & " -output " & quoted formof (cVar & "/" & dVar)

3 replies
Question marked as Best reply

Jul 22, 2013 9:29 PM in response to designrender

The backslash is also used as the escape character in an AppleScript string, so to actually get the character you need to escape it (you can also use the term quoted form of to let AppleScript figure out how to quote the string). To use the variables, you need to use the concatentation operator to mix the variables and text pieces - by putting a variable inside the string the identifier just becomes text.


Your string should look something like:


"/Applications/Adobe\\ After\\ Effects\\ CC/aerender -sound ON -project " & aVar & " -comp " & bVar & " -output " & cVar & "/" & dVar

or perhaps


quoted formof"/Applications/Adobe After Effects CC/aerender" & " -sound ON -project " & aVar & " -comp " & bVar & " -output " & quoted formof (cVar & "/" & dVar)

Jul 23, 2013 4:49 PM in response to designrender

You are using the correct method to get the items of an array, which is what the input parameter is. Normally the various actions output their result(s) as a list of items, even if there is only one (or none). Depending on what you are doing earlier in the workflow to get the value for the variables, you might have to do something like


setbVartofirstitemofitem2ofinput

accessing multiple Automator variables in a Run Applescript action

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.