Macromedia After Effects - CS3 User Manual

SCRIPTING GUIDE
© Copyright 2007 Adobe Systems Incorporated. All rights reserved.
®
Adobe
Creative Suite 3 After Effects® Scripting Guide
NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written consent of Adobe Systems Incorporated. The software described in this document is furnished under license and may only be used or copied in accordance with the terms of such license.
This publication and the information herein is furnished AS IS, is subject to change without notice, and should not be construed as a commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies, makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and all warranties of merchantability, fitness for particular purposes, and noninfringement of third party rights.
Any references to company names in sample templates are for demonstration purposes only and are not intended to refer to any actual organization.
Adobe, the Adobe logo, After Effects, Photoshop, and Bridge are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Apple, Mac, Macintosh, and Mac OS are trademarks of Apple Computer, Inc., registered in the United States and other countries. Microsoft, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. JavaScript and all Java-related marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. UNIX is a registered trademark of The Open Group.
All other trademarks are the property of their respective owners.
If this guide is distributed with software that includes an end user agreement, this guide, as well as the software described in it, is furnished under license and may be used or copied only in accordance with the terms of such license. Except as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written permission of Adobe Systems Incorporated. Please note that the content in this guide is protected under copyright law even if it is not distributed with software that includes an end user license agreement.
The content of this guide is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies that may appear in the informational content contained in this guide.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.

Overview

The After Effects Scripting Guide demonstrates how to take procedural control of your After Effects projects via scripting. This feature set is available in Adobe® After Effects® CS3 Professional Edition.
With the use of system-level scripting, you can streamline your render pipeline and avoid a lot of repetitive pointing and clicking. If you have used expressions or other JavaScript-like techniques for animating, or worked with system scripting in AppleScript or Visual Basic, you will recognize the power of application scripting in After Effects. With some practice, and with sufficient experience using the JavaScript language, you can take control of your graphics pipeline.

If you are new to scripting

After Effects is a visual tool with a graphical user interface; you are used to interacting with it via interface elements such as menus, panels, and icons. For the most part, this is the most accessible way to work. Scripting is designed for situations in which this methodology involves tedious repetition or painstaking searching and sorting that could be automated. Scripting can be a shortcut around tedious tasks that would otherwise involve repetitious pointing and clicking. It is also useful for leveraging the power of networked rendering in situations where Watch Folder is less powerful (and less convenient to set up). See “Examples” on page 173 for examples of what scripts can do.
If you are new to scripting, see Adobe Introduction to Scripting, which introduces basic scripting concepts and describes different scripting languages that are available, including JavaScript. JavaScript and other scripting languages are object-oriented, and this book also describes the basic concepts of object-oriented programming and document object models.
Even if you have no inclination to learn the JavaScript language, you can still harness the power of scripting via third-party solutions such as Rush Network Render Queue, a graphical user interface to set up distributed renders from any computer on the network without having to set up on individual machines.
You can also leverage the contributions of scripting users who share scripts with other users. Larger studios may have such users in-house, while other users can visit forums such as those found at
www.adobeforums.com.

About this guide

This guide is for users who manage a graphics pipeline (which may include other scriptable applications as well) and who want to write scripts to add custom capabilities to After Effects.
This functionality is also offered via third-party network rendering management solutions. These products feature software designed to help manage this process, so it is possible to take advantage of this functionality without having to perform manual editing of scripts.
3
Overview Editing scripts
4
The heart of a scriptable application is the object model. When you use Adobe After Effects, you create projects, compositions, and render-queue items along with all of the elements that they contain: footage, images, solids, layers, masks, effects, and properties. Each of these items, in scripting terms, is an object. This guide describes the JavaScript objects that have been defined for After Effects projects.
Much of what scripting can accomplish replicates what can be done via the After Effects user interface, so a thorough knowledge of the application itself is also essential to understanding how to use this functionality.
The After Effects object model is composed of a project, items, compositions, layers, and render-queue items. Each object has its own special attributes, and every object in an After Effects project has its own identity (although not all are accessible to scripting). You should be familiar with the After Effects object model in order to create scripts.
After Effects scripting is based on ECMAScript (or more specifically, the 3rd Edition of the ECMA-262 Standard). Further documentation on this standard can be found at www.ecma-international.org. To take full advantage of what is possible with scripting you will also need an understanding of writing scripts at the system level (for integration with AppleScript or the Terminal command line in Mac OS and command-line scripts on Windows systems) and a background in how to work with JavaScript.
NOTE: JavaScript objects normally referred to as “properties” are consistently called “attributes” in this guide, to avoid confusion with After Effects’ own definition of a property (an animatable value of an effect, mask, or transform within an individual layer).

Expressions

Although both After Effects expressions and the After Effects scripting interface use JavaScript and can access individual layer properties, they are entirely distinct entities. Expressions cannot access information from scripts (such as variables and functions), although a script can be written to create or edit an expression.
Because both expressions and scripting use JavaScript, familiarity with either one is helpful in understanding the other.

Motion math

Motion math is no longer included in After Effects; its functionality has been superseded by scripting and expressions. All mathematical and logical operators common to ECMAScript are available in scripting.
For example, with expressions it is possible to simulate the physics of a bouncing ball by applying mathe­matical rules to a “ball” layer. But using scripting, you can create a whole user interface that allows a bouncing ball and shadow layer to be animated using criteria entered by the user.

Editing scripts

After Effects includes a JavaScript editor. To start it, choose File > Scripts > Open Script Editor. This script editor and debugger, called the ExtendScript Toolkit, provides a convenient interface for creating and testing your own scripts.
You can use any text editor to create, edit, and save scripts, but it is recommended that you choose an appli­cation that does not automatically add header information when saving files and that saves with Unicode (UTF-8) encoding.
Windows applications that are useful for editing scripts include EM Editor or the built-in Notepad (be sure
to set Encoding within save options to UTF-8).
Mac OS applications that are useful for editing scripts include BBEdit or the built-in OS X TextEdit (be sure
to set the Save type in Preferences to Unicode [UTF-8]).
4
Overview Activating full scripting features
5

The ExtendScript JSX format

After Effects supports ExtendScript, Adobe’s extended implementation of JavaScript. ExtendScript is used by all Adobe applications that provide a scripting interface. In addition to implementing the JavaScript language according to the ECMA 262 and E4X ECMA 357 specifications, ExtendScript provides certain additional features and utilities:
ExtendScript Toolkit: For help in developing, debugging, and testing scripts, ExtendScript provides an inter-
active development and testing environment, the ExtendScript Toolkit. It also defines a global debugging object, the dollar ($) object, and a reporting utility for ExtendScript elements, the ExtendScript Reflection interface.
File and Folder Objects: Because path name syntax is very different in different operating systems, Adobe
ExtendScript defines system.
ScriptUI User Interface Module: The ExtendScript ScriptUI module provides the ability to create and interact
with user interface elements. ScriptUI provides an object model for windows and UI control elements that you can use to create a user interface for your scripts.
Tools and Utilities: In addition, ExtendScript provides tools and features such as a localization utility for
providing user-interface string values in different languages and global functions for displaying short messages in dialog boxes (
File and Folder objects to provide platform-independent access to the underlying file
alert, confirm, and prompt).
Interapplication Communication: ExtendScript provides a common scripting environment for all Adobe
applications, and allows interapplication communication through scripts.
External Communication: ExtendScript provides a Socket object that allows you to communicate with remote
systems from your After Effects scripts.
These features and more are described in detail in the JavaScript Tools Guide, which is available with After Effects, and from partners.adobe.com
ExtendScript script files are distinguished by the used with standard JavaScript files. After Effects scripts must include the properly recognized by the application. Any UTF-8 encoded text file with the
.
.jsx file extension, a variation on the standard .js extension
.jsx file extension in order to be
.jsx extension is recognized as
an ExtendScript file.
You can use the ExtendScript Toolkit to export a binary version of an ExtendScript file, which has the extension
.jsxbin. Such a binary file may not be usable with all of the scripting integration features in After
Effects.

Activating full scripting features

For security reasons, the scripting features that operate outside the After Effects application (such as adding and deleting files and folders on volumes, or accessing the network) are disabled by default.
To enable these features, choose Preferences > General, and select “Allow Scripts To Write Files And Access Network.” This allows you to:
Write to files
Create folders and set the current folder
Create a socket connection (for details of this JavaScript utility, see the JavaScript Tools Guide)
5
Overview Accessing and writing scripts
6
Adobe supplies a full-featured JavaScript debugger, called the ExtendScript Toolkit. The Toolkit is disabled by default so that casual users do not encounter it. When editing or writing scripts, the Toolkit can help you diagnose script problems more quickly. To activate the Toolkit on the local computer when a script error is encountered, choose Preferences > General, and select Enable JavaScript Debugger. For detailed information on the ExtendScript Toolkit, see the JavaScript Tools Guide.
Note that the Toolkit operates only when executing a script, not with expressions, even though expressions also make use of JavaScript.

Accessing and writing scripts

To create and edit scripts for After Effects, you can use the ExtendScript Toolkit, or an external text-editing application that creates files with Unicode UTF-8 text encoding. Beware of applications such as Microsoft Word that by default add header information to files; these create line 0 errors in scripts, causing them to fail.
A script can reside anywhere, although to appear in the Scripts menu it must be saved in the Scripts folder within the After Effects application folder.
There is no built-in method for recording a series of actions in After Effects into a script, as you can with Adobe Photoshop® actions. Scripts are created outside After Effects and then executed within it, or externally via a command-line, the ExtendScript Toolkit, or third-party render management software.

The Scripts menu and Scripts folder

After Effects scripts reside in the Scripts folder, within the same folder as your After Effects application file. Only scripts contained in this Scripts folder when the application starts are automatically listed in the Scripts menu, although a script file can reside anywhere.
To run a script that does not appear in the Scripts menu, choose File > Scripts > Run Script File, and choose the script in the Open dialog box. Alternatively, you can send After Effects a script from the ExtendScript Toolkit, from a command line (on Windows) or from AppleScript (on Mac OS).
To appear in the Open dialog box, your script must include the proper
.jsx file extension.

Shutdown and Startup folders

Within the Scripts folder are two folders called Startup and Shutdown. After Effects runs scripts in these folders automatically, in alphabetical order, on starting and quitting, respectively.
In the Startup folder you can place scripts that you wish to execute at startup of the application. They are executed after the application is initialized and all plug-ins are loaded.
Scripting shares a global environment, so any script executed at startup can define variables and functions that are available to all scripts. In all cases, variables and functions, once defined by running a script that contains them, persist in subsequent scripts during a given After Effects session. Once the application is quit, all such globally defined variables and functions are cleared. Be sure to give variables in scripts unique names, so that a script does not inadvertently reassign global variables intended to persist throughout a session.
Attributes can also be added to existing objects such as the Application object (see “Application object” on page 19) to extend the application for other scripts.
The Shutdown folder scripts are executed as the application quits. This occurs after the project is closed but before any other application shutdown occurs.
6
Overview Sending a script to After Effects from the system
7

The Window menu and ScriptUI Panels folder

Within the Scripts folder, you can create another folder named ScriptUI Panels. Use this folder for scripts whose user interface appears in a native panel (as opposed to a floating palette, dialog box, or window). The advantage of a panel is that it can be docked with other panels, such as Project, Composition, and Time Controls, and appear more integrated into the application. Like native panels, ScriptUI Panels scripts are accessed from the Window menu.
Instead of creating a Window object an adding controls to it, a ScriptUI Panels scr ipt u ses the "thi s" o bjec t th at represents the panel. For example, the following code adds a button to a panel:
var myPanel = this;
myPanel.add("button", [10, 10, 100, 30], "Tool #1");
myPanel.show();
If your script creates its user interface in a function, you cannot use "this" as it will refer to the function itself, not the panel. In this case, you should pass the "this" object as an argument to your function. For example:
function createUI(thisObj) {
var myPanel = thisObj;
myPanel.add("button", [10, 10, 100, 30], "Tool #1");
return myPanel;
}
var myToolsPanel = createUI(this);
myToolsPanel.show();
You cannot use the File > Scripts > Run Script File menu command to run a script that refers to "this". To make your script work with either a Window object (accessible from the File > Scripts menu) or a native panel (accessible from the Window menu), check whether "this" is a Panel object. For example:
function createUI(thisObj) {
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "My Tools",
[100, 100, 300, 300]);
myPanel.add("button", [10, 10, 100, 30], "Tool #1");
return myPanel;
}
var myToolsPanel = createUI(this);
myToolsPanel.show();

Sending a script to After Effects from the system

If you are familiar with how to run a script from the command line in Windows or via AppleScript, you can se nd a s cri pt d irec tly to th e op en Af ter Effects application, so that the application automatically runs the script.

How to include After Effects scripting in a command line (Windows)

Following are examples of Windows command-line entries that will send an After Effects script to the appli­cation without using the After Effects user interface to execute the script.
In the first example, you copy and paste your After Effects script directly on the command line and then run it. The script text appears in quotation marks following the
afterfx.exe -s command:
afterfx.exe -s "alert("You just sent an alert to After Effects")"
7
Overview Testing and troubleshooting
8
Alternatively, you can specify the location of the JSX file to be executed. For example:
afterfx.exe -r c:\myDocuments\Scripts\yourAEScriptHere.jsx
afterfx.exe -r "c:\myDocuments\Scripts\Script Name with Spaces.jsx"

How to include After Effects scripting in an AppleScript (Mac OS)

Following are three examples of AppleScript scripts that will send an existing JSX file containing an After Effects script to the application without using the After Effects user interface to execute the script.
In the first example, you copy your After Effects script directly into the Script Editor and then run it. The script text appears within quotation marks following the DoScript command, so internal quotes in the script must be escaped using the backslash escape character, as follows:
tell application "Adobe After Effects CS3"
DoScript "alert(\"You just sent an alert to After Effects\")"
end tell
Alternatively, you could display a dialog box asking for the location of the JSX file to be executed, as follows:
set theFile to choose file
tell application "Adobe After Effects CS3"
DoScript theFile
end tell
Finally, this script is perhaps most useful when you are working directly on editing a JSX script and want to send it to After Effects for testing or to run. To use it effectively you must enter the application that contains the open JSX file (in this example it is TextEdit); if you do not know the proper name of the application, type in your best guess to replace “TextEdit” and AppleScript prompts you to locate it.
Simply highlight the script text that you want to run, and then activate this AppleScript:
(*
This script sends the current selection to After Effects as a script.
*)
tell application "TextEdit"
set the_script to selection as text
end tell
tell application "Adobe After Effects CS3"
activate
DoScript the_script
end tell
For more information on using AppleScript, check out Matt Neuberg’s AppleScript: the Definitive Guide (O’Reilly & Associates) or Sal Soghoian’s AppleScript 1-2-3 (Peachpit Press).

Testing and troubleshooting

Any After Effects script that contains an error preventing it from being completed generates an error message from the application. This error message includes information about the nature of the error and the line of the script on which it occurred.
8
Overview More resources to learn scripting
9
Additionally, After Effects includes a JavaScript debugger. For more information on activating and using the debugger, see the ExtendScript Toolkit documentation in the JavaScript Tools Guide.

More resources to learn scripting

Many resources exist for learning more about scripting that uses the ECMA standard.
The After Effects scripting engine supports the 3rd Edition of the ECMA-262 Standard, including its notational and lexical conventions, types, objects, expressions, and statements.
For a complete listing of the keywords and operators included with ECMAScript, refer to ECMA-262.pdf, available at
Books that deal with JavaScript 1.2 are also useful for understanding how scripting works in After Effects. One book that is something of a standard for JavaScript users is JavaScript: The Definitive Guide (O’Reilly) by David Flanagan. Another very readable source is JavaScript: A Beginner’s Guide (Osborne) by John Pollock. Both of these texts contain information that pertains only to extensions of JavaScript for Internet browsers; however, they also contain thorough descriptions of scripting fundamentals.
There are also books for using AppleScript and creating Windows command line scripts, each of which can be used to send scripts to After Effects.
www.ecma-international.org/publications/standards/Ecma-262.htm .

JavaScript variables

Scripting shares a global environment, so any script executed at startup can define variables and functions that are available to all scripts. In all cases, variables and functions, once defined by running a script that contains them, persist in subsequent scripts during a given After Effects session. Once the application is quit, all such globally defined variables and functions are cleared. Scripters should be careful about giving variables in scripts unique names, so that a script does not inadvertently reassign global variables intended to persist throughout a session.

