Skip to content Skip to sidebar Skip to footer

Adobe After Effects Extend Script - How To Run Script From Command Line And Pass In Arguments?

I'm trying to run an Adobe AE extendscript from the command line. I use the '-r' argument and I can run scripts fine. However, is it possible to pass in an argument to the script?

Solution 1:

For people who come across this question, and don't want to write a file, you can pass in arguments by using the -s switch which runs the argument to the AfterEffects program as a script. For example, you can do the following (Windows cmd):

afterfx.exe -s "var myArg="I'm a string!"; $.evalFile("Your path to script here")"

You could then access myArg from the script you run in the evalFile command. With this you could just pass in a single string containing your command line arguments, or make and set individual variables for what you need. Also note that you do NOT need to escape the quotes you use in the script line, just type it in as if it were just a text file (but do surround the line in quotes).

I'm a novice with After Effects scripting, so please correct if this is wrong in some way.


Solution 2:

My workaround is to write the arguments to a file in the current working directory or under the directory where the script is, and then read them in the script.

You can get the working directory in Mac OS X using system.callSystem('pwd').

Under Windows, you can get the directory of the script using system.callSystem('cmd.exe /c "echo %cd%"'').


Post a Comment for "Adobe After Effects Extend Script - How To Run Script From Command Line And Pass In Arguments?"