AfterEffects

Work with scripts

A script is a series of commands that tells an application to perform a series of operations. You can use scripts in most Adobe applications to automate repetitive tasks, perform complex calculations, and even access some functionality not directly exposed through the graphical user interface. For example, you can direct After Effects to reorder the layers in a composition, find and replace source text in text layers, or send an e-mail message when rendering is complete.

After Effects scripts use the Adobe ExtendScript language, which is an extended form of JavaScript, similar to ActionScript. ExtendScript files have the .jsx filename extension.

When After Effects starts, it searches the Scripts folder for scripts to load. Loaded scripts are available from the File > Scripts menu. If you edit a script while After Effects is running, you must save your changes for the changes to be applied. If you place a script in the Scripts folder while After Effects is running, you must restart After Effects for the script to appear in the Scripts menu, though you can immediately run the new script using the Run Script File command.

After Effects provides several prewritten scripts to assist you in performing common tasks, and to provide a basis for you to modify and create your own scripts.

Run the sample script DemoPalette.jsx to get an idea of what sorts of things you can do with scripts. For example, the Reverse Layer Order script makes reversing the stacking order of layers in the Timeline panel much easier than reordering the layers manually.

You can write your own scripts for use in After Effects by using the script editor, which is part of the ExtendScript Toolkit. The ExtendScript Toolkit provides a convenient interface for creating, debugging, and testing your own scripts.

Note: Scripts created in After Effects 6.5 or earlier that use an index to access a property may not work as expected in After Effects 7 or later. To resolve this issue, modify your scripts so that they contain equivalent expressions accessing properties by name.

The default is for scripts to not be allowed to write files or send or receive communication over a network. To allow scripts to write files and communicate over a network, choose Edit > Preferences > General (Windows) or After Effects > Preferences > General (Mac OS), and select the Allow Scripts To Write Files And Access Network option.

  • To run a loaded script, choose File > Scripts > [script name]
  • To run a script that has not been loaded, choose File > Scripts > Run Script File, locate and select a script, and click Open.
  • To start the script editor, choose File > Scripts > Open Script Editor.

For a complete description of the scripting capabilities available with After Effects, see the After Effects Scripting Guide on the Adobe website at www.adobe.com/go/learn_ae_indepth.

To exchange scripts and other useful tools with other After Effects users, visit the After Effects Exchange on the Adobe website at www.adobe.com/go/learn_ae_exchange.