JavaScript keywords and statement syntax

Although it is not possible to provide an exhaustive resource describing usage of JavaScript, the following tables provide an overview of keywords, statements, operators, precedence, and associativity.
The following table lists and describes all keywords and statements recognized by the After Effects scripting engine.
Table 1 Keywords and Statement Syntax
Keyword/Statement Description
break
continue
case
default
Standard JavaScript; exit the currently executing loop.
Standard JavaScript; cease execution of the current loop iteration.
Label used in a switch statement.
Label used in a switch statement when a case label is not found.
do...while
false
for
for...in
Standard JavaScript construct. Similar to the while loop, except loop condition evaluation occurs at the end of the loop.
Literal representing the boolean false value.
Standard JavaScript loop construct.
Standard JavaScript construct. Provides a way to easily loop through the properties of an object.
9
Overview More resources to learn scripting
10
Keyword/Statement Description
function
if/if...else
new
null
return
switch
this
true
undefined
var
while
with
Used to define a function.
Standard JavaScript conditional constructs.
Standard JavaScript constructor statement.
Assigned to a variable, array element, or object property to indicate that it does not contain a legal value.
Standard JavaScript way of returning a value from a function or exiting a function.
Standard JavaScript way of evaluating a JavaScript expression and attempting to match the expres­sion’s value to a case label.
Standard JavaScript method of indicating the current object.
Literal representing the boolean true value.
Indicates that the variable, array element, or object property has not yet been assigned a value.
Standard JavaScript syntax used to declare a local variable.
Standard JavaScript construct. Similar to the do...while loop, except loop condition evaluation occurs at the beginning of the loop.
Standard JavaScript construct used to specify an object to use in subsequent statements.

JavaScript operators

The following tables list and describe all operators recognized by the After Effects scripting engine and show the precedence and associativity for all operators.
Table 2 Description of Operators
Operators Description
new
delete
typeof
void
.
[]
()
++
––
~
!
*
/
%
Allocate object.
Deallocate object.
Returns data type.
Returns undefined value.
Structure member.
Array element.
Function call.
Pre- or post-increment.
Pre- or post-decrement.
Unary negation or subtraction.
Bitwise NOT.
Logical NOT.
Multiply.
Divide.
Modulo division.
10
Overview More resources to learn scripting
11
Operators Description
+
<<
>>
>>>
<
<=
>
>=
==
!=
&
^
|
&&
||
?:
=
Add.
Bitwise left shift.
Bitwise right shift.
Unsigned bitwise right shift.
Less than.
Less than or equal.
Greater than.
Greater than or equal.
Equal.
Not equal.
Bitwise AND.
Bitwise XOR.
Bitwise OR.
Logical AND.
Logical OR.
Conditional (ternary).
Assignment.
+=
–=
*=
/=
%=
<<=
>>=
>>>=
&=
^=
|=
,
Assignment with add operation.
Assignment with subtract operation.
Assignment with multiply operation.
Assignment with divide operation.
Assignment with modulo division operation.
Assignment with bitwise left shift operation.
Assignment with bitwise right shift operation.
Assignment with unsigned bitwise right shift operation.
Assignment with bitwise AND operation.
Assignment with bitwise XOR operation.
Assignment with bitwise OR operation.
Multiple evaluation.
Table 3 Operator Precedence
Operators (highest precedence to lowest) Associativity
[], (), .
left to right
new, delete, – (unary negation), !, typeof, void, ++, ––
right to left
11
Overview More resources to learn scripting
12
Operators (highest precedence to lowest) Associativity
*, /, %
+, – (subtraction)
<<, >>, >>>
<, <=, >, >=
==, !=
&
^
|
&&
||
?:
=, /=, %=, <<=, >>=, >>>=, &=, ^=, |=, +=, –=, *=
,
left to right
left to right
left to right
left to right
left to right
left to right
left to right
left to right
left to right
left to right
right to left
right to left
left to right
12

JavaScript Reference

APPLICATION
PROJECT
SETTINGS
RENDER1UEUE ITEMS
ITEMSMAYBEANYOFTHEFOLLOWINGTYPESOFITEM
ITEMS
RENDER1UEUE)TEMS
OUTPUT-ODULES
SOCKETFILE FOLDERSYSTEM
FOLDER)TEMFOOTAGE)TEM
PROXY3OURCE PROXY3OURCEMAIN3OURCE
SOLID3OURCE
COLOR
FILE3OURCE
FILE
PLACEHOLDER3OURCE
LAYERS
PROPERTIES
COMP)TEM
/2
/2
/2
/2
MAIN3OURCEPROXY3OURCE
MAYBEANYOFTHEFOLLOWINGTYPESOFITEM
This chapter lists and describes JavaScript classes, objects, methods, attributes, and global functions defined by After Effects.
The After Effects scripting engine supports ExtendScript, Adobe’s extended version of JavaScript, which imple­ments the 3rd Edition of the ECMA-262 Standard, including its notational and lexical conventions, types, objects, expressions and statements. For a complete listing of the keywords and operators included with ECMAScript, refer to
Ecma-262.htm. For an overview of the most common keywords and statements available from ECMA-262,
see “JavaScript keywords and statement syntax” on page 9.

The After Effects Object Model

As you look through this reference section, which is organized alphabetically by object, you can refer to the following diagrams for an overview of where the various objects fall within the hierarchy, and their correspon­dence to the user interface.
ECMA-262.pdf, available at www.ecma-international.org/publications/stan dards/
Hierarchy diagram of the main After Effects scripting objects
Note that the File, Folder, and Socket objects are defined by ExtendScript, and are documented in the JavaS­cript Tools Guide. ExtendScript also defines the ScriptUI module, a set of window and user-interface control
objects, which are available to After Effects scripts. These are also documented in the JavaScript Tools Guide.
The hierarchy of objects in scripting corresponds to the hierarchy in the user interface.
13
JavaScript Reference The After Effects Object Model
14
The application contains a Project panel, which displays a project. The project contains compositions, which contain layers. The source for a layer can be a footage file, placeholder, or solid, also listed in the Project panel. Each layer contains settings known as properties, and these can contain markers and keyframes. The render queue contains render-queue items as well as render settings and output modules. All of these entities are repre­sented by objects in scripting.
NOTE: To avoid ambiguity, this manual uses the term “attribute” to refer to JavaScript object properties, and the term “property” or “AE property” to refer to After-Effects layer properties.

Object summary

The following table lists all objects alphabetically, with links to the documentation page for each.
Object Description
“Global functions” on page 16 Globally available functions that allow you to display text for script debugging purposes,
“Application object” on page 19 A single global object, available by its name (app), that provides access to objects and
“AVItem object” on page 32 Represents audio/visual files imported into After Effects.
“AVLayer object” on page 39 Represents those layers that contain AVItem objects (Comp layers, footage layers, solid
“CameraLayer object” on page 50 Represents a camera layer within a composition.
“Collection object” on page 51 Associates a set of objects or values as a logical group and provides access to them by
and help convert time values between seconds and frames.
application settings within the After Effects application.
layers, text layers, and sound layers).
index.
“CompItem object” on page 52 Represents a composition, and allows you to manipulate it and get information about it.
14
JavaScript Reference The After Effects Object Model
15
Object Description
“FileSource object” on page 60 Describes footage that comes from a file.
“FolderItem object” on page 62 Represents a folder in the Project panel.
“FootageItem object” on page 64 Represents a footage item imported into a project, which appears in the Project panel.
“FootageSource object” on page 67 Describes the file source of some footage.
“ImportOptions object” on page 73 Encapsulates options for importing files into After Effects.
“Item object” on page 76 Represents an item in a project that appears in the Project panel.
“ItemCollection object” on page 79 Collects items in a project.
“KeyframeEase object” on page 81 Encapsulates keyframe ease values in an After Effects property.
“Layer object” on page 83 A base class for layer classes.
“LayerCollection object” on page 92 Collects layers in a project.
“LightLayer object” on page 97 Represents a light layer within a composition.
“MarkerValue object” on page 98 Encapsulates marker values in an AE property.
“MaskPropertyGroup object” on page 102
“OMCollection object” on page 104 Collects output modules in a render queue.
“OutputModule object” on page 105 Represents an output module for a render queue.
“PlaceholderSource object” on page 108 Describes a placeholder for footage.
“Project object” on page 109 Represents an After Effects project.
“Property object” on page 118 Represents an After Effects property.
“PropertyBase object” on page 140 A base class for After Effects property and property group classes.
“PropertyGroup object” on page 147 Represents an After Effects property group.
“RenderQueue object” on page 152 Represents the After Effects render queue.
“RenderQueueItem object” on page 155 Represents a renderable item in a render queue.
“RenderQueueItem object” on page 155 Collects render-queue items in a render queue.
“RQItemCollection object” on page 161 Provides access to application settings and preferences.
“Shape object” on page 164 Encapsulates the outline shape information for a mask.
“ShapeLayer object” on page 167 Represents a shape layer within a composition.
“SolidSource object” on page 168 Describes a solid color that is the source of some footage.
“System object” on page 169 Provides access to the operating system from the application.
“TextDocument object” on page 171 Encapsulates the text in a text layer.
Encapsulates mask attributes in a layer.
“TextLayer object” on page 172 Represents a text layer within a composition.
15
JavaScript Reference Global functions
16

Global functions

These globally available functions that are specific to After Effects. Any JavaScript object or function can call these functions, which allow you to display text in a small (3-line) area of the Info panel, and to convert numeric time values to and from string values.
Global function Description
clearOutput()
currentFormatToTime()
timeToCurrentFormat()
write()
writeLn()
Additional global functions for standard user I/O (
Clears text from the Info panel.
Converts string time value to a numeric time value.
Converts a numeric time value to a string time value.
Writes text to the Info panel, with no line break added.
Writes text to the Info panel, adding a line break at the end.
alert, confirm, and prompt) and static functions for file
I/O, are defined by ExtendScript; for detailed reference information, see the Adobe Bridge® JavaScript
Reference.
NOTE: The After Effects global functions for standard dialogs and file I/O are still supported in this release, but are deprecated and will not be supported in future releases. For details, see the After Effects 6.5 documentation.

clearOutput() global function

clearOutput()
Description
Clears the output in the Info panel.
Parameters
None.
Returns
Nothing.

currentFormatToTime() global function

currentFormatToTime(formattedTime, fps, isDuration)
Description
Converts a formatted string for a frame time value to a number of seconds, given a specified frame rate. For example, if the formatted frame time value is 0:00:12 (the exact string format is determined by a project setting), and the frame rate is 24 fps, the time would be 0.5 seconds (12/24). If the frame rate is 30 fps, the time would be 0.4 seconds (12/30).
If the time is a duration, the frames are counted from 0. Otherwise, the frames are counted from the project’s starting frame (see “Project displayStartFrame attribute” on page 111).
Parameters
formattedTime
The frame time value, a string specifying a number of frames in the project’s current time display format.
16
JavaScript Reference Global functions
17
fps
isDuration
Returns
The frames-per-second, a floating-point value.
Optional. When true, the time is a duration (measured from frame 0). When false (the default), the time is measured from the project’s starting frame.
Floating-point value, the number of seconds.

timeToCurrentFormat() global function

timeToCurrentFormat(time, fps, isDuration)
Description
Converts a numeric time value (a number of seconds) to a frame time value; that is, a formatted string that shows which frame corresponds to that time, at the specified rate. For example, if the time is 0.5 seconds, and the frame rate is 24 fps, the frame would be 0:00:12 (when the project is set to Display Timecode). If the frame rate is 30 fps, the frame would be 0:00:15. The format of the timecode string is determined by a project setting.
If the time is a duration, the frames are counted from 0. Otherwise, the frames are counted from the project’s starting frame (see “Project displayStartFrame attribute” on page 111).
Parameters
time
fps
The number of seconds, a floating-point value.
The frames-per-second, a floating-point value.
isDuration
Returns
Optional. When true, the time is a duration (measured from frame 0). When false (the default), the time is measured from the project’s starting frame.
String in the project’s current time display format.

write() global function

write(text)
Description
Writes output to the Info panel, with no line break added.
Parameters
text
Returns
Nothing.
Example
write("This text appears in Info panel ");
write("with more on same line.");
The string to display. Truncated if too long for the Info panel.
17
JavaScript Reference Global functions
18

writeLn() global function

writeLn(text)
Description
Writes output to the Info panel and adds a line break at the end.
Parameters
text
Returns
The string to display.
Nothing.
Example
writeln("This text appears on first line");
writeln("This text appears on second line");
18
JavaScript Reference Application object
19

Application object

app
Description
Provides access to objects and application settings within the After Effects application. The single global object is always available by its name,
Attributes of the Application object provide access to specific objects within After Effects. Methods of the Application object can create a project, open an existing project, control Watch Folder mode, purge memory, and quit the After Effects application. When the After Effects application quits, it closes the open project, prompting the user to save or discard changes as necessary, and creates a project file as necessary.
Attributes
Attribute Reference Description
app.
project
language
version
buildName
buildNumber
isWatchFolder
isRenderEngine
settings
onError
exitCode
“Application project attribute” on page 28 and “Project object” on page 109
“Application language attribute” on page 24
“Application version attribute” on page 30
“Application buildName attribute” on page 21
“Application buildNumber attribute” on page 22
“Application isWatchFolder attribute” on page 24
“Application isRenderEngine attribute” on page 24
“Application settings attribute” on page 30 and “RQItemCollection object” on page 161
“Application onError attribute” on page 26
“Application exitCode attribute” on page 24
The current After Effects project.
The language in which the application is running.
The version number of the After Effects application.
The name of this build of the application.
The number of this build of the application.
When true, the local application is running in Watch Folder mode.
When true, the local After Effects application is running as a render engine.
Application settings that can be set via scripting.
A callback function that is called when an error occurs in the application.
A numeric status code used when executing a script externally (that is, from a command line or AppleScript). 0 if no error occurred. A positive number indicates an error that occurred while running the script.
exitAfterLaunchAndEval
saveProjectOnCrash
memoryInUse
“Application exitAfterLaunchAndEval attribute” on page 23
“Application saveProjectOnCrash attribute” on page 28
“Application memoryInUse attribute” on page 25
When true, the application remains open after running a script from the command line on Windows.
When true, the project is saved if the application closes unexpectedly.
Memory in use by this application.
19
JavaScript Reference Application object
20
Methods
Method Reference Description
newProject()
open()
quit()
watchFolder()
pauseWatchFolder()
endWatchFolder()
purge()
beginUndoGroup()
endUndoGroup()
beginSuppressDialogs()
endSuppressDialogs()
setMemoryUsageLimits()
“Application newProject() method” on page 25
“Application open() method” on page 26 Opens a project or an Open Project dialog box.
“Application quit() method” on page 28 Quits the application.
“Application watchFolder() method” on page 30
“Application pauseWatchFolder() method” on page 27
“Application endWatchFolder() method” on page 23
“Application purge() method” on page 28 Purges a targeted type of cached information
“Application beginUndoGroup() method” on page 21
“Application endUndoGroup() method” on page 22
“Application beginSuppressDialogs() method” on page 21
“Application endSuppressDialogs() method” on page 22
“Application setMemoryUsageLimits() method” on page 29
Creates a new project in After Effects.
Starts Watch Folder mode; does not return until Watch Folder mode is turned off.
Pauses a current watch-folder process.
Ends a current watch-folder process.
(replicates Purge options in the Edit menu).
Groups the actions that follow it into a single undoable step.
Ends an undo group; needed only when a script contains more than one undo group.
Begins suppression of dialogs in the user inter­face.
Ends suppression of dialogs in the user inter­face.
Sets memory usage limits as in the Memory & Cache preferences area.
setSavePreferencesOnQuit()
activate()
scheduleTask()
cancelTask()
parseSwatchFile()
“Application setSavePreferencesOnQuit() method” on page 29
“Application activate() method” on page 20 Brings the After Effects main window to the
“Application scheduleTask() method” on page 29
“Application cancelTask() method” on page 22
“Application parseSwatchFile() method” on page 27
Sets whether preferences are saved when the application is quit.
front of the screen.
Schedules a JavaScript script for delayed exe­cution.
Cancels a scheduled task.
Loads a color swatch from an Adobe Swatch Exchange (ASE) file.

Application activate() method

app.activate()
Description
Opens the application main window if it is minimized or iconified, and brings it to the front of the desktop.
Parameters
None.
20
JavaScript Reference Application object
21
Returns
Nothing.

