View comments | RSS feed

After Effects CS3  |  Go to CS4 Help

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 file-name 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/devnet/aftereffects.

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.

Jeff Almasol provides a collection of useful scripts on his website: www.adobe.com/go/learn_ae_redefineryhome.

Dan Ebberts provides scripting tutorials and useful scripts on his website: www.adobe.com/go/learn_ae_danscripting.

The AE Enhancers forum provides example scripts and useful information about scripting (as well as expressions and animation presets) in After Effects: www.adobe.com/go/learn_ae_aeenhancershome.

This tutorial on the AE Enhancers forum leads the reader step by step through the creation of a script: www.adobe.com/go/learn_ae_aeenhancersgettingstarted.


Comments

Comments are no longer accepted for After Effects CS3. After Effects CS4 is the current version. To discuss After Effects CS3, please use the Adobe forum.

Comments


Todd_Kopriva said on Dec 10, 2007 at 6:53 PM :
You can run a script by calling afterfx.exe from the command line, with the script as an argument. This does not open a new instance of the After Effects application; it runs the script in the existing instance.

Use the -r switch and the full path of the script to run. Example:

afterfx -r c:\script_path\save_and_increment.jsx

You can use this---together with the software that comes with a customizable keyboard---to bind the invocation of a script to a particular key combination.
Todd_Kopriva said on Dec 29, 2007 at 1:05 PM :
Jeff Almasol provides a script that creates a panel that makes running scripts much more convenient:
http://www.redefinery.com/ae/view.php?item=rd_ScriptLauncher

A similar extension is the LaunchPad script, which allows you to create buttons with which to run scripts. This makes running commonly used scripts very quick and easy.
http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1242019
Todd_Kopriva said on Dec 29, 2007 at 1:13 PM :
Jeff Almasol provides a script that creates a simple console panel. The console panel includes a text area in which you can enter JavaScript commands that will be evaluated. There is no capturing of errors or messages — this console is just a simple way of entering commands without having to create a script first.

http://www.redefinery.com/ae/view.php?item=rd_SimpleConsole
Todd_Kopriva said on Dec 29, 2007 at 1:28 PM :
Jeff Almasol provides a set of scripting utilities (such as useful functions) that you can use to make creating your own scripts much easier:
http://www.redefinery.com/ae/view.php?item=rd_utilities

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/en_US/AfterEffects/8.0/WS625657CC-5CCA-41ef-A1C7-055D2557AE56.html