execute-script
Run any ExtendScript code in Adobe After Effects to automate tasks like creating masks, adjusting 3D layers, or batch editing layers. Returns JSON-serializable results for integration.
Instructions
Run ARBITRARY ExtendScript (the After Effects scripting DOM) inside After Effects and return the result. This is the most powerful tool: use it for anything the dedicated tools do not cover - masks, track mattes, parenting, 3D layers/cameras/lights, blending modes, precomposing, time remapping, layer styles, text animators, puppet pins, importing/replacing footage, batch edits across many layers, project-wide changes, etc. Your code runs as the body of a function, so use return <value>; to send data back, and return only JSON-serializable values (numbers, strings, arrays, plain objects). The whole script already runs inside one undo group, so do NOT call app.beginUndoGroup yourself. Use app and app.project to reach everything. On error you get back the message and line number. Example script: "var c = app.project.activeItem; return { name: c.name, layers: c.numLayers };"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | ExtendScript code to execute. Runs as a function body; use 'return value;' to return JSON-serializable data. Do not call app.beginUndoGroup (handled automatically). | |
| timeoutMs | No | How long to wait for the result, in milliseconds (default 60000). Increase for long-running scripts. |