Application beginSuppressDialogs() method

app.beginSuppressDialogs()
Description
Begins suppression of script error dialog boxes in the user interface. Use endSuppressDialogs() to resume the display of error dialogs. See “Application endSuppressDialogs() method” on page 22.
Parameters
None.
Returns
Nothing.

Application beginUndoGroup() method

app.beginUndoGroup(undoString)
Description
Marks the beginning of an undo group, which allows a script to logically group all of its actions as a single undoable action (for use with the Edit > Undo/Redo menu items). Use the
endUndoGroup() method to mark
the end of the group. (See “Application endUndoGroup() method” on page 22.)
beginUndoGroup() and endUndoGroup() pairs can be nested. Groups within groups become part of the
larger group, and will undo correctly. In this case, the names of inner groups are ignored.
Parameters
undoString
Returns
The text that will appear for the Undo command in the Edit menu (that is, “Undo <undoString>”)
Nothing.

Application buildName attribute

app.buildName
Description
The name of the build of After Effects being run, used internally by Adobe for testing and troubleshooting.
Type
String; read-only.
21
JavaScript Reference Application object
22

Application buildNumber attribute

app.buildNumber
Description
The number of the build of After Effects being run, used internally by Adobe for testing and troubleshooting.
Type
Integer; read-only.

Application cancelTask() method

app.cancelTask(taskID)
Description
Removes the specified task from the queue of tasks scheduled for delayed execution.
Parameters
taskID
Returns
An integer that identifies the task, as returned by app.scheduleTask().
Nothing.

Application endSuppressDialogs() method

app.endSuppressDialogs(alert)
Description
Ends the suppression of script error dialog boxes in the user interface. Error dialogs are displayed by default; call this method only if
beginSuppressDialogs() has previously been called. See “Application beginSuppress-
Dialogs() method” on page 21.
Parameters
alert
Returns
Boolean; when true, errors that have occurred following the call to beginSuppressDialogs() are displayed in a dialog box.
Nothing.

Application endUndoGroup() method

app.endUndoGroup()
Description
Marks the end of an undo group begun with the app.beginUndoGroup() method. You can use this method to place an end to an undo group in the middle of a script, should you wish to use more than one undo group for a single script.
If you are using only a single undo group for a given script, you do not need to use this method; in its absence at the end of a script, the system will close the undo group automatically.
22
JavaScript Reference Application object
23
Calling this method without having set a beginUndoGroup() method yields an error.
Parameters
None.
Returns
Nothing.

Application endWatchFolder() method

app.endWatchFolder()
Description
Ends Watch Folder mode.
Parameters
None
Returns
Nothing.
See also
“Application watchFolder() method” on page 30 “Application parseSwatchFile() method” on page 27 “Application isWatchFolder attribute” on page 24

Application exitAfterLaunchAndEval attribute

app.exitAfterLaunchAndEval
Description
This attribute is used only when executing a script from a command line on Windows. When the application is launched from the command line, the (from a file or from a string, respectively).
If this attribute is set to true, After Effects will exit after the script is run; if it is false, the application will remain open.
This attribute only has an effect when After Effects is run from the Windows command line. It has no effect in Mac OS.
Type
Boolean; read/write.
–r or –s command line flag causes the application to run a script
23
JavaScript Reference Application object
24

Application exitCode attribute

app.exitCode
Description
A numeric status code used when executing a script externally (that is, from a command line or AppleScript).
In Windows, the value is returned on the command line when After Effects was launched on the commands
line (using the
in Mac OS, the value is returned as the AppleScript DoScript result for each script.
In both Mac OS and Windows, the value is set to 0 ( ation. In the event of an error while the script is running, the script can set this to a positive integer that indicates what error occurred.
Type
Integer; read/write.
Example
app.exitCode = 2; //on quit, if value is 2, an error has occurred
afterfx or afterfx –m command), and a script was specified with the –r or –s option.
EXIT_SUCCESS) at the beginning of each script evalu-

Application isRenderEngine attribute

app.isRenderEngine
Description
True if After Effects is running as a render engine.
Type
Boolean; read-only.

Application isWatchFolder attribute

app.isWatchFolder
Description
True if the Watch Folder dialog box is currently displayed and the application is currently watching a folder for rendering.
Type
Boolean; read-only.

Application language attribute

app.language
Description
The language After Effects is running.
Type
A Language enumerated value; read-only. One of:
24
JavaScript Reference Application object
25
Language.ENGLISH
Language.FRENCH
Language.GERMAN
Language.ITALIAN
Language.JAPANESE
Language.SPANISH
Example
var lang = app.language;
if (lang == Language.ENGLISH)
alert("After Effects is running in English.");
else if (lang == Language.FRENCH)
alert("After Effects is running in French.");
else
alert("After Effects is not running in English or French.");

Application memoryInUse attribute

app.memoryInUse
Description
The number of bytes of memory currently used by this application.
Type
Number; read-only.

Application newProject() method

app.newProject()
Description
Creates a new project in After Effects, replicating the File > New > New Project menu command.
If the current project has been edited, the user is prompted to save it. If the user cancels out of the Save dialog box, the new project is not created and the method returns null. Use
tions.DO_NOT_SAVE_CHANGES)
to close the current project before opening a new one. See “Project
close() method” on page 111.
Parameters
None.
Returns
A new Project object, or null if no new project is created.
app.project.close(CloseOp-
Example
app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
app.newProject();
25
JavaScript Reference Application object
26

Application onError attribute

app.onError
Description
The name of a callback function that is called when an error occurs. By creating a function and assigning it to this attribute, you can respond to errors systematically; for example, you can close and restart the application, noting the error in a log file if it occurred during rendering. See “RenderQueue render() method” on page 153.
The callback function is passed the error string and a severity string. It should not return any value.
Type
A function name string, or null if no function is assigned; read/write.
Example
function err(errString) {
alert(errString);
}
app.onError = err;

Application open() method

app.open()
app.open(file)
Description
Opens a project.
Parameters
file
Returns
A new Project object for the specified project, or null if the user cancels the Open dialog box.
Example
var my_file = new File("../my_folder/my_test.aep");
if (my_file.exists){
new_project = app.open(my_file);
if (new_project){
alert(new_project.file.name);
}
}
Optional. An ExtendScript File object for the project file to open. If not supplied, the method prompts the user to select a project file.
26
JavaScript Reference Application object
27

Application parseSwatchFile() method

app.parseSwatchFile(file)
Description
Loads color swatch data from an Adobe Swatch Exchange (ASE) file.
Parameters
file
Returns
The file specification, an ExtendScript File object.
The swatch data, in this format:
data.majorVersion
data.minorVersion
data.values
SwatchValue.type
SwatchValue.r
SwatchValue.g
SwatchValue.b
SwatchValue.c
SwatchValue.m
SwatchValue.y
SwatchValue.k
SwatchValue.L
SwatchValue.a
SwatchValue.b
SwatchValue.value
The ASE version number.
An array of SwatchValue.
One of "RGB", "CMYK", "LAB", "Gray"
When type = "RGB", the color values in the range [0.0..1.0].
0, 0, 0 is Black.
When type = "CMYK", the color values in the range [0.0..1.0].
0, 0, 0, 0 is White.
When type = "LAB", the color values.
L is in the range [0.0..1.0]. a and b are in the range [-128.0..+128.0]
0, 0, 0 is Black.
When type = "Gray", the value range is [0.0..1.0].
0.0 is Black.

Application pauseWatchFolder() method

app.pauseWatchFolder(pause)
Description
Pauses or resumes the search of the target watch folder for items to render.
Parameters
pause
Returns
Nothing.
True to pause, false to resume.
27
JavaScript Reference Application object
28
See also
“Application isWatchFolder attribute” on page 24 “Application watchFolder() method” on page 30 “Application endWatchFolder() method” on page 23

Application project attribute

app.project
Description
The project that is currently loaded. See “Project object” on page 109.
Type
Project object; read-only.

Application purge() method

app.purge(target)
Description
Purges unused data of the specified types from memory. Replicates the Purge options in the Edit menu.
Parameters
target
The type of elements to purge from memory; a PurgeTarget enumerated value, one of:
PurgeTarget.ALL_CACHES: Purges all data that After Effects has cached to physical memory.
PurgeTarget.UNDO_CACHES: Purges all data saved in the undo cache.
PurgeTarget.SNAPSHOT_CACHES: Purges all data cached as comp/layer snapshots.
PurgeTarget.IMAGE_CACHES: Purges all saved image data.
Returns
Nothing.

Application quit() method

app.quit()
Description
Quits the After Effects application.
Parameters
None.
Returns
Nothing.

Application saveProjectOnCrash attribute

app.saveProjectOnCrash
28
JavaScript Reference Application object
29
Description
When true (the default), After Effects attempts to display a dialog box that allows you to save the current project if an error causes the application to quit unexpectedly. Set to false to suppress this dialog box and quit without saving.
Type
Boolean; read/write.

Application scheduleTask() method

app.scheduleTask(stringToExecute, delay, repeat)
Description
Schedules the specified JavaScript for delayed execution.
Parameters
stringToExecute
delay
repeat
Returns
A string containing JavaScript to be executed.
A number of milliseconds to wait before executing the JavaScript. A floating-point value.
When true, execute the script repeatedly, with the specified delay between each execution. When false the script is executed only once.
Integer, a unique identifier for this task, which can be used to cancel it with app.cancelTask().

Application setMemoryUsageLimits() method

app.setMemoryUsageLimits(imageCachePercentage, maximumMemoryPercentage)
Description
Sets memory usage limits as in the Memory & Cache preferences area. For both values, if installed RAM is less than a given amount (n gigabytes), the value is a percentage of the installed RAM, and is otherwise a percentage of n. The value of n is: 2 Gb for Win32, 4 Gb for Win64, 3.5 Gb for Mac OS.
Parameters
imageCachePercentage
maximumMemoryPercentage
Returns
Nothing.
Floating-point value, the percentage of memory assigned to image cache.
Floating-point value, the maximum usable percentage of memory.

Application setSavePreferencesOnQuit() method

app.setSavePreferencesOnQuit(doSave)
Description
Set or clears the flag that determines whether preferences are saved when the application is closed.
29
JavaScript Reference Application object
30
Parameters
doSave
Returns
When true, preferences saved on quit, when false they are not.
Nothing.

Application settings attribute

app.settings
Description
The currently loaded settings. See “Settings object” on page 162.
Type
Settings object; read-only.

Application version attribute

app.version
Description
An alphanumeric string indicating which version of After Effects is running.
Type
String; read-only.
Example
var ver = app.version;
alert("This machine is running version " + ver + " of After Effects.");

Application watchFolder() method

app.watchFolder(folder_object_to_watch)
Description
Starts a Watch Folder (network rendering) process pointed at a specified folder.
Parameters
folder_object_to_watch
Returns
Nothing.
Example
var theFolder = new Folder(“c:/tool”);
app.watchFolder(theFolder);
The ExtendScript Folder object for the folder to watch.
30
JavaScript Reference Application object
31
See also
“Application endWatchFolder() method” on page 23 “Application parseSwatchFile() method” on page 27 “Application isWatchFolder attribute” on page 24
31
JavaScript Reference AVItem object
32

AVItem object

app.project.item(index)
Description
The AVitem object provides access to attributes and methods of audio/visual files imported into After Effects.
AVItem is a subclass of Item. All methods and attributes of Item, in addition to those listed below, are
available when working with AVItem. See “Item object” on page 76.
AVItem is the base class for both CompItem and FootageItem, so AVItem attributes and methods are also
available when working with CompItem and FootageItem objects. See “CompItem object” on page 52 and “FootageItem object” on page 64.
Attributes
Attribute Reference Description
name
width
height
pixelAspect
frameRate
frameDuration
duration
useProxy
proxySource
time
usedIn
hasVideo
hasAudio
footageMissing
Methods
“AVItem name attribute” on page 35 The name of the object as shown in the Project panel.
“AVItem width attribute” on page 38 The width of the item.
“AVItem height attribute” on page 34 The height of the item.
“AVItem pixelAspect attribute” on page 35 The pixel aspect ratio of the item.
“AVItem frameRate attribute” on page 34 The frame rate of the item.
“AVItem frameDuration attribute” on page 33 The frame duration for the item.
“AVItem duration attribute” on page 33 The total duration of the item.
“AVItem useProxy attribute” on page 38 When true, a proxy source is used for this item.
“AVItem proxySource attribute” on page 35 The FootageItem object used as proxy for the item.
“AVItem time attribute” on page 38 Current time of the item.
“AVItem usedIn attribute” on page 38 The CompItem objects that use this item.
“AVItem hasVideo attribute” on page 34 When true, the item has a video component.
“AVItem hasAudio attribute” on page 34 When true, the item has an audio component.
“AVItem footageMissing attribute” on page 33
When true, the item cannot be found or is a placeholder.
Method Reference Description
setProxy()
setProxyWithSequence()
setProxyWithSolid()
setProxyWithPlaceholder()
setProxyToNone()
“AVItem setProxy() method” on page 36 Sets a proxy for the item.
“AVItem setProxyWithSequence() method” on page 37
“AVItem setProxyWithSolid() method” on page 37
“AVItem setProxyWithPlaceholder() method” on page 36
“AVItem setProxyToNone() method” on page 36 Removes the proxy for the item.
Sets a sequence as a proxy for the item.
Sets a solid as a proxy for the item.
Sets a placeholder as a proxy for the item.
32
JavaScript Reference AVItem object
33

AVItem duration attribute

app.project.item(index).duration
Description
Returns the duration, in seconds, of the item. Still footage items have a duration of 0.
In a CompItem, the value is linked to the duration of the composition, and is read/write.
In a FootageItem, the value is linked to the duration of the mainSource object, and is read-only.
Type
Floating-point value in the range [0.0..10800.0]; read/write for a CompItem; otherwise, read-only.

AVItem footageMissing attribute

app.project.item(index).footageMissing
Description
When true, the AVItem is a placeholder, or represents footage with a source file that cannot be found. In this case, the path of the missing source file is in the object. See “FootageItem mainSource attribute” on page 65 and “FileSource missingFootagePath attribute” on page 60.
missingFootagePath attribute of the footage item’s source-file
Type
Boolean; read-only.

AVItem frameDuration attribute

app.project.item(index).frameDuration
Description
Returns the length of a frame for this AVItem, in seconds. This is the reciprocal of frameRate. When set, the reciprocal is automatically set as a new
This attribute returns the reciprocal of the value is not evenly divisible into 1.0 (for example, 0.3). Due to numerical limitations, (1 / (1 / 0.3)) is close to, but not exactly, 0.3.
If the AVItem is a FootageItem, this value is linked to the
conformFrameRate of the mainSource object. This sets both the frameRate and frameDuration of the
FootageItem.
Type
Floating-point value in the range [1/99.. 1.0]; read-only for a FootageItem, otherwise read/write.
frameRate value.
frameRate, which may not be identical to a value you set, if that
mainSource, and is read-only. To change it, set the
33
JavaScript Reference AVItem object
34

AVItem frameRate attribute

app.project.item(index).frameRate
Description
The frame rate of the AVItem, in frames-per-second. This is the reciprocal of the frameDuration. When set, the reciprocal is automatically set as a new
In a CompItem, the value is linked to the frameRate of the composition, and is read/write.
In a FootageItem, the value is linked to the frameRate of the mainSource object, and is read-only. To change
it, set the
conformFrameRate of the mainSource object. This sets both the frameRate and frameDuration
of the FootageItem.
Type
Floating-point value in the range [1.0..99.0]; read-only for a FootageItem, otherwise read/write.

AVItem hasAudio attribute

app.project.item(index).hasAudio
frameDuration value.
Description
When true, the AVItem has an audio component.
In a CompItem, the value is linked to the composition.
In a FootageItem, the value is linked to the mainSource object.
Type
Boolean; read-only.

AVItem hasVideo attribute

app.project.item(index).hasVideo
Description
When true, the AVItem has an video component.
In a CompItem, the value is linked to the composition.
In a FootageItem, the value is linked to the mainSource object.
Type
Boolean; read-only.

AVItem height attribute

app.project.item(index).height
Description
The height of the item in pixels.
In a CompItem, the value is linked to the composition, and is read/write.
34
JavaScript Reference AVItem object
35
In a FootageItem, the value is linked to the mainSource object, and is read/write only if the mainSource
object is a SolidSource. Otherwise, it is read-only.
Type
Integer in the range [1...30000]; read/write, except as noted.

AVItem name attribute

app.project.item(index).name
Description
The name of the item, as shown in the Project panel.
In a FootageItem, the value is linked to the mainSource object. If the mainSource object is a FileSource, this
value controls the display name in the Project panel, but does not affect the file name.
Type
String; read/write.

AVItem pixelAspect attribute

app.project.item(index).pixelAspect
Description
The pixel aspect ratio of the item.
In a CompItem, the value is linked to the composition.
In a FootageItem, the value is linked to the mainSource object.
Certain accuracy. These are the set
pixelAspect values are specially known to After Effects, and are stored and retrieved with perfect
{1, 0.9, 1.2, 1.07, 1.42, 2, 0.95, 1.9}. Other values may show slight rounding errors
when you set or get them; that is, the value you retrieve after setting may be slightly different from the value you supplied.
Type
Floating-point value, in the range [0.01..100.0]; read/write.

AVItem proxySource attribute

app.project.item(index).proxySource
Description
The FootageSource being used as a proxy. The attribute is read-only; to change it, call any of the AVItem methods that change the proxy source:
setProxyWithPlaceholder().
setProxy(), setProxyWithSequence(), setProxyWithSolid(), or
Type
FootageSource object; read-only.
35
JavaScript Reference AVItem object
36

AVItem setProxy() method

app.project.item(index).setProxy(file)
Description
Sets a file as the proxy of this AVItem. Loads the specified file into a new FileSource object, sets this as the value
proxySource attribute, and sets useProxy to true. It does not preserve the interpretation parameters,
of the instead using the user preferences. If the file has an unlabeled alpha channel, and the user preference says to ask the user what to do, the method estimates the alpha interpretation, rather than asking the user.
This differs from setting a FootageItem's main source, but both actions are performed as in the user interface.
Parameters
file
Returns
An ExtendScript File object for the file to be used as a proxy.
None.

AVItem setProxyToNone() method

app.project.item(index).setProxyToNone()
Description
Removes the proxy from this AVItem, sets the value of proxySource to null, and sets the value of useProxy to
false.
Parameters
None.
Returns
Nothing.

AVItem setProxyWithPlaceholder() method

app.project.item(index).setProxyWithPlaceholder(name, width, height, frameRate, duration)
Description
Creates a PlaceholderSource object with specified values, sets this as the value of the proxySource attribute, and sets
useProxy to true. It does not preserve the interpretation parameters, instead using the user prefer-
ences.
NOTE: There is no direct way to set a placeholder as a proxy in the user interface; this behavior occurs when a proxy has been set and then moved or deleted.
Parameters
name
width, height
frameRate
A string containing the name of the new object.
The pixel dimensions of the placeholder, an integer in the range [4..30000].
The frames-per-second, an integer in the range [1..99].
36
JavaScript Reference AVItem object
37
duration
Returns
The total length in seconds, up to 3 hours. An integer in the range [0.0..10800.0].
Nothing.

AVItem setProxyWithSequence() method

app.project.item(index).setProxyWithSequence(file, forceAlphabetical)
Description
Sets a sequence of files as the proxy of this AVItem, with the option of forcing alphabetical order. Loads the specified file sequence into a new FileSource object, sets this as the value of the
useProxy to true. It does not preserve the interpretation parameters, instead using the user preferences. If any
file has an unlabeled alpha channel, and the user preference says to ask the user what to do, the method estimates the alpha interpretation, rather than asking the user.
Parameters
file
forceAlphabetical
Returns
An ExtendScript File object for the first file in the sequence.
When true, use the “Force alphabetical order” option.
Nothing.
proxySource attribute, and sets

AVItem setProxyWithSolid() method

app.project.item(index).setProxyWithSolid(color, name, width, height, pixelAspect)
Description
Creates a SolidSource object with specified values, sets this as the value of the proxySource attribute, and sets
useProxy to true. It does not preserve the interpretation parameters, instead using the user preferences.
NOTE: There is no way, using the user interface, to set a solid as a proxy; this feature is available only through scripting.
Parameters
color
name
width, height
pixelAspect
Returns
Nothing.
The color of the solid, an array of 3 floating-point values, [R, G, B], in the range [0.0..1.0].
A string containing the name of the new object.
The pixel dimensions of the placeholder, an integer in the range [1...30000].
The pixel aspect of the solid, a floating-point value in the range [0.01... 100.0].
37
JavaScript Reference AVItem object
38

AVItem time attribute

app.project.item(index).time
Description
The current time of the item when it is being previewed directly from the Project panel. This value is a number of seconds. Use the global method in terms of frames; see “timeToCurrentFormat() global function” on page 17.
timeToCurrentFormat to convert it to a string value that expresses the time
It is an error to set this value for a FootageItem whose
Type
mainSource is still (item.mainSource.isStill is true).
Floating-point value; read/write.

AVItem usedIn attribute

app.project.item(index).usedIn
Description
All the compositions that use this AVItem.
Note: Upon retrieval, the array value is copied, so it is not automatically updated. If you get this value, then add this item into another composition, you must retrieve the value again to get an array that includes the new item.
Type
Array of CompItem objects; read-only.

AVItem useProxy attribute

app.project.item(index).useProxy
Description
When true, a proxy is used for the item. It is set to true by all the SetProxy methods, and to false by the
SetProxyToNone() method.
Type
Boolean; read/write.

AVItem width attribute

app.project.item(index).width
Description
The width of the item, in pixels.
In a CompItem, the value is linked to the composition, and is read/write.
In a FootageItem, the value is linked to the mainSource object, and is read/write only if the mainSource
object is a SolidSource. Otherwise, it is read-only.
Type
Integer in the range [1...30000]; read/write, except as noted.
38
JavaScript Reference AVLayer object
39

AVLayer object

app.project.item(index).layer(index)
Description
The AVLayer object provides an interface to those layers that contain AVItem objects (Comp layers, footage layers, solid layers, text layers, and sound layers).
AVLayer is a subclass of Layer. All methods and attributes of Layer, in addition to those listed below, are
available when working with AVLayer. See “Layer object” on page 83.
AVLayer is a base class for TextLayer, so AVLayer attributes and methods are available when working with
TextLayer objects. See “TextLayer object” on page 172.
AE Properties
Different types of layers have different AE properties. AVLayer has the following properties and property groups:
Marker
Time Remap
Motion Trackers
Masks
Effects
Transform
Anchor Point
Position
Scale
Orientation
X Rotation
Y Rotation
Rotation
Opacity
Layer Styles
Material Options
Casts Shadows
Light Transmission
Accepts Shadows
Accepts Lights
Ambient
Diffuse
Specular
Shininess
Metal
Audio
Audio Levels
Example
If the first item in the project is a CompItem, and the first layer of that CompItem is an AVLayer, the following sets the layer
var firstLayer = app.project.item(1).layer(1);
firstLayer.quality = LayerQuality.BEST;
firstLayer.startTime = 1;
quality, startTime, and inPoint.
39
JavaScript Reference AVLayer object
40
firstLayer.inPoint = 2;
Attributes
Attribute Reference Description
source
isNameFromSource
height
width
audioEnabled
motionBlur
effectsActive
adjustmentLayer
guideLayer
threeDLayer
threeDPerChar
canSetCollapseTransformation
“AVLayer replaceSource() method” on page 47
“AVLayer isNameFromSource attribute” on page 46
“AVLayer height attribute” on page 46 The height of the layer.
“AVLayer width attribute” on page 49 The width of the layer.
“AVLayer audioEnabled attribute” on page 42
“AVLayer motionBlur attribute” on page 46
“AVLayer effectsActive attribute” on page 44
“AVLayer adjustmentLayer attribute” on page 41
“AVLayer frameBlendingType attribute” on page 45
“AVLayer threeDLayer attribute” on page 48
“AVLayer threeDPerChar attribute” on page 48
“AVLayer calculateTransformFrom­Points() method” on page 43
The source item for this layer.
When true, the layer has no expressly set name, but contains a named source.
When true, the layer's audio is enabled.
When true, the layer's motion blur is enabled.
When true, the layer's effects are active.
When true, this is an adjustment layer.
When true, this is a guide layer.
When true, this is a 3D layer.
When true, 3D is set on a per-character basis in this text layer.
When true, it is legal to change the value of
collapseTransformation.
collapseTransformation
frameBlending
frameBlendingType
canSetTimeRemapEnabled
timeRemapEnabled
hasAudio
audioActive
blendingMode
preserveTransparency
trackMatteType
“AVLayer collapseTransformation attribute” on page 44
“AVLayer frameBlending attribute” on page 45
“AVLayer frameBlendingType attribute” on page 45
“AVLayer canSetTimeRemapEnabled attribute” on page 44
“AVLayer timeRemapEnabled attribute” on page 48
“AVLayer hasAudio attribute” on page 45
“AVLayer audioActive attribute” on page 41
“AVLayer blendingMode attribute” on page 42
“AVLayer preserveTransparency attribute” on page 47
“AVLayer trackMatteType attribute” on page 49
When true, collapse transformation is on.
When true, frame blending is enabled.
The type of frame blending for the layer.
When true, it is legal to change the value of
timeRemapEnabled.
When true, time remapping is enabled on this layer.
When true, the layer contains an audio compo­nent.
When true, the layer's audio is active at the cur­rent time.
The blending mode of the layer.
When true, preserve transparency is enabled.
if layer has a track matte, specifies the way it is applied.
40
JavaScript Reference AVLayer object
41
Attribute Reference Description
isTrackMatte
hasTrackMatte
quality
autoOrient
Methods
Method Reference Description
audioActiveAtTime()
calculateTransformFromPoints()
replaceSource()
sourceRectAtTime()
“AVLayer isTrackMatte attribute” on page 46
“AVLayer hasTrackMatte attribute” on page 45
“AVLayer quality attribute” on page 47 The layer quality setting.
“AVLayer autoOrient attribute” on page 42
“AVLayer audioActiveAtTime() method” on page 42
“AVLayer calculateTransformFrom­Points() method” on page 43
“AVLayer replaceSource() method” on page 47
“AVLayer sourceRectAtTime() method” on page 48
When true, this layer is being used as a track matte for the layer below it.
When true, the layer above is being used as a track matte on this layer.
The type of automatic orientation for the layer.
Reports whether this layer's audio is active at a given time.
Calculates a transformation from a set of points in this layer.
Changes the source item for this layer.
Retrieves the source rectangle of a layer.

AVLayer adjustmentLayer attribute

app.project.item(index).layer(index).adjustmentLayer
Description
True if the layer is an adjustment layer.
Type
Boolean; read/write.

AVLayer audioActive attribute

app.project.item(index).layer(index).audioActive
Description
True if the layer's audio is active at the current time.
For this value to be true, is soloed too, and the time must be between the
Type
Boolean; read-only.
audioEnabled mu st be tr ue, no oth er lay er with audio may be soloing unless this layer
inPoint and outPoint of this layer.
41
JavaScript Reference AVLayer object
42

AVLayer audioActiveAtTime() method

app.project.item(index).layer(index).audioActiveAtTime(time)
Description
Returns true if this layer's audio will be active at the specified time.
For this method to return true, this layer is soloed too, and the time must be between the
Parameters
time
Returns
audioEnabled must be true, no other layer with audio may be soloing unless
inPoint and outPoint of this layer.
The time, in seconds. A floating-point value.
Boolean.

AVLayer audioEnabled attribute

app.project.item(index).layer(index).audioEnabled
Description
When true, the layer's audio is enabled. This value corresponds to the audio toggle switch in the Timeline panel.
Type
Boolean; read/write.

AVLayer autoOrient attribute

app.project.item(index).layer(index).autoOrient
Description
The type of automatic orientation to perform for the layer.
Type
An AutoOrientType enumerated value; read/write. One of:
AutoOrientType.ALONG_PATH
AutoOrientType.CAMERA_OR_POINT_OF_INTEREST
AutoOrientType.NO_AUTO_ORIENT

AVLayer blendingMode attribute

app.project.item(index).layer(index).blendingMode
Description
The blending mode of the layer.
Type
A BlendingMode enumerated value; read/write. One of:
42
JavaScript Reference AVLayer object
43
BlendingMode.ADD
BlendingMode.ALPHA_ADD
BlendingMode.CLASSIC_COLOR_BURN
BlendingMode.CLASSIC_COLOR_DODGE
BlendingMode.CLASSIC_DIFFERENCE
BlendingMode.COLOR
BlendingMode.COLOR_BURN
BlendingMode.COLOR_DODGE
BlendingMode.DANCING_DISSOLVE
BlendingMode.DARKEN
BlendingMode.DARKER_COLOR
BlendingMode.DIFFERENCE
BlendingMode.DISSOLVE
BlendingMode.EXCLUSION
BlendingMode.HARD_LIGHT
BlendingMode.HARD_MIX
BlendingMode.HUE
BlendingMode.LIGHTEN
BlendingMode.LIGHTER_COLOR
BlendingMode.LINEAR_BURN
BlendingMode.LINEAR_DODGE
BlendingMode.LINEAR_LIGHT
BlendingMode.LUMINESCENT_PREMUL
BlendingMode.LUMINOSITY
BlendingMode.MULTIPLY
BlendingMode.NORMAL
BlendingMode.OVERLAY
BlendingMode.PIN_LIGHT
BlendingMode.SATURATION
BlendingMode.SCREEN
BlendingMode.SILHOUETE_ALPHA
BlendingMode.SILHOUETTE_LUMA
BlendingMode.SOFT_LIGHT
BlendingMode.STENCIL_ALPHA
BlendingMode.STENCIL_LUMA
BlendingMode.VIVID_LIGHT

AVLayer calculateTransformFromPoints() method

app.project.item(index).layer(index).calculateTransformFromPoints(pointTopLeft, pointTopRight, point-
BottomRight)
Description
Calculates a transformation from a set of points in this layer.
Parameters
pointTopLeft
pointTopRight
pointBottomRight
The top left point coordinates in the form of an array, [x, y, z].
The top right point coordinates in the form of an array, [x, y, z].
The bottom right point coordinates in the form of an array, [x, y, z].
43
JavaScript Reference AVLayer object
44
Returns
An Object with the transformation properties set.
Example
var newLayer = comp.layers.add(newFootage);
newLayer.threeDLayer = true;
newLayer.blendingMode = BlendingMode.ALPHA_ADD;
var transform = newLayer.calculateTransformFromPoints(tl, tr, bl);
for(var sel in transform) {
newLayer.transform[sel].setValue(transform[sel]);
}

AVLayer canSetCollapseTransformation attribute

app.project.item(index).layer(index).canSetCollapseTransformation
Description
True if it is legal to change the value of the collapseTransformation attribute on this layer.
Type
Boolean; read-only.

AVLayer canSetTimeRemapEnabled attribute

app.project.item(index).layer(index).canSetTimeRemapEnabled
Description
True if it is legal to change the value of the timeRemapEnabled attribute on this layer.
Type
Boolean; read-only.

AVLayer collapseTransformation attribute

app.project.item(index).layer(index).collapseTransformation
Description
True if collapse transformation is on for this layer.
Type
Boolean; read/write.

AVLayer effectsActive attribute

app.project.item(index).layer(index).effectsActive
Description
True if the layer's effects are active, as indicated by the <f> icon next to it in the user interface.
44
JavaScript Reference AVLayer object
45
Type
Boolean; read/write.

AVLayer frameBlending attribute

app.project.item(index).layer(index).frameBlending
Description
True if frame blending is enabled for the layer.
Type
Boolean; read-only.

AVLayer frameBlendingType attribute

app.project.item(index).layer(index).frameBlendingType
Description
The type of frame blending to perform when frame blending is enabled for the layer.
Type
A FrameBlendingType enumerated value; read/write. One of:
FrameBlendingType.FRAME_MIX
FrameBlendingType.NO_FRAME_BLEND
FrameBlendingType.PIXEL_MOTION

AVLayer guideLayer attribute

app.project.item(index).layer(index).guideLayer
Description
True if the layer is a guide layer.
Type
Boolean; read/write.

AVLayer hasAudio attribute

app.project.item(index).layer(index).hasAudio
Description
True if the layer contains an audio component, regardless of whether it is audio-enabled or soloed.
Type
Boolean; read-only.

AVLayer hasTrackMatte attribute

app.project.item(index).layer(index).hasTrackMatte
45
JavaScript Reference AVLayer object
46
Description
True if the layer in front of this layer is being used as a track matte on this layer. When true, this layer's track-
MatteType
Type
Boolean; read-only.

AVLayer height attribute

app.project.item(index).layer(index).height
Description
The height of the layer in pixels.
Type
Floating-point; read-only.

AVLayer isNameFromSource attribute

app.project.item(index).layer(index).isNameFromSource
value controls how the matte is applied.
Description
True if the layer has no expressly set name, but contains a named source. In this case, layer.name has the same value as
layer.source.name.
False if the layer has an expressly set name, or if the layer does not have a source.
Type
Boolean; read-only.

AVLayer isTrackMatte attribute

app.project.item(index)layer(index).isTrackMatte
Description
True if this layer is being used as a track matte for the layer behind it.
Type
Boolean; read-only.

AVLayer motionBlur attribute

app.project.item(index).layer(index).motionBlur
Description
True if motion blur is enabled for the layer.
Type
Boolean; read/write.
46
JavaScript Reference AVLayer object
47

AVLayer preserveTransparency attribute

app.project.item(index).layer(index).preserveTransparency
Description
True if preserve transparency is enabled for the layer.
Type
Boolean; read/write.

AVLayer quality attribute

app.project.item(index).layer(index).quality
Description
The quality with which this layer is displayed.
Type
A LayerQuality enumerated value; read/write. One of:
LayerQuality.BEST
LayerQuality.DRAFT
LayerQuality.WIREFRAME

AVLayer replaceSource() method

app.project.item(index).layer(index).replaceSource (newSource, fixExpressions)
Description
Replaces the source for this layer.
Parameters
newSource
fixExpressions
Returns
The new source AVItem object.
to adjust expressions for the new source, false otherwise. Note that this feature can be
True
resource-intensive; if replacing a large amount of footage, do this only at the end of the operation. See also “Project autoFixExpressions() method” on page 110.
Nothing.

AVLayer source attribute

app.project.item(index).layer(index).source
Description
The source AVItem for this layer. The value is null in a Text layer. Use AVLayer.replaceSource() to change the value.
Type
AVItem object; read-only.
47
JavaScript Reference AVLayer object
48

AVLayer sourceRectAtTime() method

app.project.item(index).layer(index).sourceRectAtTime(timeT, extents)
Description
Retrieves the rectangle bounds of the layer at the specified time index, corrected for text or shape layer content. Use, for example, to write text that is properly aligned to the baseline.
Parameters
timeT
extents
Returns
The time index, in seconds. A floating-point value.
to include the extents, false otherwise. Exte nts apply to shape layers, increasing the size of
True
the layer bounds as necessary.
A JavaScript object with four attributes, [top, left, width, height].

AVLayer threeDLayer attribute

app.project.item(index).layer(index).threeDLayer
Description
True if this is a 3D layer.
Type
Boolean; read/write.

AVLayer threeDPerChar attribute

app.project.item(index).layer(index).threeDPerChar
Description
True if this layer has the Enable Per-character 3D switch set, allowing its characters to be animated off the plane of the text layer. Applies only to text layers.
Type
Boolean; read/write.

AVLayer timeRemapEnabled attribute

app.project.item(index).layer(index).timeRemapEnabled
Description
True if time remapping is enabled for this layer.
Type
Boolean; read/write.
48
JavaScript Reference AVLayer object
49

AVLayer trackMatteType attribute

app.project.item(index).layer(index).trackMatteType
Description
If this layer has a track matte, specifies the way the track matte is applied.
Type
A TrackMatteType enumerated value; read/write. One of:
TrackMatteType.ALPHA
TrackMatteType.ALPHA_INVERTED
TrackMatteType.LUMA
TrackMatteType.LUMA_INVERTED
TrackMatteType.NO_TRACK_MATTE

AVLayer width attribute

app.project.item(index).layer(index).width
Description
The width of the layer in pixels.
Type
Floating-point; read-only.
49
JavaScript Reference CameraLayer object
50

CameraLayer object

app.project.item(index).layer(index)
Description
The CameraLayer object represents a camera layer within a composition. Create it using the LayerCollection object’s item’s layer collection either by index number or by a name string.
AE Properties
CameraLayer defines no additional attributes, but has different AE properties than other layer types. It has the following properties and property groups:
Marker
Transform
Camera Options
addCamera method; see “LayerCollection addCamera() method” on page 93. It can be accessed in an
CameraLayer is a subclass of Layer. All methods and attributes of Layer are available when working with
CameraLayer. See “Layer object” on page 83.
Point of Interest
Position
Scale
Orientation
X Rotation
Y Rotation
Rotation
Opacity
Zoom
Depth of Field
Focus Distance
Blur Level
50
JavaScript Reference Collection object
51

Collection object

Like an array, a collection associates a set of objects or values as a logical group and provides access to them by index. However, most collection objects are read-only. You do not assign objects to them yourself—their contents update automatically as objects are created or deleted.
The index numbering of a collection starts with 1, not 0.
Objects
Object Reference Description
ItemCollection
LayerCollection
OMCollection
RQItemCollection
Attributes
length
Methods
[]
“ItemCollection object” on page 79 All of the items (imported files, folders, solids, and so on) found in
“LayerCollection object” on page 92
“OMCollection object” on page 104 All of the Output Module items in the project.
“RenderQueueItem object” on page 155
The number of objects in the collection.
Retrieves an object in the collection by its index number. The first object is at index 1.
the Project panel.
All of the layers in a composition.
All of the render-queue items in the project.
51
JavaScript Reference CompItem object
52

CompItem object

app.project.item(index)
app.project.items[index]
Description
The CompItem object represents a composition, and allows you to manipulate and get information about it. Access the objects by position index number in a project’s
CompItem is a subclass of AVItem, which is a subclass of Item. All methods and attributes of AVItem and
Item, in addition to those listed below, are available when working with CompItem. See “AVItem object” on page 32 and “Item object” on page 76.
Example
Given that the first item in the project is a CompItem, the following code displays two alerts. The first shows the number of layers in the CompItem, and the second shows the name of the last layer in the CompItem.
var firstComp = app.project.item(1);
alert("number of layers is " + firstComp.numLayers);
alert("name of last layer is " + firstComp.layer(firstComp.numLayers).name);
item collection.
Attributes
Attribute Reference Description
frameDuration
workAreaStart
workAreaDuration
numLayers
hideShyLayers
motionBlur
draft3d
frameBlending
preserveNestedFrameRate
preserveNestedResolution
“CompItem frameDuration attribute” on page 55
“CompItem workAreaStart attribute” on page 59
“CompItem workAreaDuration attribute” on page 58
“CompItem numLayers attribute” on page 56
“CompItem hideShyLayers attribute” on page 55
“CompItem motionBlur attribute” on page 56
“CompItem draft3d attribute” on page 54
“CompItem frameBlending attribute” on page 54
“CompItem preserveNestedFrameRate attribute” on page 56
“CompItem preserveNestedResolution attribute” on page 57
The duration of a single frame.
The work area start time.
The work area duration.
The number of layers in the composition.
When true, shy layers are visible in the Timeline panel.
When true, motion blur is enabled for this composi­tion.
When true, Draft 3D mode is enabled for the Compo­sition panel.
When true, time filtering is enabled for this composi­tion.
When true, the frame rate of nested compositions is preserved.
When true, the resolution of nested compositions is preserved.
bgColor
activeCamera
displayStartTime
“CompItem bgColor attribute” on page 53
“CompItem activeCamera attribute” on page 53
“CompItem displayStartTime attribute” on page 54
The background color of the composition.
The current active camera layer.
Changes the display of the start time in the Timeline panel.
52
JavaScript Reference CompItem object
53
Attribute Reference Description
resolutionFactor
shutterAngle
shutterPhase
layers
selectedLayers
selectedProperties
renderer
renderers
Methods
Method Reference Description
duplicate()
layer()
“CompItem duplicate() method” on page 54 Creates and returns a duplicate of this composition.
“CompItem layer() method” on page 55 Gets a layer from this composition.
“CompItem resolutionFactor attribute” on page 57
“CompItem shutterAngle attribute” on page 58
“CompItem shutterPhase attribute” on page 58
“CompItem layers attribute” on page 56 “LayerCollection object” on page 92
“CompItem selectedLayers attribute” on page 58
“CompItem selectedProperties attribute” on page 58
“CompItem renderer attribute” on page 57
“CompItem renderers attribute” on page 57
The factor by which the x and y resolution of the Com­position panel is downsampled.
The camera shutter angle.
The camera shutter phase.
The layers of the composition.
The selected layers of the composition.
The selected properties of the composition.
The rendering plugin module to be used to render this composition.
The set of available rendering plugin modules.

CompItem activeCamera attribute

app.project.item(index).activeCamera
Description
The active camera, which is the front-most camera layer that is enabled. The value is null if the composition contains no enabled camera layers.
Type
CameraLayer object; read-only.

CompItem bgColor attribute

app.project.item(index).bgColor
Description
The background color of the composition. The three array values specify the red, green, and blue components of the color.
Type
An array containing three floating-point values, [R, G, B], in the range [0.0..1.0]; read/write.
53
JavaScript Reference CompItem object
54

CompItem displayStartTime attribute

app.project.item(index).displayStartTime
Description
The time set as the beginning of the composition, in seconds. This is the equivalent of the Start Timecode or Start Frame setting in the Composition Settings dialog box.
Type
Floating-point value in the range [0.0...86339.0] (1 second less than 25 hours); read/write.

CompItem draft3d attribute

app.project.item(index).draft3d
Description
When true, Draft 3D mode is enabled for the Composition panel. This corresponds to the value of the Draft 3D button in the Composition panel.
Type
Boolean; read/write.

CompItem duplicate() method

app.project.item(index).duplicate()
Description
Creates and returns a duplicate of this composition, which contains the same layers as the original.
Parameters
None.
Returns
CompItem object.

CompItem frameBlending attribute

app.project.item(index).frameBlending
Description
When true, frame blending is enabled for this Composition. Corresponds to the value of the Frame Blending button in the Composition panel.
Type
Boolean; if true, frame blending is enabled; read/write.
54
JavaScript Reference CompItem object
55

CompItem frameDuration attribute

app.project.item(index).frameDuration
Description
The duration of a frame, in seconds. This is the inverse of the frameRate value (frames-per-second).
Type
Floating-point; read/write.

CompItem hideShyLayers attribute

app.project.item(index).hideShyLayers
Description
When true, only layers with shy set to false are shown in the Timeline panel. When false, all layers are visible, including those whose Composition panel.
shy value is true. Corresponds to the value of the Hide All Shy Layers button in the
Type
Boolean; read/write.

CompItem layer() method

app.project.item(index).layer(index)
app.project.item(index).layer(otherLayer, relIndex)
app.project.item(index).layer(name)
Description
Returns a Layer object, which can be specified by name, an index position in this layer, or an index position relative to another layer.
Parameters
index
—or—
otherLayer
relIndex
The index number of the desired layer in this composition. An integer in the range [1...num­Layers], where numLayers is the number of layers in the composition.
A Layer object in this composition. The relIndex value is added to the index value of this layer to find the position of the desired layer.
The position of the desired layer, relative to otherLayer. An integer in the range [1–other-
Layer.index...
layers in the composition.
This value is added to the return.
numLayersotherLayer.index], where numLayers is the number of
otherLayer value to derive the absolute index of the layer to
—or—
name
The string containing the name of the desired layer.
55
JavaScript Reference CompItem object
56
Returns
Layer object.

CompItem layers attribute

app.project.item(index).layers
Description
A LayerCollection object that contains all the Layer objects for layers in this composition. See “LayerCol­lection object” on page 92.
Type
LayerCollection object; read-only.

CompItem motionBlur attribute

app.project.item(index).motionBlur
Description
When true, motion blur is enabled for the composition. Corresponds to the value of the Motion Blur button in the Composition panel.
Type
Boolean; read/write.

CompItem numLayers attribute

app.project.item(index).numLayers
Description
The number of layers in the composition.
Type
Integer; read-only.

CompItem preserveNestedFrameRate attribute

app.project.item(index).preserveNestedFrameRate
Description
When true, the frame rate of nested compositions is preserved in the current composition. Corresponds to the value of the “Preserve frame rate when nested or in render queue” option in the Advanced tab of the Compo­sition Settings dialog box.
Type
Boolean; read/write.
56
JavaScript Reference CompItem object
57

CompItem preserveNestedResolution attribute

app.project.item(index).preserveNestedResolution
Description
When true, the resolution of nested compositions is preserved in the current composition. Corresponds to the value of the “Preserve Resolution When Nested” option in the Advanced tab of the Composition Settings dialog box.
Type
Boolean; read/write.

CompItem renderer attribute

app.project.item(index).renderer
Description
The current rendering plugin module to be used to render this composition, as set in the Advanced tab of the Composition Settings dialog box. Allowed values are the members of
compItem.renderers.
Type
String; read/write.

CompItem renderers attribute

app.project.item(index).renderers
Description
The available rendering plugin modules. Member strings reflect installed modules, as seen in the Advanced tab of the Composition Settings dialog box.
Type
Array of strings; read-only.

CompItem resolutionFactor attribute

app.project.item(index).resolutionFactor
Description
The x and y downsample resolution factors for rendering the composition.
The two values in the array specify how many pixels to skip when sampling; the first number controls horizontal sampling, the second controls vertical sampling. Full resolution is [1,1], half resolution is [2,2], and quarter resolution is [4,4]. The default is [1,1].
Type
Array of two integers in the range [1..99]; read/write.
57
JavaScript Reference CompItem object
58

CompItem selectedLayers attribute

app.project.item(index).selectedLayers
Description
All of the selected layers in this composition. This is a 0-based array (the first object is at index 0).
Type
Array of Layer objects; read-only.

CompItem selectedProperties attribute

app.project.item(index).selectedProperties
Description
All of the selected properties (Property and PropertyGroup objects) in this composition. The first property is at index position 0.
Type
Array of Property and PropertyGroup objects; read-only.

CompItem shutterAngle attribute

app.project.item(index).shutterAngle
Description
The shutter angle setting for the composition. This corresponds to the Shutter Angle setting in the Advanced tab of the Composition Settings dialog box.
Type
Integer in the range [0...720]; read/write.

CompItem shutterPhase attribute

app.project.item(index).shutterPhase
Description
The shutter phase setting for the composition. This corresponds to the Shutter Phase setting in the Advanced tab of the Composition Settings dialog box.
Type
Integer in the range [–360...360]; read/write.

CompItem workAreaDuration attribute

app.project.item(index).workAreaDuration
Description
The duration of the work area in seconds. This is the difference of the start-point and end-point times of the Composition work area.
58
JavaScript Reference CompItem object
59
Type
Floating-point; read/write.

CompItem workAreaStart attribute

app.project.item(index).workAreaStart
Description
The time when the Composition work area begins, in seconds.
Type
Floating-point; read/write.
59
JavaScript Reference FileSource object
60

FileSource object

app.project.item(index).mainSource
app.project.item(index).proxySource
Description
The FileSource object describes footage that comes from a file.
FileSource is a subclass of FootageSource. All methods and attributes of FootageSource, in addition to those
listed below, are available when working with FileSource. See “FootageSource object” on page 67.
Attributes
Attribute Reference Description
file
missingFootagePath
Methods
Method Reference Description
reload()
“FileSource file attribute” on page 60 The file that defines this asset.
“FileSource missingFootagePath attribute” on page 60
“FileSource reload() method” on page 61 Reloads the asset from the file, if it is a mainSource of
The file that contains footage missing from this asset.
a FootageItem.

FileSource file attribute

app.project.item(index).mainSource.file
app.project.item(index).proxySource.file
Description
The ExtendScript File object for the file that defines this asset. To change the value:
If this FileSource is a proxySource of an AVItem, call setProxy() or setProxyWithSequence().
If this FileSource is a mainSource of a FootageItem, call replace() or replaceWithSequence().
Type
File object; read-only.

FileSource missingFootagePath attribute

app.project.item(index).mainSource.file.missingFootagePath
app.project.item(index).proxySource.file.missingFootagePath
Description
The path and filename of footage that is missing from this asset. See also “AVItem footageMissing attribute” on page 33.
Type
String; read-only.
60
JavaScript Reference FileSource object
61

FileSource reload() method

app.project.item(index).mainSource.file.mainSource.reload()
Description
Reloads the asset from the file. This method can be called only on a mainSource, not a proxySource.
Parameters
None.
Returns
Nothing.
61
JavaScript Reference FolderItem object
62

FolderItem object

app.project.FolderItem
Description
The FolderItem object corresponds to a folder in your Project panel. It can contain various types of items (footage, compositions, solids) as well as other folders.
Example
Given that the second item in the project is a FolderItem, the following code puts up an alert for each top-level item in the folder, showing that item’s name.
var secondItem = app.project.item(2);
if ( !(secondItem instanceof FolderItem) ) {
alert("problem: second item is not a folder");
} else {
for (i = 1; i <= secondItem.numItems; i++) {
alert("item number " + i + " within the folder is named "
+ secondItem.item(i).name);
}
}
Attributes
Attribute Reference Description
items
numItems
Methods
Method Reference Description
item()
“FolderItem items attribute” on page 63 The contents of this folder.
“FolderItem numItems attribute” on page 63 The number of items contained in the folder.
“FolderItem item() method” on page 62 Gets an item from the folder.

FolderItem item() method

app.project.item(index).item
Description
Returns the top-level item in this folder at the specified index position. Note that “top-level” here means top­level within the folder, not necessarily within the project.
Parameters
index
An integer, the position index of the item to retrieve. The first item is at index 1.
Returns
Item object.
62
JavaScript Reference FolderItem object
63

FolderItem items attribute

app.project.item(index).items
Description
An ItemCollection object containing Item object that represent the top-level contents of this folder.
Unlike the ItemCollection in the Project object, this collection contains only the top-level items in the folder. Top-level within the folder is not the same as top-level within the project. Only those items that are top-level in the root folder are also top-level in the Project.
Type
ItemCollection object; read only.

FolderItem numItems attribute

app.project.item(index).numItems
Description
The number of items contained in the items collection (folderItem.items.length).
If the folder contains another folder, only the FolderItem for that folder is counted, not any subitems contained in it.
Type
Integer; read only.
63
JavaScript Reference FootageItem object
64

FootageItem object

app.project.item(index)
app.project.items[index]
Description
The FootageItem object represents a footage item imported into a project, which appears in the Project panel. These are accessed by position index number in a project’s
FootageItem is a subclass of AVItem, which is a subclass of Item. All methods and attributes of AVItem and
Item, in addition to those listed below, are available when working with FootageItem. See “AVItem object” on page 32 and “Item object” on page 76.
Attributes
Attribute Reference Description
item collection.
file
mainSource
Methods
Method Reference Description
replace()
replaceWithPlaceholder()
replaceWithSequence()
replaceWithSolid()
“FootageItem file attribute” on page 64 The footage source file.
“FootageItem mainSource attribute” on page 65 All settings related to the footage item.
“FootageItem replace() method” on page 65
“FootageItem replaceWithPlace­holder() method” on page 65
“FootageItem replaceWithSequence() method” on page 66
“FootageItem replaceWithSolid() method” on page 66
Replaces a footage file with another footage file.
Replaces a footage file with a placeholder object.
Replaces a footage file with an image sequence.
Replaces a footage file with a solid.

FootageItem file attribute

app.project.item(index).file
Description
The ExtendScript File object for the footage's source file.
If the FootageItem's it is null.
mainSource is a FileSource, this is the same as FootageItem.mainSource.file. Otherwise
Type
File object; read only.
64
JavaScript Reference FootageItem object
65

FootageItem mainSource attribute

app.project.item(index).mainSource
Description
The footage source, an object that contains all of the settings related to that footage item, including those that are normally accessed through the Interpret Footage dialog box. The attribute is read-only. To change its value, call one of the FootageItem “replace” methods.
See the “FootageSource object” on page 67, and its three types:
“SolidSource object” on page 168
“FileSource object” on page 60
“PlaceholderSource object” on page 108
If this is a FileSource object, and the
FileSource.missingFootagePath attribute. See “AVItem footageMissing attribute” on page 33 and
“FileSource missingFootagePath attribute” on page 60.
Type
FootageSource object; read-only.
footageMissing value is true, the path to the missing footage file is in the

FootageItem replace() method

app.project.item(index).replace(file)
Description
Changes the source of this FootageItem to the specified file. In addition to loading the file, the method creates a new FileSource object for the file and sets
name, width, height, frameDuration, and duration attributes (see “AVItem object” on page 32) based on the
mainSource to that object. In the new source object, it sets the
contents of the file.
The method preserves interpretation parameters from the previous
mainSource object. If the specified file has
an unlabeled alpha channel, the method estimates the alpha interpretation.
Parameters
file
An ExtendScript File object for the file to be used as the footage main source.

FootageItem replaceWithPlaceholder() method

app.project.item(index).replaceWithPlaceholder(name, width, height, frameRate, duration)
Description
Changes the source of this FootageItem to the specified placeholder. Creates a new PlaceholderSource object, sets its values from the parameters, and sets
mainSource to that object.
Parameters
name
width
height
A string containing the name of the placeholder.
The width of the placeholder in pixels, an integer in the range [4..30000].
The height of the placeholder in pixels, an integer in the range [4..30000].
65
JavaScript Reference FootageItem object
66
frameRate
duration
The frame rate of the placeholder, a floating-point value in the range [1.0..99.0]
The duration of the placeholder in seconds, a floating-point value in the range [0.0..10800.0].

FootageItem replaceWithSequence() method

app.project.item(index).replaceWithSequence(file, forceAlphabetical)
Description
Changes the source of this FootageItem to the specified image sequence. In addition to loading the file, the method creates a new FileSource object for the file and sets object, it sets the
name, width, height, frameDuration, and duration attributes (see “AVItem object” on
mainSource to that object. In the new source
page 32) based on the contents of the file.
The method preserves interpretation parameters from the previous
mainSource object. If the specified file has
an unlabeled alpha channel, the method estimates the alpha interpretation.
Parameters
file
forceAlphabetical
An ExtendScript File object for the first file in the sequence to be used as the footage main source.
When true, use the “Force alphabetical order” option.

FootageItem replaceWithSolid() method

app.project.item(index).replaceWithSolid(color, name, width, height, pixelAspect)
Description
Changes the source of this FootageItem to the specified solid. Creates a new SolidSource object, sets its values from the parameters, and sets
Parameters
color
name
width
height
pixelAspect
mainSource to that object.
The color of the solid, an array of three floating-point values, [R, G, B], in the range [0.0..1.0].
A string containing the name of the solid.
The width of the solid in pixels, an integer in the range [4..30000].
The height of the solid in pixels, an integer in the range [4..30000].
The pixel aspect ratio of the solid, a floating-point value in the range [0.01..100.0].
66
JavaScript Reference FootageSource object
67

FootageSource object

app.project.item(index).mainSource
app.project.item(index).proxySource
Description
The FootageSource object holds information describing the source of some footage. It is used as the
mainSource of a FootageItem, or the proxySource of a CompItem or FootageItem. See “FootageItem object”
on page 64 and “CompItem object” on page 52.
FootageSource is the base class for SolidSource, so FootageSource attributes and methods are available
when working with SolidSource objects. See “SolidSource object” on page 168.
Attributes
Attribute Reference Description
hasAlpha
alphaMode
premulColor
invertAlpha
isStill
fieldSeparationType
highQualityFieldSeparation
removePulldown
loop
nativeFrameRate
displayFrameRate
“FootageSource hasAlpha attribute” on page 70
“FootageSource alphaMode attribute” on page 68
“FootageSource premulColor attribute” on page 71
“FootageSource invertAlpha attribute” on page 70
“FootageSource isStill attribute” on page 70
“FootageSource fieldSeparationType attribute” on page 69
“FootageSource highQualityFieldSepa­ration attribute” on page 70
“FootageSource removePulldown attribute” on page 71
“FootageSource loop attribute” on page 71
“FootageSource nativeFrameRate attribute” on page 71
“FootageSource displayFrameRate attribute” on page 68
When true, a footage clip or proxy includes an alpha channel.
The mode of an alpha channel.
The color to be premultiplied.
When true, an alpha channel in a footage clip or proxy should be inverted.
When true, footage is a still image.
The field separation type.
How the fields are to be separated in non-still foot­age.
The pulldown type for the footage.
How many times an image sequence is set to loop.
The native frame rate of the footage.
The effective frame rate as displayed and rendered in compositions by After Effects.
conformFrameRate
“FootageSource conformFrameRate attribute” on page 68
The rate to which footage should conform.
Methods
Method Reference Description
guessAlphaMode()
guessPulldown()
“FootageSource guessAlphaMode() method” on page 69
“FootageSource guessPulldown() method” on page 69
Estimates the alphaMode setting.
Estimates the pulldownType setting.
67
JavaScript Reference FootageSource object
68

FootageSource alphaMode attribute

app.project.item(index).mainSource. alphaMode
app.project.item(index).proxySource. alphaMode
Description
The alphaMode attribute of footageSource defines how the alpha information in the footage is to be inter­preted. If hasAlpha is false, this attribute has no relevant meaning.
Type
An AlphaMode enumerated value; (read/write). One of:
AlphaMode.IGNORE
AlphaMode.STRAIGHT
AlphaMode.PREMULTIPLIED

FootageSource conformFrameRate attribute

app.project.item(index).mainSource. conformFrameRate
app.project.item(index).proxySource. conformFrameRate
Description
A frame rate to use instead of the nativeFrameRate value. If set to 0, the nativeFrameRate is used instead.
It is an error to set this value if
Pulldown PulldownPhase.OFF, then this is automatically set to the value of nativeFrameRate.
Type
is not set to PulldownPhase.OFF. If this is 0 when you set removePulldown to a value other than
FootageSource.isStill is true. It is an error to set this value to 0 if remove-
Floating-point value in the range [0.0.. 99.0]; read/write.

FootageSource displayFrameRate attribute

app.project.item(index).mainSource. displayFrameRate
app.project.item(index).proxySource. displayFrameRate
Description
The effective frame rate as displayed and rendered in compositions by After Effects.
removePulldown is PulldownPhase.OFF, then this is the same as the conformFrameRate (if non-zero) or
If
nativeFrameRate (if conformFrameRate is 0). If removePulldown is not PulldownPhase.OFF, this is
the
conformFrameRate * 0.8, the effective frame rate after removing 1 of every 5 frames.
Type
Floating-point value in the range [0.0.. 99.0]; read-only.
68
JavaScript Reference FootageSource object
69

FootageSource fieldSeparationType attribute

app.project.item(index).mainSource. fieldSeparationType
app.project.item(index).proxySource. fieldSeparationType
Description
How the fields are to be separated in non-still footage.
It is an error to set this attribute if
removePulldown is not PulldownPhase.OFF.
Type
isStill is true. It is an error to set this value to FieldSeparationType.OFF if
A FieldSeparationType enumerated value; read/write. One of:
FieldSeparationType.OFF
FieldSeparationType.UPPER_FIELD_FIRST
FieldSeparationType.LOWER_FIELD_FIRST

FootageSource guessAlphaMode() method

app.project.item(index).mainSource.guessAlphaMode()
app.project.item(index).proxySource.guessAlphaMode()
Description
Sets alphaMode, premulColor, and invertAlpha to the best estimates for this footage source. If hasAlpha is false, no change is made.
Parameters
None.
Returns
Nothing.

FootageSource guessPulldown() method

app.project.item(index).mainSource.guessPulldown(method)
app.project.item(index).proxySource.guessPulldown(method)
Description
Sets fieldSeparationType and removePulldown to the best estimates for this footage source. If isStill is true, no change is made.
Parameters
method
Returns
The method to use for estimation. A PulldownMethod enumerated value, one of:
PulldownMethod.PULLDOWN_3_2
PulldownMethod.ADVANCE_24P
Nothing.
69
JavaScript Reference FootageSource object
70

FootageSource hasAlpha attribute

app.project.item(index).mainSource. hasAlpha
app.project.item(index).proxySource. hasAlpha
Description
When true, the footage has an alpha component. In this case, the attributes alphaMode, invertAlpha, and
premulColor have valid values. When false, those attributes have no relevant meaning for the footage.
Type
Boolean; read-only.

FootageSource highQualityFieldSeparation attribute

app.project.item(index).mainSource. highQualityFieldSeparation
app.project.item(index).proxySource. highQualityFieldSeparation
Description
When true, After Effects uses special algorithms to determine how to perform high-quality field separation.
It is an error to set this attribute if
Type
isStill is true, or if fieldSeparationType is FieldSeparationType.OFF.
Boolean; read/write.

FootageSource invertAlpha attribute

app.project.item(index).mainSource. invertAlpha
app.project.item(index).proxySource. invertAlpha
Description
When true, an alpha channel in a footage clip or proxy should be inverted.
This attribute is valid only if an alpha is present. If
hasAlpha is false, or if alphaMode is AlphaMode.IGNORE,
this attribute is ignored.
Type
Boolean; read/write.

FootageSource isStill attribute

app.project.item(index).mainSource. isStill
app.project.item(index).proxySource. isStill
Description
When true the footage is still; when false, it has a time-based component.
Examples of still footage are JPEG files, solids, and placeholders with duration of 0. Examples of non-still footage are movie files, sound files, sequences, and placeholders of non-zero duration.
Type
Boolean; read-only.
70
JavaScript Reference FootageSource object
71

FootageSource loop attribute

app.project.item(index).mainSource. loop
app.project.item(index).proxySource. loop
Description
The number of times that the footage is to be played consecutively when used in a composition.
It is an error to set this attribute if
Type
isStill is true.
Integer in the range [1.. 9999]; default is 1; read/write.

FootageSource nativeFrameRate attribute

app.project.item(index).mainSource. nativeFrameRate
app.project.item(index).proxySource. nativeFrameRate
Description
The native frame rate of the footage.
Type
Floating-point; read/write.

FootageSource premulColor attribute

app.project.item(index).mainSource. premulColor
app.project.item(index).proxySource. premulColor
Description
The color to be premultiplied. This attribute is valid only if the alphaMode is alphaMode.PREMULTIPLIED.
Type
Array of three floating-point values [R, G, B], in the range [0.0..1.0]; read/write.

FootageSource removePulldown attribute

app.project.item(index).mainSource. removePulldown
app.project.item(index).proxySource. removePulldown
Description
How the pulldowns are to be removed when field separation is used.
It is an error to set this attribute if
PulldownPhase.OFF in the case where fieldSeparationType is FieldSeparationType.OFF.
Type
A PulldownPhase enumerated value; read/write. One of:
PulldownPhase.RemovePulldown.OFF
PulldownPhase.RemovePulldown.WSSWW
PulldownPhase.RemovePulldown.SSWWW
isStill is true. It is an error to attempt to set this to a value other than
71
JavaScript Reference FootageSource object
72
PulldownPhase.RemovePulldown.SWWWS
PulldownPhase.RemovePulldown.WWWSS
PulldownPhase.RemovePulldown.WWSSW
PulldownPhase.RemovePulldown.WSSWW_24P_ADVANCE
PulldownPhase.RemovePulldown.SSWWW_24P_ADVANCE
PulldownPhase.RemovePulldown.SWWWS_24P_ADVANCE
PulldownPhase.RemovePulldown.WWWSS_24P_ADVANCE
PulldownPhase.RemovePulldown.WWSSW_24P_ADVANCE
72
JavaScript Reference ImportOptions object
73

ImportOptions object

new ImportOptions();
new ImportOptions(file);
Description
The ImportOptions object encapsulates the options used to import a file with the Project.importFile methods. See “Project importFile() method” on page 112.
The constructor takes an optional parameter, an ExtendScript File object for the file. If it is not supplied, you must explicitly set the value of the example:
new ImportOptions().file = new File("myfile.psd");
Attributes
Attributes Reference Description
file attribute before using the object with the importFile method. For
importAs
sequence
forceAlphabetical
file
Methods
Method Reference Description
canImportAs()
“ImportOptions importAs attribute” on page 74
“ImportOptions sequence attribute” on page 75
“ImportOptions forceAlphabetical attribute” on page 74
“ImportOptions file attribute” on page 74
“ImportOptions canImportAs() method” on page 73
The type of file to be imported.
When true, import a sequence of files, rather than an individ­ual file.
When true, the “Force alphabetical order” option is set.
The file to import, or the first file of the sequence to import.
Restricts input to a particular file type.

ImportOptions canImportAs() method

importOptions.canImportAs(type)
Description
Reports whether the file can be imported as the source of a particular object type. If this method returns true, you can set the given type as the value of the page 74.
importAs attribute. See “ImportOptions importAs attribute” on
Parameters
type
The type of file that can be imported. An ImportAsType enumerated value; one of:
ImportAsType.COMP
ImportAsType.FOOTAGE
ImportAsType.COMP_CROPPED_LAYERS
ImportAsType.PROJECT
73
JavaScript Reference ImportOptions object
74
Returns
Boolean.
Example
var io = new ImportOptions(File(“c:\\myFile.psd”));
if io.canImportAs(ImportAsType.COMP);
io.importAs = ImportAsType.COMP;

ImportOptions file attribute

importOptions.file
Description
The file to be imported. If a file is set in the constructor, you can access it through this attribute.
Type
ExtendScript File object; read/write.

ImportOptions forceAlphabetical attribute

importOptions.forceAlphabetical
Description
When true, has the same effect as setting the “Force alphabetical order” option in the File > Import > File dialog box.
Type
Boolean; read/write.

ImportOptions importAs attribute

importOptions.importAs
Description
The type of object for which the imported file is to be the source. Before setting, use canImportAs to check that a given file can be imported as the source of the given object type. See “ImportOptions canImportAs() method” on page 73.
Type
An ImportAsType enumerated value; read/write. One of:
ImportAsType.COMP_CROPPED_LAYERS
ImportAsType.FOOTAGE
ImportAsType.COMP
ImportAsType.PROJECT
74
JavaScript Reference ImportOptions object
75

ImportOptions sequence attribute

importOptions.sequence
Description
When true, a sequence is imported; otherwise, an individual file is imported.
Type
Boolean; read/write.
75
JavaScript Reference Item object
76

Item object

app.project.item(index)
app.project.items[index]
Description
The Item object represents an item that can appear in the Project panel.
The first item is at index 1.
Item is the base class for AVItem and for FolderItem, which are in turn the base classes for various other
item types, so Item attributes and methods are available when working with all of these item types. See “AVItem object” on page 32 and “FolderItem object” on page 62.
Attributes
Attributes Reference Description
name
comment
id
parentFolder
selected
typeName
Methods
Method Reference Description
remove()
Example
“Item name attribute” on page 77 The name of the object as shown in the Project panel.
“Item comment attribute” on page 77 A descriptive string.
“Item id attribute” on page 77 A unique identifier for this item.
“Item parentFolder attribute” on page 77 The parent folder of this item.
“Item selected attribute” on page 78 When true, this item is currently selected.
“Item typeName attribute” on page 78 The type of item.
“Item remove() method” on page 78 Deletes the item from the project.
This example gets the second item from the project and checks that it is a folder. It then removes from the folder any top-level item that is not currently selected. It also checks to make sure that, for each item in the folder, the parent is properly set to the correct folder.
var myFolder = app.project.item(2);
if (myFolder.typeName != "Folder") {
alert("error: second item is not a folder");
}
else {
var numInFolder = myFolder.numItems;
// Always run loops backwards when deleting things:
for(i = numInFolder; i >= 1; i--) {
var curItem = myFolder.item(i);
if ( curItem.parentFolder != myFolder) {
alert("errorwithin AE: the parentFolder is not set correctly");
}
else {
if ( !curItem.selected && curItem.typeName == "Footage") {
// Aha! an unselected solid.
curItem.remove();
76
JavaScript Reference Item object
77
}
}
}
}

Item comment attribute

app.project.item(index).comment
Description
A string that holds a comment, up to 15,999 bytes in length after any encoding conversion. The comment is for the user's purpose only; it has no effect on the item's appearance or behavior.
Type
String; read/write.

Item id attribute

app.project.item(index).id
Description
A unique and persistent identification number used internally to identify an item between sessions. The value of the ID remains the same when the project is saved to a file and later reloaded. However, when you import this project into another project, new IDs are assigned to all items in the imported project. The ID is not displayed anywhere in the user interface.
Type
Integer; read-only.

Item name attribute

app.project.item(index).name
Description
The name of the item as displayed in the Project panel.
Type
String; read/write.

Item parentFolder attribute

app.project.item(index).parentFolder
Description
The FolderItem object for the folder that contains this item. If this item is at the top level of the project, this is the project's root folder (
app.project.rootFolder). You can use the ItemCollection’s addFolder method to
add a new folder, and set this value to put items in the new folder. See “ItemCollection addFolder() method” on page 79.
77
JavaScript Reference Item object
78
Type
FolderItem object; read/write.
Example
This script creates a new FolderItem in the Project panel and moves compositions into it.
// create a new FolderItem in project, with name “comps”
var compFolder = app.project.items.addFolder(“comps”);
// move all compositions into new folder by setting
// compItem’s parentFolder to “comps” folder
for(var i = 1; i <= app.project.numItems; i++) {
if(app.project.item(i) instanceof CompItem)
app.project.item(i).parentFolder = compFolder;
}

