Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Run a script from Make, headless.

Explorer ,
Mar 25, 2009 Mar 25, 2009

Copy link to clipboard

Copied

This has come up for me a few times, and each time I found some other way around it. But I'm sure it's possible, I just havent found the incantation.

I want to run an AE script totally headless (no UI, no interaction).

The script might be something like, pseudo-code:

> open("my_project.aep");
> var data = readDataFile("./datafile.txt");
> setTextAndKeyFrames("comp1",data);
> renderMyMovie("comp1","./todaysHeadlines.mov");
> app.quit();

And I want to run it something like:

> afterEffects --script="./myScript.jsx"

I must be thick. But. What is the incantation for this?
TOPICS
Scripting

Views

5.7K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Apr 08, 2009 Apr 08, 2009

Copy link to clipboard

Copied

Hi David,

On Win, you'd run this from the command line:

afterfx.exe -noui -r c:\myDocuments\Scripts\yourAEScriptHere.jsx

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 03, 2010 Dec 03, 2010

Copy link to clipboard

Copied

And you can even specify the file of the project (composition = *.aep)?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 28, 2011 Apr 28, 2011

Copy link to clipboard

Copied

Zac,

Where are the switches documented for the afterfx.exe program?  So far, I know -s -r -m and now I've learned -noui.  Are there any more? If so, where can I find them?

Thanks!

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 05, 2011 Dec 05, 2011

Copy link to clipboard

Copied

Are the switches to afterfx.exe documented anywhere?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Dec 07, 2011 Dec 07, 2011

Copy link to clipboard

Copied

Hi Lazlo,

The other one is -wf for Watch Folder mode, documented here: http://help.adobe.com/en_US/aftereffects/cs/using/WS3878526689cb91655866c1103a4f2dff7-79a2a.html#WS6...

Message was edited by: Zac Lam

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 11, 2016 Feb 11, 2016

Copy link to clipboard

Copied

Hi Zac, Lazlo is there anywhere I can read about these flags... and reasons to use afterfx.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

afterfx.exe

-m   ?

-n   ?

-s  [send text string to execute as script]

-r  [read a .jsx file and execute]

-wf  [watch folder]

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 25, 2018 Apr 25, 2018

Copy link to clipboard

Copied

LATEST

Using AfterFX.com instead of AfterFX.exe allows you to get return codes on the command line for errors. I don't remember now if they are useful beyond "oh, yep, there was an error" but you don't get anything from the exe.

-m starts a new instance of After Effects even if one is already running.

I have a shell/batch script that does the script generation in my %TEMP% directory, if you're going to be doing a lot of automated stuff you may want to use app.beginSuppressDialogs() and app.endSuppressDialogs() judiciously. In my case I basically spit out a jsx that has a function in it that then gets called once per file in the directory; the function itself is fixed but I just write it out so I don't need to import anything.

Going down this route though, After Effects is really bad about memory. You can tell it to clean itself up and that helps but if you're processing a lot of AEP files during one run of After Effects you're going to run out of memory. I can usually get 10-15 app.open(new File(filename)) calls before crashing, so that's another thing you have to keep in mind.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 12, 2015 Aug 12, 2015

Copy link to clipboard

Copied

I have a file named After-Effects-CS6-Scripting-Guide.pdf. I have no recollection about where it came from. It documents the scripting interface to After Effects, though.

Also, look at installing the ExtendScript SDK. It has a somewhat useful debugger and object inspector for scripting Adobe products, including After Effects.

Insofar as what you want to do there are three ways that I can think to do it.

Write a plugin using the ExtendScript SDK and pass a short stub script to After Effects on the command line:

afterfx.com -noui -m -s "var lib=new ExternalObject('lib:YourPlugin.aex');lib.YourFunction('param1', 'param2', etc);app.quit();"

Generate your script with the filenames already baked into it; this should be straight forward but it's annoying since you get all of these scripts lying around...

afterfx.com -noui -m -r my_generated_script.jsx


Figure out how to write the script once then import it and call functions on it from the command line:

afterfx.com -noui -m -s "import_or_something myScript;myFunction('param1', 'param2', etc);app.quit();"

I don't know if this last one is possible, thankfully I haven't had cause to try it yet since my first foray into this stuff was pretty heavily based on plugin interaction, I took route #1 at first. Now I have a couple of things that pretty mechanically do #2 and there's not enough boilerplate to try to figure out #3.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 21, 2016 Feb 21, 2016

Copy link to clipboard

Copied

The AE scripting guide can be downloaded here: After Effects Developer Center | Adobe Developer Connection

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines