Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

Like, if i run this from the command line:

C:\>"C:\Program Files\\Adobe\\Adobe After Effects CC\\Support Files\\AfterFX" -r   "C:\Workspaces\MyAEScripts\AutomateSetup.jsx" hello

is it possible to get that "hello" into my AutomateSetup.jsx script? I've been googling for a while and can't find a solution to this.

like image 318
ygetarts Avatar asked Feb 20 '14 22:02

ygetarts


1 Answers

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.

like image 145
Jeff Stern Avatar answered Oct 20 '22 10:10

Jeff Stern