Item remove() method

app.project.item(index).remove()
Description
Deletes this item from the project and from the Project panel. If the item is a FolderItem, all the items contained in the folder are also removed from the project. No files or folders are removed from disk.
Parameters
None.
Returns
Nothing.

Item selected attribute

app.project.item(index).selected
Description
When true, this item is selected. Multiple items can be selected at the same time. Set to true to select the item programmatically, or to false to deselect it.
Type
Boolean; read/write.

Item typeName attribute

app.project.item(index).typeName
Description
A user-readable name for the item type; for example, “Folder”, “Footage”, or “Composition”.
Type
String; read-only.
78
JavaScript Reference ItemCollection object
79

ItemCollection object

app.project.items
Description
The ItemCollection object represents a collection of items. The ItemCollection belonging to a Project object contains all the Item objects for items in the project. The ItemCollection belonging to a FolderItem object contains all the Item objects for items in that folder.
ItemCollection is a subclass of Collection. All methods and attributes of Collection, in addition to those
listed below, are available when working with ItemCollection. See “Collection object” on page 51.
Methods
Method Reference Description
addComp()
addFolder()
“ItemCollection addComp() method” on page 79
“ItemCollection addFolder() method” on page 79
Creates a new CompItem object and adds it to the collection.
Creates a new FolderItemobject and adds it to the collection.

