AfterFX command line and script argument
by Tobias Kraze
on
Mar 27, 2008 at 3:54:18 pm
Greetings,
I'm currently trying to batch render a larger number of projects in AE CS3 (Windows XP), and the easiest thing for me would be to trigger rendering of a composition within an .aep from a batch script (.bat).
Since the output needs to be in NTSC and PAL, I have used Jeff Almasol's excellent rd_CompSetter.jsx script to set the frame rates of all comps to PAL (all layers are based on stills).
Now, what I would like to do is write a batch script to start afterfx, open the project file (xyz.aep) which is the NTSC version, and then run the script (rd_CompSetter.jsx) to set the framerate to 25 before rendering the composition.
However, apparently there is no way to simply use "Afterfx xyz.aep -s rd_CompSetter.jsx", because it is not possible to have two arguments here, only either the .aep file or the script file.
I thought that one way to work around that limitation is to use a script as an argument, something like
afterfx -s "app.open(new File('xyz.aep'));
There are two problems with this approach:
1) The file doesn't seem to open. After effects starts properly, the info line shows that it is loading the project, and once it has reached 100% AE simply shuts down without an error.
2) I don't know how to run a script from within a script. E.g. would ' afterfx -s "app.open(new File('xyz.aep')); /rd_CompSetter.jsx" ' work?
I cannot use aerender because I need to trigger the CompSetter script first, so that is not an option either.
Many many thanks if you know of any possible solutions.
Re: AfterFX command line and script argument by Tobias Kraze on Apr 4, 2008 at 12:19:20 pm
I kind of found a solution / workaround for this problem. I'm just posting the solution here for anyone who has the same problem.
One way to pass script arguments/variables on the command line is by creating a temporary file in the .bat file and have the after effects script read this file. This way you can set up the
e.g. the test.bat would look like this:
echo %1 > temp.txt
afterfx.exe -r "test.jsx"
and the test.jsx file would start like this:
var tempFile = new File(path to temp.txt file);
tempFile.open();
userVar = tempFile.read();
This way you could even create a list of configuration parameters and then trigger the after effects script. To pass a variable/string to an after effects script this way you would just have to trigger the .bat file:
test.bat myString
I used it to pass the name of the project file that the jsx file should open, and therefore manage batch rendering with variable project file names AND a custom script.