After Effects via ExtendScript
Drive After Effects by writing ExtendScript (.jsx) and running it. Use computer use only to launch scripts and to verify with screenshots — clicking through AE by hand is slow and fragile.
0. Preconditions
- After Effects is installed. If not, say so in one line and offer the same result with
prompt-motion, Remotion or Blender. - Paths (Windows):
C:\Program Files\Adobe\Adobe After Effects <YEAR>\Support Files\AfterFX.exe; the rendereraerender.exeis in the same folder. - One-time setting: Edit → Preferences → Scripting & Expressions → enable Allow Scripts to Write Files and Access Network.
- A work folder for
.jsx, assets and renders (e.g.~/Videos/AE-Claude).
1. Workflow
- Write the
.jsxfile into the work folder. - Run it: in AE, File → Scripts → Run Script File…, or from a terminal:
"…\AfterFX.exe" -r "C:\…\script.jsx"(opens AE if closed). - Screenshot to verify; fix and rerun.
- Render: add to the Render Queue in the script and call
app.project.renderQueue.render(), or from a terminal:aerender.exe -project "x.aep" -comp "Main" -output "out.mp4".
2. Script template
(function () {
app.beginUndoGroup("Claude build");
var proj = app.project || app.newProject();
var comp = proj.items.addComp("Main", 1920, 1080, 1, 10, 30);
comp.layers.addSolid([0.05, 0.05, 0.08], "BG", 1920, 1080, 1);
var t = comp.layers.addText("Hello");
var td = t.property("Source Text").value;
td.fontSize = 140; td.fillColor = [1, 1, 1]; td.justification = ParagraphJustification.CENTER_JUSTIFY;
t.property("Source Text").setValue(td);
var pos = t.property("Transform").property("Position");
pos.setValueAtTime(0, [960, 1200]);
pos.setValueAtTime(1, [960, 540]);
var ease = new KeyframeEase(0, 75);
for (var k = 1; k <= pos.numKeys; k++) pos.setTemporalEaseAtKey(k, [ease], [ease]);
var op = t.property("Transform").property("Opacity");
op.setValueAtTime(0, 0); op.setValueAtTime(0.6, 100);
comp.openInViewer();
proj.save(new File("~/Videos/AE-Claude/project.aep"));
var rq = proj.renderQueue.items.add(comp);
rq.outputModule(1).file = new File("~/Videos/AE-Claude/out.mp4");
app.endUndoGroup();
})();
3. Rules
- Always wrap code in an IIFE + an undo group.
- Use effect match names (
"ADBE Gaussian Blur 2","ADBE Glo2"), not display names — AE may be localized. - Expressions:
prop.expression = "wiggle(2,20)"; - Output-module templates vary by version: list
rq.outputModule(1).templatesbeforeapplyTemplate. H.264 MP4 is native in AE 2023+. - ExtendScript is ES3: no
let,const, arrow functions or template strings. - Never sign in to Adobe, start a trial or buy anything for the user.