ItemCollection addComp() method

app.project.itemCollection.addComp(name, width, height, pixelAspect, duration, frameRate)
Description
Creates a new composition. Creates and returns a new CompItem object and adds it to this collection.
If the ItemCollection belongs to the project or the root folder, then the new item’s folder. If the ItemCollection belongs to any other folder, the new item’s
Parameters
name
width
height
pixelAspect
duration
A string containing the name of the composition.
The width of the composition in pixels, an integer in the range [4..30000].
The height of the composition in pixels, an integer in the range [4..30000].
The pixel aspect ratio of the composition, a floating-point value in the range [0.01..100.0].
The duration of the composition in seconds, a floating-point value in the range [0.0..10800.0].
parentFolder is that FolderItem.
parentFolder is the root
frameRate
Returns
The frame rate of the composition, a floating-point value in the range [1.0..99.0]
CompItem object.

ItemCollection addFolder() method

app.project.itemCollection.addFolder(name)
Description
Creates a new folder. Creates and returns a new FolderItem object and adds it to this collection.
79
JavaScript Reference ItemCollection object
80
If the ItemCollection belongs to the project or the root folder, then the new folder’s parentFolder is the root folder. If the ItemCollection belongs to any other folder, the new folder’s
parentFolder is that FolderItem.
To put items in the folder, set the item object’s
parentFolder attribute; see “Item parentFolder attribute” on
page 77.
Parameters
name
Returns
A string containing the name of the folder.
FolderItem object.
Example
This script creates a new FolderItem in the Project panel and moves compositions into it.
// create a new FolderItem in project, with name “comps”
var compFolder = app.project.items.addFolder(“comps”);
// move all compositions into new folder by setting
// compItem’s parentFolder to “comps” folder
for(var i = 1; i <= app.project.numItems; i++) {
if(app.project.item(i) instanceof CompItem)
app.project.item(i).parentFolder = compFolder;
}
80
JavaScript Reference KeyframeEase object
81

KeyframeEase object

myKey = new KeyframeEase(speed, influence);
Description
The KeyframeEase object encapsulates the keyframe ease settings of a layer’s AE property. There are two types of ease, temporal and spatial, which are determined by the speed and influence settings. Both types are set using the property’s page 136.
The constructor creates a KeyframeEase object. Both parameters are required.
speed: A floating-point value. Sets the speed attribute.
influence: A floating-point value in the range [0.1..100.0]. Sets the influence attribute.
Example
This example assumes that the Position, a spatial property, has more than two keyframes.
var easeIn = new KeyframeEase(0.5, 50);
var easeOut = new KeyframeEase(0.75, 85);
var myPositionProperty = app.project.item(1 ) .layer(1).property("Position")
myPositionProperty.setTemporalEaseAtKey(2, [easeIn], [easeOut]);
setTemporalEaseAtKey method. See “Property setTemporalEaseAtKey() method” on
This example sets the Scale, a temporal property with two dimensions. For 2D and 3D properties you must
easeIn and easeOut value for each dimension:
set an
var easeIn = new KeyframeEase(0.5, 50);
var easeOut = new KeyframeEase(0.75, 85);
var myScaleProperty = app.project.item(1).layer(1).property("Scale")
myScaleProperty.setTemporalEaseAtKey(2, [easeIn, easeIn, easeIn], [easeOut,easeOut, easeOut]);
Attributes
Attribute Reference Description
speed
influence
“KeyframeEase speed attribute” on page 82 The speed setting for a keyframe.
“KeyframeEase influence attribute” on page 81 The influence setting for a keyframe.

KeyframeEase influence attribute

myKey.influence
Description
The influence value of the keyframe, as shown in the Keyframe Velocity dialog box.
Type
Floating-point value in the range [0.1..100.0]; read/write.
81
JavaScript Reference KeyframeEase object
82

KeyframeEase speed attribute

myKey.speed
Description
The speed value of the keyframe. The units depend on the type of keyframe, and are displayed in the Keyframe Velocity dialog box.
Type
Floating-point value; read/write.
82
JavaScript Reference Layer object
83

Layer object

app.project.item(index).layer(index)
Description
The Layer object provides access to layers within compositions. It can be accessed from an item’s layer collection either by index number or by a name string.
Layer is the base class for CameraLayer, TextLayer, LightLayer, and AVLayer, so Layer attributes and
methods are available when working with all layer types. See “AVLayer object” on page 39, “CameraLayer object” on page 50, “LightLayer object” on page 97, and “TextLayer object” on page 172.
Layers contain AE properties, in addition to their JavaScript attributes and methods. For examples of how to access properties in layers, see “PropertyBase object” on page 140.
Example
If the first item in the project is a CompItem, this example disables the first layer in that composition and renames it. This might, for example, turn an icon off in the composition.
var firstLayer = app.project.item(1).layer(1);
firstLayer.enabled = false;
firstLayer.name = "Disabled Layer";
Attributes
Attribute Reference Description
index
name
parent
time
startTime
stretch
inPoint
outPoint
enabled
solo
shy
locked
hasVideo
active
“Layer index attribute” on page 87 The index position of the layer.
“Layer name attribute” on page 89 The name of the layer.
“Layer parent attribute” on page 89 The parent of this layer.
“Layer time attribute” on page 91 The current time of the layer.
“Layer startTime attribute” on page 91 The start time of the layer.
“Layer stretch attribute” on page 91 The time stretch percentage of the layer.
“Layer inPoint attribute” on page 87 The “in” point of the layer.
“Layer outPoint attribute” on page 89 The “out” point of the layer.
“Layer enabled attribute” on page 86 When true, the layer is enabled.
“Layer solo attribute” on page 91 When true, the layer is soloed.
“Layer shy attribute” on page 90 When true, the layer is shy.
“Layer locked attribute” on page 87 When true, the layer is locked.
“Layer hasVideo attribute” on page 86 When true, the layer contains a video component.
“Layer active attribute” on page 84 When true, the layer is active at the current time.
nullLayer
selectedProperties
comment
containingComp
“Layer nullLayer attribute” on page 89 When true, this is a null layer.
“Layer selectedProperties attribute” on page 90 All selected AE properties in the layer.
“Layer comment attribute” on page 85 A descriptive comment for the layer.
“Layer containingComp attribute” on page 85 The composition that contains this layer.
83
JavaScript Reference Layer object
84
Attribute Reference Description
isNameSet
Methods
Method Reference Description
remove()
moveToBeginning()
moveToEnd()
moveAfter()
moveBefore()
duplicate()
copyToComp()
activeAtTime()
setParentWithJump()
applyPresets()
“Layer isNameSet attribute” on page 87 When true, the layer’s name has been explicitly set.
“Layer remove() method” on page 90 Deletes the layer from the composition.
“Layer moveToBeginning() method” on page 88
“Layer moveToEnd() method” on page 88
“Layer moveAfter() method” on page 87 Moves the layer below another layer.
“Layer moveBefore() method” on page 88
“Layer duplicate() method” on page 86 Duplicates the layer.
“Layer copyToComp() method” on page 86
“Layer activeAtTime() method” on page 84
“Layer setParentWithJump() method” on page 90
“Layer applyPreset() method” on page 85
Moves the layer to the top of the composition (makes it the first layer).
Moves the layer to the bottom of the composition (makes it the last layer).
Moves the layer above another layer.
Copies the layer to the top (beginning) of another compo­sition.
Reports whether this layer will be active at a specified time.
Sets a new parent for this layer.
Applies a named collection of animation settings to the layer.

Layer active attribute

app.project.item(index).layer(index).active
Description
When true, the layer's video is active at the current time.
For this to be true, the layer must be enabled, no other layer may be soloing unless this layer is soloed too, and the time must be between the
This value is never true in an audio layer; there is a separate
Type
inPoint and outPoint values of this layer.
audioActive attribute in the AVLayer object.
Boolean; read-only.

Layer activeAtTime() method

app.project.item(index).layer(index).activeAtTime(time)
Description
Returns true if this layer will be active at the specified time. To return true, the layer must be enabled, no other layer may be soloing unless this layer is soloed too, and the time must be between the values of this layer.
inPoint and outPoint
84
JavaScript Reference Layer object
85
Parameters
time
Returns
The time in seconds, a floating-point value.
Boolean.

Layer applyPreset() method

appapp.project.item(index).layer(index).applyPreset(presetName);
Description
Applies the specified collection of animation settings (an animation preset) to the layer. Predefined animation preset files are installed in the Presets folder, and users can create new animation presets through the user interface.
Parameters
presetName
Returns
An ExtendScript File object for the file containing the animation preset.
Nothing.

Layer comment attribute

app.project.item(index).layer(index).comment
Description
A descriptive comment for the layer.
Type
String; read/write.

Layer containingComp attribute

app.project.item(index).layer(index).containingComp
Description
The composition that contains this layer.
Type
CompItem object; read-only.
85
JavaScript Reference Layer object
86

Layer copyToComp() method

app.project.item(index).layer(index).copyToComp(intoComp)
Description
Copies the layer into the specified composition. The original layer remains unchanged. Creates a new Layer object with the same values as this one, and prepends the new object to the CompItem. Retrieve the copy using
intoComp.layer(1).
Copying in a layer changes the index positions of previously existing layers in the target composition. This is the same as copying and pasting a layer through the user interface.
Parameters
layers collection in the target
intoComp
Returns
The target composition, and CompItem object.
Nothing.

Layer duplicate() method

app.project.item(index).layer(index).duplicate()
Description
Duplicates the layer. Creates a new Layer object in which all values are the same as in this one. This has the same effect as selecting a layer in the user interface and choosing Edit > Duplicate, except the selection in the user interface does not change when you call this method.
Parameters
None.
Returns
Layer object.

Layer enabled attribute

app.project.item(index).layer(index).enabled
Description
When true, the layer is enabled; otherwise false. This corresponds to the video switch state of the layer in the Timeline panel.
Type
Boolean; read/write.

Layer hasVideo attribute

app.project.item(index).layer(index).hasVideo
Description
When true, the layer has a video switch (the eyeball icon) in the Timeline panel; otherwise false.
86
JavaScript Reference Layer object
87
Type
Boolean; read-only.

Layer index attribute

app.project.item(index).layer(index).index
Description
The index position of the layer.
Type
Integer in the range [1..numLayers]; read-only.

Layer inPoint attribute

app.project.item(index).layer(index).inPoint
Description
The “in” point of the layer, expressed in composition time (seconds).
Type
Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.

Layer isNameSet attribute

app.project.item(index).layer(index).isNameSet
Description
True if the value of the name attribute has been set explicitly, rather than automatically from the source.
Type
Boolean; read-only.

Layer locked attribute

app.project.item(index).layer(index).locked
Description
When true, the layer is locked; otherwise false. This croplands to the lock toggle in the Layer panel.
Type
Boolean; read/write.

Layer moveAfter() method

app.project.item(index).layer(index).moveAfter(layer)
Description
Moves this layer to a position immediately after (below) the specified layer.
87
JavaScript Reference Layer object
88
Parameters
layer
Returns
The target layer, a layer object in the same composition.
Nothing.

Layer moveBefore() method

app.project.item(index).layer(index).moveBefore(layer)
Description
Moves this layer to a position immediately before (above) the specified layer.
Parameters
layer
Returns
The target layer, a layer object in the same composition.
Nothing.

Layer moveToBeginning() method

app.project.item(index).layer(index).moveToBeginning()
Description
Moves this layer to the topmost position of the layer stack (the first layer).
Parameters
None.
Returns
Nothing.

Layer moveToEnd() method

app.project.item(index).layer(index).moveToEnd()
Description
Moves this layer to the bottom position of the layer stack (the last layer).
Parameters
None.
Returns
Nothing.
88
JavaScript Reference Layer object
89

Layer name attribute

app.project.item(index).layer(index).name
Description
The name of the layer. By default, this is the same as the Source name (which cannot be changed in the Layer panel), but you can set it to be different.
Type
String; read/write.

Layer nullLayer attribute

app.project.item(index).layer(index).nullLayer
Description
When true, the layer was created as a null object; otherwise false.
Type
Boolean; read-only.

Layer outPoint attribute

app.project.item(index).layer(index).outPoint
Description
The “out” point of the layer, expressed in composition time (seconds).
Type
Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.

Layer parent attribute

app.project.item(index).layer(index).parent
Description
The parent of this layer; can be null.
Offset values are calculated to counterbalance any transforms above this layer in the hierarchy, so that when you set the parent there is no apparent jump in the layer's transform. For example, if the new parent has a rotation of 30 degrees, the child layer is assigned a rotation of -30 degrees.
To set the parent without changing the child layer's transform values, use the
Type
Layer object or null; read/write.
setParentWithJump method.
89
JavaScript Reference Layer object
90

Layer remove() method

app.project.item(index).layer(index).remove()
Description
Deletes the specified layer from the composition.
Parameters
None.
Returns
Nothing.

Layer selectedProperties attribute

app.project.item(index).layer(index).selectedProperties
Description
An array containing all of the currently selected Property and PropertyGroup objects in the layer.
Type
Array of PropertyBase objects; read-only.

Layer setParentWithJump() method

app.project.item(index).layer(index).setParentWithJump(newParent)
Description
Sets the parent of this layer to the specified layer, without changing the transform values of the child layer. There may be an apparent jump in the rotation, translation, or scale of the child layer, as this layer’s transform values are combined with those of its ancestors.
If you do not want the child layer to jump, set the
parent attribute directly. In this case, an offset is calculated
and set in the child layer's transform fields, to prevent the jump from occurring.
Parameters
newParent
Returns
A layer object in the same composition.
Nothing.

Layer shy attribute

app.project.item(index).layer(index).shy
Description
When true, the layer is “shy,” meaning that it is hidden in the Layer panel if the composition’s “Hide all shy layers” option is toggled on.
90
JavaScript Reference Layer object
91
Type
Boolean; read/write.

Layer solo attribute

app.project.item(index).layer(index).solo
Description
When true, the layer is soloed, otherwise false.
Type
Boolean; read/write.

Layer startTime attribute

app.project.item(index).layer(index).startTime
Description
The start time of the layer, expressed in composition time (seconds).
Type
Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.

Layer stretch attribute

app.project.item(index).layer(index).stretch
Description
The layer’s time stretch, expressed as a percentage. A value of 100 means no stretch. Values between 0 and 1 are set to 1, and values between -1 and 0 (not including 0) are set to -1.
Type
Floating-point value in the range [-9900.0..9900.0]; read/write.

Layer time attribute

app.project.item(index).layer(index).time
Description
The current time of the layer, expressed in composition time (seconds).
Type
Floating-point value; read-only.
91
JavaScript Reference LayerCollection object
92

LayerCollection object

app.project.item(index).layers
Description
The LayerCollection object represents a set of layers. The LayerCollection belonging to a CompItem object contains all the layer objects for layers in the composition. The methods of the collection object allow you to manipulate the layer list.
LayerCollection is a subclass of Collection. All methods and attributes of Collection, in addition to those
listed below, are available when working with LayerCollection. See “Collection object” on page 51.
Example
Given that the first item in the project is a CompItem and the second item is an AVItem, this example shows the number of layers in the CompItem's layer collection, adds a new layer based on an AVItem in the project, then displays the new number of layers.
var firstComp = app.project.item(1);
var layerCollection = firstComp.layers;
alert("number of layers before is " + layerCollection.length);
var anAVItem = app.project.item(2);
layerCollection.add(anAVItem);
alert("number of layers after is " + layerCollection.length);
Methods
Method Reference Description
add()
addNull()
addSolid()
addText()
addCamera()
addLight()
addShape()
byName()
precompose()
“LayerCollection add() method” on page 93
“LayerCollection addNull() method” on page 94
“LayerCollection addSolid() method” on page 94
“LayerCollection addText() method” on page 95
“LayerCollection addCamera() method” on page 93
“LayerCollection addLight() method” on page 93
“LayerCollection addShape() method” on page 94
“LayerCollection byName() method” on page 95
“LayerCollection precompose() method” on page 96
Creates a new AVLayer and adds it to this collection.
Creates a new, null layer and adds it to this collection.
Creates a new layer, a FootageItem with a SolidSource, and adds it to this collection.
Creates a new text layer and adds it to this collection.
Creates a new camera layer and adds it to this collection.
Creates a new light layer and adds it to this collection.
Creates a new shape layer and adds it to this collection.
Retrieves the layer object with a specified name.
Collects specified layers into a new composition.
92
JavaScript Reference LayerCollection object
93

LayerCollection add() method

app.project.item(index).layers.add(item, duration)
Description
Creates a new AVLayer object containing the specified item, and adds it to this collection.
This method generates an exception if the item cannot be added as a layer to this CompItem.
Parameters
item
duration
Returns
The AVItem object for the item to be added.
Optional, the length of a still layer in seconds, a floating-point value. Used only if the item contains a piece of still footage. Has no effect on movies, sequences or audio.
If supplied, sets the duration value of the new layer. Otherwise, the duration value is set according to user preferences. By default, this is the same as the duration of the containing CompItem. To set another preferred value, choose Edit > Preferences > Import (Windows) or After Effects > Preferences > Import (Mac OS), and spec­ify options under Still Footage.
AVLayer object.

LayerCollection addCamera() method

app.project.item(index).layers.addCamera(name, centerPoint)
Description
Creates a new camera layer and adds the CameraLayer object to this collection.
Parameters
name
centerPoint
A string containing the name of the new layer.
The center of the new camera, a floating-point array [x, y]. This is used to set the initial x and y values of the new camera’s Point of Interest property. The z value is set to 0.
Returns
CameraLayer object.

LayerCollection addLight() method

app.project.item(index).layers.addLight(name, centerPoint)
Description
Creates a new light layer and adds the LightLayer object to this collection.
Parameters
name
centerPoint
A string containing the name of the new layer.
The center of the new light, a floating-point array [x, y].
93
JavaScript Reference LayerCollection object
94
Returns
LightLayer object.

LayerCollection addNull() method

app.project.item(index).layers.addNull(duration)
Description
Creates a new null layer and adds the AVLayer object to this collection. This is the same as choosing Layer > New > Null Object.
Parameters
duration
Returns
Optional, the length of a still layer in seconds, a floating-point value.
If supplied, sets the preferences. By default, this is the same as the duration of the containing CompItem. To set another preferred value, choose Edit > Preferences > Import (Windows) or After Ef fects > Preferences > Import (Mac OS), and specify options under Still Footage.
duration value of the new layer. Otherwise, the duration value is set according to user
AVLayer object.

LayerCollection addShape() method

app.project.item(index).layers.addShape()
Description
Creates a new ShapeLayer object for a new, empty Shape layer. Use the ShapeLayer object to add properties, such as shape, fill, stroke, and path filters.
This is the same as using a shape tool in "Tool Creates Shape" mode. Tools automatically add a vector group that includes Fill and Stroke as specified in the tool options.
Parameters
None
Returns
ShapeLayer object.

LayerCollection addSolid() method

app.project.item(index).layers.addSolid(color, name, width, height, pixelAspect, duration)
Description
Creates a new SolidSource object, with values set as specified; sets the new SolidSource as the mainSource value of a new FootageItem object, and adds the FootageItem to the project. Creates a new AVLayer object, sets the new FootageItem as its
Parameters
color
The color of the solid, an array of four floating-point values, [R, G, B, A], in the range [0.0..1.0].
source, and adds the layer to this collection.
94
JavaScript Reference LayerCollection object
95
name
width
height
pixelAspect
duration
Returns
A string containing the name of the solid.
The width of the solid in pixels, an integer in the range [4..30000].
The height of the solid in pixels, an integer in the range [4..30000].
The pixel aspect ratio of the solid, a floating-point value in the range [0.01..100.0].
Optional, the length of a still layer in seconds, a floating-point value.
If supplied, sets the duration value of the new layer. Otherwise, the duration value is set according to user preferences. By default, this is the same as the duration of the containing CompItem. To set another preferred value, choose Edit > Preferences > Import (Windows) or After Effects > Preferences > Import (Mac OS), and specify options under Still Footage.
AVLayer object.

LayerCollection addText() method

app.project.item(index).layers.addText(sourceText)
Description
Creates a new text layer and adds the new TextLayer object to this collection.
Parameters
sourceText
Returns
Optional; a string containing the source text of the new layer, or a TextDocument object contain­ing the source text of the new layer. See “TextDocument object” on page 171.
TextLayer object.

LayerCollection byName() method

app.project.item(index).layers.byName(name)
Description
Returns the first (topmost) layer found in this collection with the specified name, or null if no layer with the given name is found.
Parameters
name
Returns
Layer object or null.
A string containing the name.
95
JavaScript Reference LayerCollection object
96

LayerCollection precompose() method

app.project.item(index).layers.precompose(layerIndicies, name, moveAllAttributes)
Description
Creates a new CompItem object and moves the specified layers into its layer collection. It removes the individual layers from this collection, and adds the new CompItem to this collection.
Parameters
layerIndices
name
moveAllAttributes
Returns
CompItem object.
The position indexes of the layers to be collected. An array of integers.
The name of the new CompItem object.
Optional. When true (the default), retains all attributes in the new composition. This is the same as selecting the “Move all attributes into the new composition” option in the Pre-compose dialog box.
You can only set this to false if there is just one index i n the layerIndices array. This is the same as selecting the “Leave all attributes in” option in the Pre-com­pose dialog box.
96
JavaScript Reference LightLayer object
97

LightLayer object

app.project.item(index).layer(index)
Description
The LightLayer object represents a light layer within a composition. Create it using the LayerCollection object’s item’s layer collection either by index number or by a name string.
AE Properties
LightLayer defines no additional attributes, but has different AE properties than other layer types. It has the following properties and property groups:
Marker
Transform
Light Options
addLight method; see “LayerCollection addLight() method” on page 93. It can be accessed in an
LightLayer is a subclass of Layer. All methods and attributes of Layer are available when working with Light-
Layer. See “Layer object” on page 83.
Point of Interest
Position
Scale
Orientation
X Rotation
Y Rotation
Rotation
Opacity
Intensity
Color
Cone Angle
Cone Feather
Casts Shadows
Shadow Darkness
Shadow Diffusion
97
JavaScript Reference MarkerValue object
98

MarkerValue object

new MarkerValue(comment, chapter, url, frameTarget, cuePointName, params)
Description
The MarkerValue object represents a layer marker, which associates a comment, and optionally a chapter reference point, Web-page link, or Flash Video cue point with a particular point in a layer. Create it with the constructor; all arguments except sponding attributes of the returned MarkerValue object, except pairs., which can then be accessed with the number of parameter pairs; the order does not reflect the order displayed in the application.
comment are optional. All arguments are strings that set in the corre-
params. This is an array containing key-value
getParameter() and setParameter() methods. A script can set any
To associate a marker with a layer, set the MarkerValue object in the
layerObject.property("Marker").setValueAtTime(time, markerValueObject);
Marker AE property of the layer:
For information on the usage of markers see “Using markers” in After Effects Help.
Attributes
Attribute Reference Description
comment
chapter
cuePointName
eventCuePoint
url
frameTarget
Methods
Method Reference Description
“MarkerValue comment attribute” on page 99
“MarkerValue chapter attribute” on page 99
“MarkerValue cuePointName attribute” on page 99
“MarkerValue eventCuePoint attribute” on page 99
“MarkerValue getParameters() method” on page 100
“MarkerValue eventCuePoint attribute” on page 99
A comment on the associated layer.
A chapter link reference point for the associated layer.
The Flash Video cue point name.
Whether the Flash Video cue point is for an event or navigation.
A URL for Web page to be associated with the layer.
A specific frame target within the Web page specified by url.
getParameters()
setParameters()
Examples
“MarkerValue getParameters() method” on page 100
“MarkerValue setParameters() method” on page 100
Retrieves the key-value pairs associated with the marker value.
Sets the key-value pairs associated with the marker value.
To set a marker that says “Fade Up” at the 2 second mark:
var myMarker = new MarkerValue("Fade Up");
myLayer.property("Marker").setValueAtTime(2, myMarker);
To get comment values from a particular marker:
var commentOfFirstMarker = app.project.item(1).layer(1).property("Marker").keyValue(1).comment;
var commentOfMarkerAtTime4 =
app.project.item(1).layer(1).property("Marker").valueAtTime(4.0,true).comment
98
JavaScript Reference MarkerValue object
99
var markerProperty = app.project.item(1).layer(1).property("Marker");
var markerValueAtTimeClosestToTime4 =
markerProperty.keyValue(markerProperty.nearestKeyIndex(4.0));
var commentOfMarkerClosestToTime4 = markerValueAtTimeClosestToTime4.comment;

MarkerValue chapter attribute

app.project.item(index).layer(index).property("Marker").keyValue(index).chapter
Description
A text chapter link for this marker. Chapter links initiate a jump to a chapter in a QuickTime movie or in other formats that support chapter marks.
Type
String; read/write.

MarkerValue comment attribute

app.project.item(index).layer(index).property("Marker").keyValue(index).comment
Description
A text comment for this marker. This comment appears in the Timeline panel next to the layer marker.
Type
String; read/write.

MarkerValue cuePointName attribute

app.project.item(index).layer(index).property("Marker").keyValue(index).cuePointName
Description
The Flash Video cue point name, as shown in the Marker dialog.
Type
String; read/write.

MarkerValue eventCuePoint attribute

app.project.item(index).layer(index).property("Marker").keyValue(index).eventCuePoint
Description
When true, the FlashVideo cue point is for an event; otherwise, it is for navigation.
Type
Boolean; read/write.
99
JavaScript Reference MarkerValue object
100

MarkerValue frameTarget attribute

app.project.item(index).layer(index).property("Marker").keyValue(index).frameTarget
Description
A text frame target for this marker. Together with the URL value, this targets a specific frame within a Web page.
Type
String; read/write.

MarkerValue getParameters() method

app.project.item(index).layer(index).property("Marker").keyValue(index).getParameters()
Description
Returns the key-value pairs for Flash Video cue-point parameters, for a cue point associated with this marker value.
Parameters
None.
Returns
An object with an attribute matching each parameter name, containing that parameter’s value.

MarkerValue setParameters() method

app.project.item(index).layer(index).property("Marker").keyValue(index).setParameters(keyValuePairs)
Description
Associates a set of key-value pairs for Flash Video cue-point parameters, for a cue point associated with this marker value. A cue point can have any number of parameters, but you can add only three through the user interface; use this method to add more than three parameters.
Parameters
keyValuePairs
Returns
Nothing.
An object containing the key-value pairs as attributes and values. The object’s toString() method is called to assign the string value of each attribute to the named key.
Example
var mv = new MarkerValue("My Marker");
var parms = new Object;
parms.timeToBlink = 1;
parms.assignMe = "A string"
mv.setParameters(parms);
100
Loading...