Scripting Guide PDF
Scripting Guide PDF
Using Help
About Help
Adobe Systems Incorporated provides complete documentation in an Adobe PDF-based
help system. This help system includes information on all tools, commands, and features
of an application. It is designed for easy on-screen navigation and can also be printed and
used as a desktop reference. Additionally, it supports third-party screen-reader applica-
tions that run in a Windows environment.
Navigating in Help
Help opens in an Adobe Acrobat window with the Bookmarks pane open. (If the
Bookmarks pane is not open, click the Bookmarks tab at the left edge of the window.) At
the top and bottom of each page is a navigation bar containing links to this page (Using
Help), the table of contents (Contents), and the index (Index).
To move through pages sequentially, you can click the Next Page and the Previous
Page arrows; click the navigation arrows at the bottom of the page; or click Back to
return to the last page you viewed.
You can navigate Help topics by using bookmarks, the table of contents, the index, or the
Search (Acrobat 6) or Find (Acrobat 5) command.
To find a topic using bookmarks:
1 In the Bookmarks pane, click the plus sign (+) (Windows) or the right-facing arrow (Mac
OS) next to a bookmark topic to view its subtopics.
2 Click the bookmark to go to that topic.
To find a topic using the table of contents:
1 Click Contents in the navigation bar.
2 On the Contents page, click a topic to go to that topic.
3 To view a list of subtopics, click the plus sign (+) (Windows) or the right-facing arrow
(Mac OS) next to the topic name in the Bookmarks pane.
To find a topic using the index:
1 Do one of the following:
• Click Index in the navigation bar, and then click a letter at the top of the page.
• Ιn the Bookmarks pane, expand the Index bookmark to view the letter subtopics; then
click a letter.
2 Locate the entry you want to view, and click the page number to go to that topic.
3 To view other entries for the same topic, click Back to return to the same place in the
index, and then click another page number.
Printing Help
Although Help is optimized for on-screen viewing, you can print selected pages or the
entire file.
To print Help:
Choose File > Print, or click the Print icon in the Acrobat toolbar.
Overview
The Adobe After Effects 6.5 Render Automation & Scripting Guide demonstrates how to take procedural control
of your After Effects projects via scripting. This feature set is available only in Adobe After Effects 6.5 Profes-
sional 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.
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 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.
For detailed information on the JavaScript Debugger, see “JavaScript Debugging” on page 15.
Writing Scripts
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.
The heart of a scriptable application is the object model. In After Effects, the object model is composed of
projects, 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. For more resources for
learning scripting, see “More resources to learn scripting” on page 8.
Editing scripts
After Effects 6.5 does not include a script editor. You can use any text editor to create, edit, and save scripts,
but it is recommended that you choose an application 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]).
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 succeeding scripts during a given After Effects session. Once the application is quit, all such
globally defined variables and functions are cleared.
Please note that this persistence of global settings also means that if you are not careful about giving variables
in scripts unique names, you can inadvertently reassign global variables intended to persist throughout a
session.
Properties can also be embedded in existing objects such as the Application object (see “Application object”
on page 26) 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.
Alternatively, you could specify the location of the .jsx file to be executed, as follows:
a f te r f x . exe – r c : \ my D o c u m e n t s \ S c r i p t s \ yo u r A E S c r i p t He re . j s x
te l l a p p l i c a t i o n “Ad o b e After E f f e c t s 6 . 5 ”
DoScr ipt “aler t (\”You just sent an aler t to Af ter Effects\”)”
e n d te l l
Alternatively, you could display a dialog box asking for the location of the .jsx file to be executed, as follows:
s e t t h e fi l e to cho o s e fi l e
te l l a p p l i c a t i o n “Ad o b e Af ter E f f e c t s 6 . 5 ”
D o S c r i p t t h e fi l e
e n d te l l
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:
(*
T h i s s c r i p t s e n d s t h e c u r ren t s e l e c t i o n to After E f f e c t s a s a s c r i p t .
*)
te l l a p p l i c a t i o n “ Tex t E d i t”
s e t t h e _ s c r i p t to s e l e c t i o n a s tex t
e n d te l l
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).
default label used in a switch statement when a case label is not found
do - whil e Standard JavaScript construct. Similar to the w h i l e loop, except loop condition evaluation occurs
at the end of the loop.
for - in Standard JavaScript construct. Provides a way to easily loop through the properties of an object.
nu l l Assigned to a variable, array element, or object property to indicate that it does not contain a legal
value.
sw i tch Standard JavaScript way of evaluating an expression and attempting to match the expression's
value to a ca s e label.
undefined Indicates that the variable, array element, or object property has not yet been assigned a value.
while Standard JavaScript construct. Similar to the d o - w h i le loop, except loop condition evaluation
occurs at the beginning of the loop.
w ith Standard JavaScript construct used to specify an object to use in ensuing statements.
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.
Operators Description
. Structure member.
[] Array element.
() Function call.
++ Pre- or post-increment.
-- Pre- or post-decrement.
~ Bitwise NOT.
! Logical NOT.
* Multiply.
/ Divide.
% Modulo division.
+ Add.
== Equal.
!= Not equal.
^ Bitwise XOR.
| Bitwise OR.
|| Logical OR.
?: Conditional (ternary).
= Assignment.
Operators Description
, Multiple evaluation.
*, / , % left to right
== , ! = left to right
^ left to right
| left to right
|| left to right
?: right to left
, left to right
Usage
The command-line application aerender renders After Effects compositions. The render may be performed
either by an already running instance of After Effects or by a newly invoked instance. By default, aerender will
invoke a new instance of After Effects, even if one is already running. To change this, see the "-reuse" flag in
the following “Arguments” below.
Arguments
From the command line aerender takes a series of optional arguments that are added following the executable
command (i.e. aerender.exe). Some are single flags, like "-reuse". Some come in flag-argument pairs, like "-
project project_path". And one comes in a triplet, -mem_usage image_cache_percent max_mem_percent.
With 0 arguments, or with any argument equaling "-help", aerender prints a usage message with the infor-
mation contained in this section.
Argument Usage
If the comp is in the project but not in the render queue, then it is
added to the render queue and rendered.
Argument Usage
Argument Usage
Examples
aeren d er - p ro j ect c: \ p ro j ects\ p ro j 1. ae p - comp "Comp 1" -output c:\output\pro j1\pro j1.av i
JavaScript Debugging
This section describes the JavaScript Debugger, which appears when the Enable JavaScript Debugger
preference is selected in General Preferences (it is deselected by default) and there is an error when executing
a script.
A B C D E F G H
The current stack trace appears in the upper-left pane of the JavaScript Debugger window. This Stack Trace
view displays the calling hierarchy at the time of the breakpoint. Double-clicking a line in this view changes
the current scope, enabling you to inspect and modify scope-specific data.
All debugging output appears in the upper-right pane of the JavaScript Debugger window. Specifically, output
from the print method of the $ object appears in this Debug Output view.
The currently executing JavaScript source appears in the lower pane of the JavaScript Debugger window.
Double-clicking a line in this JavaScript Source view sets or clears an unconditional breakpoint on that line.
That is, if a breakpoint is in effect for that line, double-clicking it clears the breakpoint, and vice-versa. The
line number display on the left part displays a red dot for all lines with a breakpoint.
If Enable JavaScript Debugger is deselected in General Preferences, you see an error message but not the
JavaScript Debugger itself. This is the typical setup used in situations in which professional roles are divided
between those writing and administering scripts (technical directors, system administrators, and so on) and
those using them (the artist or animators). If you are writing and debugging your own scripts, you will want
to enable the JavaScript Debugger.
Resume
Ctrl+R (Windows)
Command+R (Mac OS)
Resume execution of the script with the JavaScript Debugger window open. When the script terminates, the application closes the Jav-
aScript Debugger window automatically. Closing the window manually also causes script execution to resume. This button is enabled
when script execution is paused or stopped.
Pause
Ctrl+P (Windows)
Command+P (Mac OS)
Halt the currently executing script temporarily and reactivate the JavaScript Debugger. This button is enabled when a script is running.
,,Ray, funnyy wrapping on this line . . . -cj>>
Stop
Ctrl+K (Windows)
Command+K (Mac OS)
Stop execution of the script and generate a runtime error. This button is enabled when a script is running.
Step Over
Ctrl+S (Windows)
Command+S (Mac OS)
Halt after executing a single JavaScript statement in the script; if the statement calls a JavaScript function, execute the function in its
entirety before stopping.
Step Into
Ctrl+T (Windows)
Command+T (Mac OS)
Halt after executing a single JavaScript statement in the script or after executing a single statement in any JavaScript function that the
script calls.
Step Out
Ctrl+U (Windows)
Command+U (Mac OS)
When the JavaScript Debugger is paused within the body of a JavaScript function, resume script execution until the function returns.
When the JavaScript Debugger is paused outside the body of a function, resume script execution until the script terminates.
Setting breakpoints
You can set breakpoints in the JavaScript Debugger itself, by calling methods of the $ object, or by defining
them in your JavaScript code.
b ox . w i d t h = 4 8 ;
b ox . h e i g h t = 4 8 ;
b ox . u r l = "none";
}
To execute a breakpoint in runtime code, call the $.bp() method, as shown in the following example:
f u n c t i o n s e t u p B ox ( b ox ) {
b ox . w i d t h = ( b ox . w i d t h = = u n d e fi n e d ) ? $ . b p ( ) : 4 8 ;
b ox . h e i g h t = ( b ox . h e i g h t = = u n d e fi n e d ) ? $ . b p ( ) : 4 8 ;
b ox . u r l = ( b ox . u r l = = u n d e fi n e d ) ? $ . b p ( ) : " n o n e " ;
}
This example breaks into the JavaScript Debugger if any of the width, height, or url attributes of the custom
element are undefined. Of course, you wouldn’t put bp method calls into production code—it’s more appro-
priate for shipping code to set default values for undefined properties, as the previous example does.
1 Click New to create a new breakpoint, or click the breakpoint that you wish to edit.
2 Enter a line number in the Line Number field, or change the existing line number.
3 Optionally, enter a condition such as (i>5) in the Condition field. This can be any valid JavaScript
expression. If the result of evaluating the expression is true, the breakpoint activates.
The $ object
The $ object (Debugger Object) provides properties and methods you can use to debug your JavaScript code.
For example, you can call its methods to set or clear breakpoints programmatically, or to change the language
flavor of the script currently executing. It also provides properties that hold information about the version of
the host platform’s operating system.
Note: The $ object is not a standard JavaScript object.
Properties
er ror Error Retrieve the last runtime error. Reading this property returns an Error
object containing information about the last runtime error.
version String Returns the version number of the JavaScript engine as a three-part num-
ber like e.g. "3.1.11". Read only.
Write the given string to the Debug Output window. The writeln method appends a New Line character to its
arguments.
Parameters
Returns
None.
Clear a breakpoint. The breakpoint is defined by the name of the scriptlet or function and the line number. If
the scriptlet name is the empty string or is missing, the name of the currently executing scriptlet is used. If the
line number is zero or not supplied, the current line number is used. Thus, the call $.clearbp() without param-
eters clears a breakpoint at the current position.
The special string "NEXTCALL" as the scriptlet name causes the engine to clear a breakpoint at the next
function call.
Parameters
Returns
None.
Execute a breakpoint at the current position. Optionally, a condition may be supplied. The condition is a
JavaScript expression string that is evaluated before the breakpoint is executed. The breakpoint is executed
only if the expression returns true. If no condition is given, the use of the debugger statement is recommended
instead as it is a more widely supported JavaScript standard statement.
Parameters
con d i ti o n String An optional JavaScript expression string that is evaluated before the
breakpoint is executed. The expression needs to evaluate to the equivalent
of true in order to activate the breakpoint.
Returns
None.
Initiate a garbage collection. Garbage collection is the process by which the JavaScript interpreter cleans up
memory it is no longer using. This is done automatically. Occasionally when you’re debugging a script, it may
be useful to call this process.
Returns
None.
Reference
This chapter lists and describes syntax (keywords, statements, operators,classes, objects, methods, attributes,
and global functions) particular to the After Effects scripting engine.
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, please refer to Ecma-262.pdf, available at www.ecma-
international.org/publications/standards/ECMA-262.HTM
For an overview of the most common keywords and statements available from ECMA-262, see “Keywords and
statement syntax” on page 9.
renderQueue item(s)
layer(s) ITEM(S)
proxySource mainSource proxySource
renderQueueItem(s)
properties mainSource & proxySource
may be any of the following 3 types of item:
outputModule(s)
solidSource OR placeholderSource OR fileSource
color file
The hierarchy of objects in scripting corresponds to the hierarchy in the user interface. The Application contains a Project window that
contains a Composition with a Layer. The source for the Layer can be a footage file, placeholder, or solid, and it is also listed in the Project
window. The Layer in turn contains settings known as Properties, and these can hold individual keyframes. The Render Queue contains
Render Queue Items as well as Render Settings and Output Modules. All of these rules are directly analogous to scripting.
Global functions
This section describes globally available functions that are specific to After Effects. Any JavaScript object or
function can call the functions in this section.
Functions
aler t() see “alert() global function” on page 23 displays an alert dialog displaying a specified
text string
prompt() see “prompt() global function” on opens a dialog box with a text field into which
page 25 the user can enter a text string
w r i te() see “write() global function” on page 26 writes output to the Info palette, with no line
break added
w r i teL n () see “writeLn() global function” on writes output to the info palette, adding a line
page 26 break at the end
con fi r m() see “confirm() global function” on prompts the user with a modal dialog and yes/
page 24 no buttons which clear the dialog and return a
boolean
fi l e G e t D i a l o g ( ) see “fileGetDialog() global function” on presents the platform’s standard Open dialog
page 24 box
fi l e Pu t D i a l o g ( ) see “filePutDialog() global function” on presents the platform’s standard Save dialog
page 24 box
folderGetDialog() see “folderGetDialog() global function” displays a dialog in which the user can select a
on page 25 folder
Description
The Alert global function opens an alert dialog that can contain a text alert. The user then has the option of
clicking OK to close the window.
Parameters
text text string that is displayed in the dialog, which can display up to 240 characters
Example
aler t ( "CoSA Lives!");
Description
The clearOutput global function clears the output in the info palette.
Parameters
None.
Description
The Confirm global function prompts the user with a modal dialog and yes/no buttons that clear the dialog.
These return a boolean; true if yes, false if no.
Parameters
text text string; Mac OS user interface can display 256 characters, Windows, 30 characters
Returns
Boolean.
Example
var shouldAdd = confir m("Add to Render Queue?");
if ( s ho u l d Ad d == "t r u e"){
proj.renderQueue.items.add(myCompItem);
}
Description
The fileGetDialog global function presents the Open dialog box that is standard for the platform on which
After Effects is running.
The typeList is a semicolon-separated list of four-character Mac OS file types followed by Windows file exten-
sions. For example, a value of "EggP aep" for this argument specifies that the Open dialog box is to display
After Effects project items only; other file types will be grayed out.
Parameters
prompt message that displays on the title bar of the dialog; truncated if too long
Returns
Description
The filePutDialog global function presents the Save dialog box that is standard for the platform on which After
Effects is running.
Parameters
prompt message that appears on the title bar of the dialog; truncated if too long
default default file name to display in the file-saving dialog; this value must observe the file-naming
conventions of the platform on which After Effects is running
Returns
Description
The folderGetDialog global function displays a dialog in which the user can select a folder.
Parameters
prompt message that appears on the title bar of the dialog; truncated if too long
Returns
Description
The prompt global function opens a dialog box with a text field into which the user can enter a text string. The
text string is returned as a value, or is null if the dialog is cancelled.
Parameters
Returns
Example
// presuming a project loaded w ith at least one comp is open:
var my CompItem = app. project.item(1);
var newName = prompt( "What would you like to name the comp?");
// ren a me it
i f ( n e w Na m e ) { / / i f t h e u s e r c a n ce l s , n e w Na m e i s nul l
myComp Item. n a me = n ewNa me; / / n e w Na m e n ow h old s a s t r i n g
}
Description
The write global function writes output to the Info palette, with no line break added.
Parameters
text text string; truncated if too long for the info palette
Example
w r i te ( “ T h i s tex t a p p e a r s i n In f o p a l e t te .” ) ;
See also
Description
The write global function writes output to the info palette and adds a line break at the end.
Parameters
Example
w r iteLn(“ This line of text appears in the console w indow w ith a line break at the end.”);
See also
Application object
app.
Description
The application (app) global object enables access to data and functionality within the After Effects appli-
cation. Attributes of the Application object provide access to specific objects within After Effects. Methods of
the Application object can create documents, open existing documents, 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
p ro j e c t see “Application project attribute” on instance of the current After Effects Project
page 34 and “Project object” on and all of its associated methods & attributes
page 121
language see “Application language attribute” on identifies the language in which the applica-
page 32 tion is running
version see “Application version attribute” on identifies the version number of the After
page 36 Effects application
ser ialNumber see “Application serialNumber identifies the serial number of the After Effects
Attribute” on page 35 installation
re g isteredName see“Application registeredName identifies the name to which the After Effects
attribute” on page 35 installation is registered
re g isteredCompany see “Application registeredCompany identifies the company to which the After
attribute” on page 35 Effects installation is registered
buildName see “Application buildName attribute” identifies the name of this build of the applica-
on page 29 tion
buildNumber see “Application buildNumber identifies the number of this build of the appli-
attribute” on page 29 cation
isProfessionalVersion see “Application isProfessionalVersion identifies if the After Effects version is the Pro-
attribute” on page 31 fessional Version
isWatch Folder see “Application isWatchFolder boolean that returns true when the local appli-
attribute” on page 31 cation is running in Watch Folder mode
isRenderEng ine see “Application isRenderEngine identifies whether the local After Effects appli-
attribute” on page 31 cation is installed as a render engine
settings see “Application settings attribute” on calls settings within After Effects that can be
page 36 and “Settings object” on set via scripting
page 170
onEr ror see “Application onError attribute” on a callback that is called when an error occurs in
page 33 the application
ex itCo d e see “Application exitCode attribute” on Used only when executing script externally
page 31 (i.e., from a command line or AppleScript). Set
to zero, indicates no error occurred; set to a
positive number, indicates an error occurred
while running the script.
Methods
n e w Pro j e c t ( ) see “Application newProject() method” opens a new project in After Effects
on page 32
open() see “Application open() method” on opens a project or an Open Project dialog
page 33
watchFolder() see “Application watchFolder() method” starts watch-folder mode; does not return until
on page 37 watch-folder mode is turned off
purge() see “Application purge() method” on purges a targeted type of cached information
page 34 (replicates Purge options in the Edit menu)
b e g i n Un d o Gro u p ( ) see “Application beginUndoGroup() groups the actions that follow it into a single
method” on page 28 undoable step
endUndoGroup() see “Application endUndoGroup() ends an undo group; needed only when one
method” on page 29 script contains more than one undo group
endSuppressDialog s() see “Application endSuppressDialogs() ends suppression of dialogs in the user inter-
method” on page 29 face
setMemor yUsageLimits() see “Application setMemoryUsageLim- sets memory usage limits as in the Cache pref-
its() method” on page 36 erences tab
setSavePreferencesOnQuit() see “Application setSavePreferencesOn- sets whether Preferences are saved when the
Quit() method” on page 36 application is quit
Description
Parameters
None.
Returns
None.
Description
An undo group allows a script to logically group all of its actions as a single undoable action (for use with the
Edit Undo/Redo menu items). Should be used in conjunction with the application.endUndoGroup() method.
Please note that beginUndoGroup() and endUndoGroup() pairs can be nested. Groups within groups become
part of the larger group, and will undo correctly. In such cases, the names of inner groups are ignored.
Parameters
undoSt r ing (mandatory) the text that will appear for the Undo command in the Edit menu (i.e.,“Undo undoSt r ing ”)
See also
Description
The buildName attribute identfies the name of the build of After Effects being run. This attribute is used
primarily by Adobe for testing and troubleshooting purposes.
Type
String; read-only.
Description
The buildNumber attribute identfies the number of the build of After Effects being run. This attribute is used
primarily by Adobe for testing and troubleshooting purposes.
Type
Integer; read-only.
Description
This method ends the suppression of dialogs in the user interface. It should be called only if beginSuppress-
Dialogs() has previously been called.
If the input argument 'alert' is true, and any errors occurred between the calls to beginSuppressDialogs() and
endSuppressDialogs(), then a dialog will be presented to the user displaying that error message.
Parameters
aler t boolean; specifies whether errors that have occurred following beginSuppressDialogs() should be dis-
played
See also
Description
This ends the 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.
Calling this method without having set a beginUndoGroup() method yields an error.
Parameters
None.
Returns
None.
See also
Description
Parameters
None
See also
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 - r or - s command line flag will cause the application to run a script
(from a file and 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.
Note that this attribute only has an effect when After Effects is run, and it has no effect on Mac OS.
Type
Boolean; read/write.
Description
The exitCode attribute is used only when executing a script from outside After Effects (i.e., from a command
line or AppleScript).
On Mac OS and Windows, the exitCode is set to 0 (EXIT_SUCCESS) at the beginning of each script evalu-
ation. In the event of an error while the script is running, it will be set to a positive integer.
Type
Integer; read/write.
Example
app. exitCode = 2; //on quit, if value is 2, no er ror has occur re d
Description
The isProfessionalVersion attribute is a boolean used to determine if the locally installed After Effects appli-
cation is the Standard or Professional version.
Type
Boolean; read-only.
Example
v a r P B = a p p. i s Pro d u c t i o n Bu n d l e ;
a l e r t ( " It i s " + P B + " t h a t yo u a re r u n n i n g t h e Pro d u c t i o n Bu n d l e . " ) ;
Description
The isRenderEngine attribute is a boolean used to determine if an installation of After Effects is a Render
Engine only installation.
Type
Boolean; read-only.
Description
The isWatchFolder attribute is a boolean used to determine if the Watch Folder dialog is currently displayed
(and the application is currently watching a folder for rendering). This returns true when the Watch Folder
dialog is open.
Type
Boolean; read-only.
Description
The language attribute indicates in which language After Effects is running. The codes for the language
attribute are as follows:
• Language.ENGLISH
• Language.FRENCH
• Language.GERMAN
• Language.JAPANESE
Type
Example
var lang = app.language;
if (lang == Language.JAPANESE){
ale r t("After E ffects is r u n n in g i n Jap a n e s e . " ) } ;
else i f (l a n g == L a n g u a g e. E N GL I S H ) {
ale r t("After E ffects is r u n n in g i n E n g li s h . " ) } ;
else i f (l a n g == L a n g u a g e. FR E N C H ){
aler t("After Effects is r unning in French.")};
else{
aler t("After Effects is r unning in Ger man.")
};
Description
The newProject method opens a new project in After Effects, replicating the File > New > New Project menu
command. If a project is already open and has been edited, the user will be prompted to save.
Use app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES) to close an open project before opening
a new one.
Parameters
None.
Returns
Project object; null if the user cancels a Save dialog in response to having an open project that has been edited
since the last save.
Example
app. p ro j ect. cl o se(C l o seOp ti o n s. D O_N OT _ S AV E _ C HAN G E S ) ;
a p p. n e w Pro j e c t ( ) ;
See also
Description
The onError attribute takes a function to perform an action when an error occurs. By creating a function and
assigning it to onError, you can respond to the error systematically, e.g., close and restart the application,
noting the error in a log file if it occurred during rendering.
Type
Example
function er r(er rSt r ing) (
aler t(er rSt r ing);
)
app. onEr ror = er r
Description
The open() method opens a project. If the file parameter is null (i.e., if no argument is used) the user will be
presented with a dialog to select and open a file.
Parameters
Returns
Project object (the file specified as a parameter), or null if the user cancels the Open dialog.
Example
var my_file = new File("../my_folder/my_test.aep");
if ( my _ fi l e. exist){
new_pro ject = app. open(my_file);
i f ( n e w _ p ro j e c t ) {
a l er t(n ew_ p ro j ect. fi l e. n a me);
}
}
Description
The pauseWatchFolder() method pauses searching the target folder for render items.
Parameters
See also
Description
Type
Project; read-only.
Description
The purge method replicates the functionality and target options of the Purge options within the Edit menu.
The target parameter contains the area of memory to be purged; the options for target are listed as enumerated
variables below.
Parameters
target the type of elements to purge from memory; use one of Enumerated Types below
Enumerated Types
PurgeTarget.ALL_CACHES purges all data that After Effects has cached to physical memory
Purg eTa rg et. U N D O_ C AC H E S purges all data saved in the undo cache
Purg eTa rg et. S NA P S H OT_ C AC H E S purges all data cached as comp/layer snapshots
Description
Parameters
None.
Returns
None.
Description
Text string; name (if any) that the user of the application entered as the registered company at the time of
installation.
Type
Example
var company = app. re g isteredCompany ;
aler t(“Your company name is “ + company + “.”);
Description
The registeredName attribute contains the text string that the user of the application entered for the registered
name at the time of installation.
Type
Example
var userName = app. re g isteredName;
confir m(“Are you “ + userName + “?”);
Application serialNumber Attribute
app.ser ialNumber
Description
The serialNumber attribute contains an alphanumeric string that is the serial number of the installed version
of After Effects.
Type
String; read-only.
Example
var ser ial = app.ser ialNumber ;
aler t("This copy is ser ial number " + ser ial);
Description
This method sets memory usage limits as in the Cache preferences tab.
Parameters
Returns
None.
Description
This method sets the toggle that determines whether preferences are saved when the application is closed
(quit).
Parameters
Returns
None.
Description
Type
Settings; read-only.
Description
The version attribute returns an alphanumerical string indicating which version of After Effects is running.
Type
String; read-only.
Example
var ver = app. version;
aler t("This machine is r unning version " + ver + " of Af ter Effects.");
Description
The watchFolder() method starts a watch folder (network rendering) process pointed at a specified folder.
Parameters
Example
var theFolder = new Folder(“c:\\tool”);
app.watchFolder(theFolder);
See also
AVItem object
app. project. item( i n d e x )
Description
The AVitem object provides access to attributes and methods of audio/visual files imported into After Effects.
AVItem is the base class for both CompItem and FootageItem, so AVItem attributes and methods are also
available when working in CompItem and FootageItem.
Attributes
n am e see “AVItem name attribute” on page 41 name of the object as shown in the Project
window
w id th see “AVItem width attribute” on page 44 integer [1 ..30,000] describing the width, in pix-
els of the item
heig ht see “AVItem height attribute” on integer [1 .. 30,000] describing the height, in
page 41 pixels of the item
p i xe l Asp e c t see “AVItem pixelAspect attribute” on pixel aspect ratio; floating-point value [0.01
page 41 ..100]
frameDuration see “AVItem frameDuration attribute” frame rate for the AVItem [1/99 .. 1 ]
on page 39
dur at i on see “AVItem duration attribute” on duration of the AVItem, in seconds [0 .. 10,800]
page 39
proxySource see “AVItem proxySource attribute” on FootageItem used as proxy of the AVItem;
page 42 read-only
time see “AVItem time attribute” on page 44 current time of the AVItem in seconds
u s e d In see “AVItem usedIn attribute” on array containing all the CompItems that use
page 44 this AVItem
h a s Vi d e o see “AVItem hasVideo attribute” on true if the AVItem has an audio component
page 40
has Au d io see “AVItem hasAudio attribute” on true if the AVItem has a video component
page 40
footageMissing see “AVItem footageMissing attribute” true if the AVItem cannot be found or if it is a
on page 39 placeholder
n am e see “Item name attribute” on page 98 name of the object as shown in the Project
window
s e l e c te d see “Item selected attribute” on page 99 true if this item is currently selected
Methods
s e t Prox y ( ) see “AVItem setProxy() method” on sets a proxy for the AVItem
page 42
set Proxy Wi thS equ en ce() see “AVItem setProxyWithSequence() sets a sequence as a proxy for the AVItem
method” on page 43
s e t Prox y Wi t h S o l i d ( ) see “AVItem setProxyWithSolid() sets a solid as a proxy (feature available only via
method” on page 43 scripting)
set Proxy Wi thP l a ceho l d er() see “AVItem setProxyWithPlaceholder() sets a placeholder as a proxy
method” on page 42
set Proxy To No n e() see “AVItem setProxyToNone() method” removes the proxy
on page 42
rem ove() see “Item remove() method” on page 99 deletes the item from the project
Description
The duration attribute returns the duration, in seconds, of the item. This attribute is read-only unless it is a
CompItem.
Permissible range of values is [0..10,800]. In a FootageItem, duration is linked to the duration of the
mainSource; in a CompItem, it is linked to the duration of the composition. This value may be written only
in a CompItem. It is an error to change this value if the item is a FootageItem.
Note: Still footage items have a duration of 0.
Type
Description
Type
Boolean; read-only.
Description
The frameDuration attribute returns the length, in seconds, of a frame for this AVItem.
Permitted range is [1/99 .. 1 ]. This is the reciprocal of frameRate. When you set the frameDuration, you are
really storing the reciprocal as a new frameRate.
When you read the value back, you are retrieving the reciprocal of the frameRate. Hence, if you set and then
get the value to be a frameDuration that does not evenly divide into 1.0 (for example, 0.3), the value you get
back will be close, but not exactly equal; due to numerical limitations, (1 / ( 1 / 0.3) ) != 0.3, but rather
something close to 0.3.
If the AVItem is a FootageItem, then this attribute is readOnly.
In the case of a FootageItem, you must write to the conformFrameRate of the mainSource in order to change
the frameRate, and hence the frameDuration.
Type
Description
Type
Description
Type
Boolean; read-only.
Description
Type
Boolean; read-only.
Description
Type
Description
The name attribute is the name of the object as shown in the Project window.
In a FootageItem, the name is linked to the mainSource.
It is an error to attempt to change the name if the mainSource is a FileSource; in that case, the name is tied to
the name of the file(s) and may not be changed.
Type
String; read/write.
Description
The pixelAspect attribute determines the pixel aspect ratio of a given item.
Permitted range is [0.01 .. 100]. In a FootageItem, pixelAspect is linked to the pixelAspect of the mainSource;
in a CompItem, it is linked to the pixelAspect of a composition.
Certain pixelAspect values are specially known to After Effects, and will be stored/retrieved with perfect
accuracy. These are the set { 1, 0.9, 1.2, 1.07, 1.42, 2, 0.95, 1.9 }. Other values may experience slight rounding
errors when you set them and get them. Thus, the value you retrieve after setting may be slightly different from
the value you supplied.
Type
Description
Type
FootageSource; read-only.
Description
Parameters
Returns
None.
Description
The setProxyToNone method removes the proxy from this AVItem. Following this, the value of proxySource
is null.
Returns
None.
Description
The setProxyWithPlaceholder method creates a PlaceholderSource with specifications according to the input
arguments and establishes this as the new proxySource.
Note that 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.
This method does not preserve the interpretation parameters. After changing the proxySource, the value of
useProxy is set to true.
Parameters
n a me text string
Returns
None.
Description
The setProxy method loads the given sequence into a FileSource and establishes this as the new proxySource.
It loads the given sequence into a FileSource and establishes this as the new proxySource. It does not preserve
the interpretation parameters, instead using the user preference.
If the file has an unlabeled alpha channel, and the user preference says to ask the user what to do via a dialog,
scripting will guess the alpha interpretation instead of asking the user.
Parameters
forceAlphabetical boolean determining whether to use the “force alphabetical order” option
Returns
None.
Description
The setProxyWithSolid method creates a SolidSource with specifications according to the input arguments
and establishes this SolidSource as the new proxySource.
Note that there is no way, using the user interface, to set a solid as a proxy; this feature is available only via
scripting.
This method does not preserve the interpretation parameters. After changing the proxySource, the value of
useProxy is set to true.
Parameters
color array of 3 floats in the range [0..1] (red, green, and blue values)
Returns
None.
Description
The time attribute is the current time of the item when it is being previewed directly from the Project window.
It is an error to set this on a FootageItem whose mainSource is a still (i.e., if mainSource.isStill is true).
Type
Description
The usedIn attribute is an array containing all the CompItems that use this AVItem.
Note: The returned value will not automatically update in response to changes that occur after you retrieve it. So
if you retrieve usedIn and then add this item into another comp, you need to retrieve usedIn again in order to get
an array that includes the new comp.
Type
Description
The useProxy attribute determines whether a proxy should be used for the item.
Type
Boolean; read/write.
Description
The width attribute specifies the width, in pixels, of the item. Permitted range is [1 ..30,000].
In a FootageItem, width is linked to the mainSource's width; in a CompItem, it is linked to the comp's width.
It is legal to change the width of a CompItem or a FootageItem whose mainSource is a SolidSource. It is an
error to change the width if the item is a FootageItem whose mainSource is not a SolidSource.
Type
AVLayer object
app. project. l ayer( i n d e x )
Description
The AVLayer object provides an interface to those layers that contain AVItems (Comp layers, footage layers,
solid layers, text layers, and sound layers).
Since AVLayer is a subclass of Layer, all methods and attributes of Layer, in addition to those listed below, are
available when working with AVLayer.
Attributes
sou rce see “AVLayer source attribute” on source item for this layer
page 51
i s Na m e From S o u rce see “AVLayer isNameFromSource true if the layer has no expressly set name, but
attribute” on page 50 contains a named source
audio E n a bl ed see “AVLayer audioEnabled attribute” on true if the layer's audio is enabled
page 47
e f f e c t s Ac t ive see “AVLayer effectsActive attribute” on true if the layer's effects are active
page 49
adjust mentLayer see “AVLayer adjustmentLayer attribute” true if this is an adjustment layer
on page 46
guideLayer see “AVLayer guideLayer attribute” on specifies whether this AVLayer is a guide layer
page 50
canS etCo l l a p seTr a n sfo r ma tio n see “AVLayer canSetCollapseTransfor- true if it is legal to change the value of collapse-
mation attribute” on page 48 Transformation on this layer
t im eRema p E n a bl ed see “AVLayer timeRemapEnabled true if time remapping is enabled on this layer
attribute” on page 52
has Au d io see “AVLayer hasAudio attribute” on true if the layer contains an audio component
page 50
a u d i o Ac t ive see “AVLayer audioActive attribute” on true if the layer's audio is active at the current
page 47 time
preser veTr ansparency see “AVLayer preserveTransparency true if preserve transparency is enabled
attribute” on page 51
t r ackMatteTy p e see “AVLayer trackMatteType attribute” if layer has a track matte, specifies the way it
on page 52 will be applied
isTr a ckMatte see “AVLayer isTrackMatte attribute” on true if this layer is being used as a matte track
page 51 for the layer below it
hasTr a ckMatte see “AVLayer hasTrackMatte attribute” true if the layer above is being used as a track
on page 50 matte on this layer
guideLayer see “AVLayer guideLayer attribute” on true if the layer is a guide layer
page 50
Method
a u d i o Ac t ive At Ti m e ( ) see “AVLayer audioActiveAtTime() given a time, returns whether this layer's audio
method” on page 47 is active at that time
Example
If the first item in the project is a CompItem, and the first layer of that CompItem is an AVLayer, the following
would set the layer quality, startTime, and inPoint.
var firstLayer = app. project.item(1).layer(1);
firstLayer. qualit y = LayerQualit y.BEST;
firstLayer.star tTime = 1;
firstLayer.inPoint = 2;
Description
The adjustmentLayer attribute returns a value of true if the layer is an adjustment layer.
Type
Boolean; read/write.
Description
The audioActive attribute returns a value of true if the layer's audio is active at the current time.
To be true, audioEnabled must be true, no other layer with audio may be soloing unless this layer is soloed
too, and the time must be in between the inPoint and outPoint of this layer.
Type
Boolean; read-only.
Description
Given a time, the audioActiveAtTime method returns whether this layer's audio will be active at that
time.
To be true the layer’s audioEnabled attribute must be true, no other layer containing audio may be soloing
unless this layer is soloed too, and the given time must be between this layer's inPoint and outPoint.
Parameters
Returns
Boolean.
Description
The audioEnabled attribute is true if the layer's audio is enabled. This attribute corresponds to the speaker
button in the user interface.
Type
Boolean; read/write.
Description
Type
BlendingMode.ALPHA_ADD
BlendingMode.CLASSIC_COLOR_BURN
BlendingMode.CLASSIC_COLOR_D OD GE
BlendingMode.CLASSIC_DIFFERENCE
BlendingMode.COLOR
BlendingMode.COLOR_BURN
BlendingMode.COLOR_D OD GE
BlendingMode.DANCING_DISSOLVE
BlendingMode.DARKEN
BlendingMode.DIFFERENCE
BlendingMode.DISSOLVE
BlendingMode.EXCLUSION
BlendingMode.HARD_LIGHT
BlendingMode.HARD_MIX
BlendingMode.HUE
BlendingMode.LIGHTEN
BlendingMode.LINEAR_BURN
BlendingMode.LINEAR_D OD GE
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.SILHOUET TE_LUMA
BlendingMode.SOFT_LIGHT
BlendingMode.STENCIL_ALPHA
BlendingMode.STENCIL_LUMA
BlendingMode.VIVID_LIGHT
Description
The canSetCollapseTransformation attribute returns a value of true if it is legal to change the value of the
collapseTransformation attribute on this layer.
Type
Boolean; read-only.
Description
The canSetTimeRemapEnabled attribute returns a value of true if it is legal to change the value of the timeR-
emapEnabled attribute on this layer.
Type
Boolean; read-only.
Description
The collapseTransformation attribute returns a value of true if collapse transformation is on for this layer.
Type
Boolean; read/write.
Description
The effectsActive attribute returns a value of true if the layer's effects are active.
Type
Boolean; read/write.
Description
Type
Boolean; read/write.
Description
Type
Boolean; read-only.
Description
The hasAudio attribute holds a value of true if the layer contains an audio component, regardless of whether
it is audioEnabled or soloed.
Type
Boolean; read-only.
Description
The hasTrackMatte attribute returns a value of true if the layer in front of this layer is being used as a track
matte on this layer. If true, then this layer's trackMatteType controls how the matte is applied.
Type
Boolean; read-only.
Description
Type
Description
The isNameFromSource attribute returns a value of true if the layer has no expressly set name, but the layer
contains a named source. In this case, layer.name will be the same as layer.source.name. It returns false if the
layer has an expressly set name, or if neither the layer nor the layer's source has a name.
Type
Boolean; read-only.
Description
The isTrackMatte attribute returns a value of true if this layer is being used as a matte track for the layer behind
it.
Type
Boolean; read-only.
Description
The motionBlur attribute returns a value of true if the layer's motionBlur is enabled.
Type
Boolean; read/write.
Description
The preserveTransparency attribute returns a value of true if preserve transparency is enabled for the layer.
Type
Boolean; read/write.
Description
The quality is the layer quality specifying how this layer is to be displayed.
Type
Description
Type
AVItem; read-only.
Description
Type
Boolean; read/write.
Description
Type
Boolean; read/write.
Description
If this layer has a track matte, the trackMatteType specifies the way the track matte will be applied.
Type
Description
Type
Collection object
Description
A Collection object acts like an array that provides access to its elements by index. Like an array, a collection
associates a set of objects or values as a logical group and provides random access to them. However, most
collection objects are read-only. You do not assign objects to them yourself—their contents update automat-
ically as objects are created or deleted.
The index numbering of a collection starts with 1, not 0.
Objects
ItemCol l ec t ion see “ItemCollection” on page 99 a collection of all of the items (imported files,
folders, solids, etc.) found in the Project win-
dow
L ayer Co l l e c t i o n see “LayerCollection” on page 110 contains all of the layers in a composition
O M Co l l e c t i o n see “OMCollection” on page 119 contains all of the OutputModule items in the
project
RQItemCol l ec t ion see “RQItemCollection” on page 164 contains all of the RenderQueue items in the
project
Attributes
Methods
CompItem object
app. project .item( i n d e x )
Description
The CompItem object provides access to attributes and methods of Compositions. These are accessed via their
index number.
Attributes
frameDuration see “CompItem frameDuration The duration of a single frame in seconds. This
attribute” on page 58 is the inverse of the framerate.
wor k Area S ta r t see “CompItem workAreaStart the work area start time (in seconds)
attribute” on page 61
wor k Are a D u r a t i o n see “CompItem workAreaDuration the work area duration (in seconds)
attribute” on page 61
hideShyLayers see “CompItem hideShyLayers corresponds to the value of the Hide All Shy
attribute” on page 58 Layers button in the Composition window
motionBlur see “CompItem motionBlur attribute” if true, motion blur is enabled for this comp
on page 59
dr aft3d see “CompItem draft3d attribute” on sets the 3d display mode to Draft quality
page 57
fr ameBlending see “CompItem frameBlending if true, time filtering is enabled for this comp
attribute” on page 57
preser veNestedFr ameRate see “CompItem preserveNestedFrameR- boolean determining whether the frame rate
ate attribute” on page 59 of nested compositions should be preserved
preser veNestedResolution see “CompItem preserveNestedResolu- boolean determining whether the resolution
tion attribute” on page 60 of nested compositions should be preserved
displ ay S ta r tTime see “CompItem displayStartTime changes the display of the start time in the
attribute” on page 57 Timeline window
resolutionFactor see “CompItem resolutionFactor integer array determining the factor by which
attribute” on page 60 the x and y resolution of the Composition win-
dow is downsampled
shutterAng le see “CompItem shutterAngle attribute” integer value (0 - 720) determining the camera
on page 61 shutter angle
shutterPhase see “CompItem shutterPhase attribute” integer value (0 - 360) determining the camera
on page 61 shutter phase
layers see “LayerCollection” on page 110 LayerCollection containing the layers of the
compItem
Attributes inherited from Item object and AVItem object (see “Item object” on page 97 and “AVItem object” on
page 37)
n am e see “Item name attribute” on page 98 name of the object as shown in the Project
window
s e l e c te d see “Item selected attribute” on page 99 true if this item is currently selected
w id th see “AVItem width attribute” on page 44 integer [1 ..30,000] describing the width, in pix-
els, of the item
heig ht see “AVItem height attribute” on integer [1 .. 30,000] describing the height, in
page 41 pixels, of the item
p i xe l Asp e c t see “AVItem pixelAspect attribute” on pixel aspect ratio; floating-point value [0.01
page 41 ..100]
frameDuration see “AVItem frameDuration attribute” frame rate for the AVItem [1/99 .. 1 ].
on page 39
dur at i on see “AVItem duration attribute” on duration of the AVItem, in seconds [0 .. 10,800]
page 39
proxySource see “AVItem proxySource attribute” on FootageItem used as proxy of the AVItem;
page 42 read-only
time see “AVItem time attribute” on page 44 current time of the AVItem in seconds
u s e d In see “AVItem usedIn attribute” on array containing all the CompItems that use
page 44 this AVItem
h a s Vi d e o see “AVItem hasVideo attribute” on true if the AVItem has an audio component
page 40
has Au d io see “AVItem hasAudio attribute” on true if the AVItem has a video component
page 40
footageMissing see “AVItem footageMissing attribute” true if the AVItem cannot be found or if it is a
on page 39 placeholder
Methods
duplicate() see “CompItem duplicate() method” on creates and returns a duplicate of this comp
page 57 item
layer() see “CompItem layer() method” on returns the layer using index, relative index or
page 58 name
Methods inherited from Item object and AVItem object (see “Item object” on page 97 and “AVItem object” on
page 37)
rem ove() see “Item remove() method” on page 99 deletes the item from the project
s e t Prox y ( ) see “AVItem setProxy() method” on sets a proxy for the AVItem
page 42
set Proxy Wi thS equ en ce() see “AVItem setProxyWithSequence() sets a sequence as a proxy for the AVItem
method” on page 43
s e t Prox y Wi t h S o l i d ( ) see “AVItem setProxyWithSolid() sets a solid as a proxy (feature available only via
method” on page 43 scripting)
set Proxy Wi thP l a ceho l d er() see “AVItem setProxyWithPlaceholder() sets a placeholder as a proxy
method” on page 42
set Proxy To No n e() see “AVItem setProxyToNone() method” removes the proxy
on page 42
Example
Given that the first item in the project is a CompItem, the following code would result in two alerts. The first
would display the number of layers in the CompItem, and the second would display the name of the last Layer
in the CompItem.
var firstComp = app. project.item(1);
aler t( "number of layers is " + firstComp.numLayers );
aler t( "name of last layer is " + firstComp.layer(firstComp.numLayers).name );
Description
The active camera is the front-most camera layer that is enabled. The value is null if the comp contains no
enabled camera layers.
Type
Layer; read-only.
Description
The bgColor attribute specifies the background color of the comp. The value should be an array containing
three floats in the range [0..1] for red, green, and blue.
Type
Description
The displayStartTime attribute corresponds the time, in seconds, set as the begining of the composition. This
is the equivalent of the Start Timecode or Start Frame setting in the Composition Settings window, expressed
in seconds.
The permissible range is [0...86339] (86339 is 1 second less than 25 hours).
Type
Description
The draft3d attribute determines whether Draft 3D mode is enabled for the Composition window. This corre-
sponds to the value of the draft3d button in the Composition window.
Type
Description
The duplicate() method creates and returns a duplicate of this comp item. The duplicate will contain the same
layers as the original.
Parameters
None.
Returns
CompItem.
Description
The frameBlending attribute determines whether frame blending is enabled for this Composition. Corre-
sponds to the value of the frame blending button in the Composition window.
Type
Description
The frameDuration attribute returns the duration of a frame, in seconds. This is the inverse of the framerate
(or frames per second). This attribute is read-only.
Type
Description
The hideShyLayers attribute determines whether shy layers should be visible in the Timeline window. It corre-
sponds to the value of the Hide All Shy Layers button in the Composition window.
If false, then only layers with "shy" set to false will be shown. If true, then all layers will be shown regardless of
the value of their "shy" attributes.
Type
Description
Parameters
Note that there are three separate types of usage possible with layer, with unique syntax for each:
or
otherLayer index number of the layer to which an offset will be applied
re lIndex relative position of the layer; the difference between the two index numbers expressed as an
integer
or
n a me name of the specified number; a text string
Returns
Layer object.
Description
Type
LayerCollection. Read-only.
Description
The motionBlur attribute determines whether motion blur is enabled for the Composition. Corresponds to
the value of the motion blur button in the Composition window.
Type
Description
The numLayers attribute is the number of layers in the CompItem. This always equals length of the LayerCol-
lection.
Type
Integer. Read-only.
Description
The preserveNestedFrameRate attribute determines whether the frame rate of nested compositions is
preserved in the current composition. This corresponds to the value of the Preserve Frame Rate When Nested
or in Render Queue option in the Advanced tab of the Composition Settings dialog box.
Type
Description
Type
Description
The resolutionFactor attribute specifies the sampling resolution of the comp when rendering.
Each of the two values in the array specifies how many pixels to skip when sampling in one of the two direc-
tions. The first number controls horizontal sampling; the second controls vertical sampling. Each of the two
integers must lie in the range [1..99]. 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, describing the x and y downsample resolution factor; read/write.
Description
This attribute yields an array containing all of the selected Layers in this CompItem.
Type
Description
This attribute yields an array containing all of the selected Property and PropertyGroup objects in this
CompItem.
Type
Description
The shutterAngle attribute determines the shutter angle setting for the composition. This setting corresponds
to the Shutter Angle setting found under the Advanced tab of the Composition Settings dialog box. Acceptable
integer settings are within the range of 0 - 720.
Type
Description
The shutterPhase attribute determines the shutter phase setting for the composition. This setting is the equiv-
alent of the Shutter Phase setting found under the Advanced tab of the Composition Settings dialog box.
Acceptable integer settings are within the range of 0 - 360.
Type
Description
The workAreaDuration attribute determines the duration, in seconds, of the work area. This value is the
difference of the start point time of the Composition work area and the end point.
Type
Description
The workAreaStart attribute determines the time, in seconds, where the Composition work area begins.
Type
File Class
The File Class contains methods and attributes common to File objects. A File object corresponds to a disk file.
Also included in this class are all attributes and methods within the FileSystem class, as those apply to Files as
well as Folders.
Note that the difference between the File Class and File object is that the class attributes and methods require
no specific instance of a File, whereas class methods and attributes do.
Class attributes inherited from FileSource object (see “FileSource object” on page 71)
Methods
File () see “File() Class method” on page 62 constructs a new File object
new File()
openDialog() see “File openDialog() Class method” on opens the built-in operating-system dialog to
page 67 select an existing file to open
s ave D i a l o g ( ) see “File saveDialog() Class method” on opens the built-in operating-system dialog to
page 69 select a file name to save a file into
Class methods inherited from FileSource object (see “FileSource object” on page 71)
deco de() see “FileSystem decode() class method” decodes the input string from UTF-8
on page 73
enco de() see “FileSystem encode() class method” encodes the input string in UTF-8
on page 73
Description
This function constructs a new File object. If the given path name refers to an already existing folder, a Folder
object is returned instead.
The CRLF sequence is preset to the system default, and the encoding is preset to the default system encoding.
Parameters
Returns
File object
File( “p a th” )
Description
The File object contains methods and attributes common to File objects. A Folder object corresponds to a
folder.
Also included in this object are all attributes and methods within the FileSystem object, as those apply to Files
as well as Folders.
Attributes
creator see “File creator attribute” on page 65 Macintosh file creator as a four-character string
enco ding see “File encoding attribute” on page 65 gets or sets the encoding for subsequent read/
write operations
eof see “File eof attribute” on page 66 has the value true if a read attempt caused the
current position to be behind the end of the
file
hidden see “File hidden attribute” on page 66 set to true if the file is invisible
length see “File length attribute” on page 66 size of the file in bytes
l i n e Fe e d see “File lineFeed attribute” on page 66 way line feed characters are written
readonly see “File readonly attribute” on page 69 when set, prevents the file from being altered
or deleted
type see “File type attribute” on page 70 Macintosh file type as a four-character string
Attributes inherited from FileSystem object (see “FileSystem object” on page 74)
absoluteURI see “FileSystem absoluteURI attribute” full path name for the object in URI notation
on page 75
alias see “FileSystem alias attribute” on returns true if the object refers to a file system
page 76 alias
er ror see “FileSystem error attribute” on contains a message describing the last file sys-
page 76 tem error
ex ists see “FileSystem exists attribute” on returns true if the path name of this object
page 76 refers to an actually existing file or folder
f s Na m e see “FileSystem fsName attribute” on file-system specific name of the object as a full
page 77 path name
n am e see “FileSystem name attribute” on name of the object without the path specifica-
page 77 tion
parent see “FileSystem parent attribute” on folder object containing this object
page 78
pat h see “FileSystem path attribute” on path portion of the absolute URI
page 78
re l a t ive U R I see “FileSystem relativeURI attribute” on path name for the object in URI notation, rela-
page 78 tive to the current folder
Methods
close() see “File close() method” on page 65 closes the open file
copy () see “File copy() method” on page 65 copies the file to the given location
open() see “File open() method” on page 67 opens the file for subsequent read/write oper-
ations
rea d ( ) see “File read() method” on page 68 reads the contents of the file from the current
position on
readch() see “File readch() method” on page 68 reads one single text character
rea d l n ( ) see “File readln() method” on page 69 reads one line of text
seek() see “File seek() method” on page 70 seeks to a certain position in the file
te l l ( ) see “File tell() method” on page 70 returns the current position in the file as an off-
set in bytes
w r i te() see “File write() method” on page 71 writes the given string to the file
w r i te l n ( ) see “File writeln() method” on page 71 writes the given string to the file and append a
line feed sequence
Methods inherited from FileSystem object (see “FileSystem object” on page 74)
g e t Re l a t ive U R I ( ) see “FileSystem getRelativeURI() calculates and returns the relative URI, given a
method” on page 77 base path, in URI notation
rem ove() see “FileSystem remove() method” on deletes the file or folder that this object repre-
page 78 sents
rena me() see “FileSystem rename() method” on renames the object to the new name
page 79
reso lve() see “FileSystem resolve() method” on attempts to resolve the file system alias that
page 79 this object points to
Description
The close() method closes the open file. The return value is true if the file was closed, false on I/O errors.
Parameters
None.
Returns
Boolean.
Description
Parameters
Returns
Boolean.
Description
The creator attribute is the Macintosh file creator as a four-character string. On Windows, the return value is
always "????".
Type
String; read-only.
Description
The encoding attribute gets or sets the encoding for subsequent read/write operations.
The encoding is one of several predefined constants that follow the common Internet encoding names. Valid
names are UCS-2, X-SJIS, ISO-8851-9, ASCII or the like.
A special encoder, BINARY, is used to read binary files. This encoder stores each byte of the file as one Unicode
character regardless of any encoding. When writing, the lower byte of each Unicode character is treated as a
single byte to write. See “Encoding Names” on page 228 for a list of encodings. If an unrecognized encoding
is used, the encoding reverts to the system default encoding.
Type
String; read/write.
Description
The File eof attribute has the value true if a read attempt caused the current position to be past the end of the
file.
If the file is not open, the value is true.
Type
Boolean; read-only.
Description
The File hidden attribute has the value true if the file is invisible. Assigning a Boolean value sets or clears this
attribute.
Type
Boolean; read/write.
Description
The File length attribute is size of the file in bytes. When setting the file size, the file must not be open.
Type
Number; read-only.
Description
The File lineFeed attribute determines the way line feed characters are written. This can be one of the three
values: macintosh, unix or windows (actually, only the first character is interpreted).
Type
Description
The File open() method opens the file for subsequent read/write operations. The type and creator arguments
are optional and Macintosh specific; they specify the file type and creator as two four-character strings. They
are used if the file is newly created. On other platforms, they are ignored.
When open() is used to open a file for read access, the method attempts to detect the encoding of the open
file. It reads a few bytes at the current location and tries to detect the Byte Order Mark character 0xFFFE. If
found, the current position is advanced behind the detected character and the encoding property is set to one
of the strings UCS-2BE, UCS-2LE, UCS4-BE, UCS-4LE or UTF-8. If the marker character cannot be found,
it checks for zero bytes at the current location and makes an assumption about one of the above formats
(except for UTF-8). If everything fails, the encoding property is set to the system encoding. The method
resolves any aliases to find the file.
You should be careful if you try to open a file more than once. The operating system usually permits you to do
so, but if you start writing to the file using two different File objects, you may destroy your data.
The return value is true if the file has been opened successfully, false otherwise.
Parameters
mode one of r, w or e:
r (read) Opens for reading. If the file does not exist or cannot be found, the call fails.
w (write) Opens an empty file for writing. If the file exists, its contents are destroyed.
type The Macintosh file type; a four-byte character string; ignored on non-Macintosh operating systems.
creator The Macintosh file creator; a four-byte character string; ignored on non-Macintosh operating systems.
Returns
Boolean.
Description
The File.openDialog class method presents the Open dialog box that is standard for the platform on which
After Effects is running. This method overlaps somewhat with the easier to use fileGetDialog() global
function.
Parameters
prompt An optional prompt (expressed as a string) that is displayed as part of the dialog if the dialog permits the
display of an additional message.
select This argument allows the pre-selection of the files that the dialog displays. Unfortunately, this argument is
different on Mac OS and on Windows.
s e l e c t ( Win ) Windows selection string is actually a list of file types with explanative text. This list appears in the bottom
of the dialog box as a drop-down list box so the user can select which types of files to display. The elements
of this list are separated by commas. Each element starts with the descriptive text, followed by a colon and
the file search masks for this text. Again, each search mask is separated by a semicolon. A Selection list that
allowed the selection of all text files (*.TXT and *.DOC) or all files would look like this:
s e l e c t ( Ma c On Mac OS, the optional second argument is a callback function. This function takes one argument, which
O S) is a File object. When the dialog is set up, it calls this callback function for each file that is about to be dis-
played. If the function returns anything else than true, the file is not displayed. This is true only for the open-
Dialog() method; the saveDialog() method ignores this callback method.
Returns
See also
Description
The File read() method reads the contents of the file from the current position on. Returns a string that
contains up to the number of characters that were supposed to be read.
Parameters
chars The number of characters to read, expressed as an integer. If the number of characters to read
is not supplied, the entire file is read in one big chunk, starting at the current position. If the
file is encoded, multiple bytes may be read to create single Unicode characters.
Returns
String.
Description
The File readch() method reads one single text character. Line feeds are recognized as CR, LF, CRLF or LFCR
pairs. If the file is encoded, multiple bytes may be read to create single Unicode characters.
Parameters
None.
Returns
String.
Description
The File readch() method reads one line of text. Line feeds are recognized as CR, LF, CRLF or LFCR pairs. If
the file is encoded, multiple bytes may be read to create single Unicode characters.
Parameters
None.
Returns
String.
Description
The File readonly attribute, when set, prevents the file from being altered or deleted.
Type
Boolean; read/write.
Description
The File.saveDialog class method presents the Save dialog box that is standard for the platform on which After
Effects is running. This method overlaps somewhat with the easier-to-use filePutDialog() global function.
Parameters
prompt An optional prompt (expressed as a string) that is displayed as part of the dialog if the dialog
permits the display of an additional message.
select This argument allows the pre-selection of the files that the dialog displays. Unfortunately, this
argument is different on Mac OS and on Windows.
s e l e c t ( Wi n ) Windows selection string is actually a list of file types with explanative text. This list is dis-
played in the bottom of the dialog as a drop-down list box so the user can select which types
of files to display. The elements of this list are separated by commas. Each element starts with
the descriptive text, followed by a colon and the file search masks for this text. Again, each
search mask is separated by a semicolon. A Selection list that allowed the selection of all text
files (*.TXT and *.DOC) or all files would look like this:
s e l e c t ( Ma c O S ) On Mac OS, the optional second argument is a callback function. This function takes one
argument, which is a File object. When the dialog is set up, it calls this callback function for
each file that is about to be displayed. If the function returns anything else than true, the file
is not displayed. This is true only for the openDialog() method; the saveDialog() method
ignores this callback method.
Returns
See also
Description
The File seek() method seeks to a certain position in the file. This method does not permit seeking to positions
less than 0 or greater than the current file size.
Parameters
pos the new current position inside the file as an offset in bytes (an integer), dependent on the
seek mode
mode the seek mode (0 = seek to absolute position, 1 = seek relative to the current position, 2 = seek
backwards from the end of the file)
Returns
Description
The File tell() method returns the current position in the file as an offset in bytes.
Parameters
None.
Returns
Integer.
Description
The File type attribute holds the Macintosh file type as a four-character string.
On Mac OS, the file type is returned. On Windows, "appl" is returned for .EXE files, "shlb" for .DLLs and
"TEXT" for any other file. If the file does not exist, the file type is "????".
Type
Boolean; read-only.
Description
The File write() method writes a given string to the file. The parameters of this function are concatenated to
a single string. Returns true on success.
For encoded files, writing a single Unicode character may result in multiple bytes being written. Take care not
to write to a file that is open in another application or object. This may cause loss of data, since a second write
issued from another File object may overwrite existing data.
Parameters
text A string or set of strings. All arguments are concatenated to form the string to be written.
Returns
Boolean.
Description
The File writeln() method writes a given string to the file. The parameters of this function are concatenated
to a single string, and a Line Feed sequence is appended. Returns true on success.
If the file is encoded, multiple bytes may be read to create single Unicode characters.
Parameters
text A string or set of strings. All arguments are concatenated to form the string to be written.
Returns
Boolean.
FileSource object
app. project.ite m(index) . m a i n S o u rce
app. project.ite m(index) .proxySource
Description
The FileSource describes footage that comes from a file. FileSource is a subclass of FootageSource and so it
inherits all attributes and methods of FootageSource.
Attributes
file see “FileSource file attribute” on page 72 specifies the file that defines this FileSource
Methods
re l o a d ( ) see “FileSource reload() method” on reloads the asset from the file
page 72
Description
The FileSource file attribute specifies the file that defines this FileSource. The attribute is readOnly.
Note that there are other ways to change the file. If this FootageSource is a proxySource of an AVItem, you can
call setProxy() or setProxyWithSequence() to change files. If this FootageSource is a mainSource of a
FootageItem, you can call replace() or replaceWithSequence() to change files.
Type
File; read-only.
Description
The FileSource reload() method reloads the asset from the file. This method can be called only on a
mainSource, not a proxySource.
Parameters
None.
Returns
None.
FileSystem Class
File.
Folder.
Description
The FileSystem class contains methods and attributes common to both File and Folder objects. A File object
corresponds to a disk file, while a Folder object matches a folder.
This attribute and methods differ from those found under the FileSystemObject in that they can be applied
without referring to a particular instance of a file or folder.
Class attributes
Class methods
deco de() see “FileSystem decode() class method” decodes the input string from UTF-8
on page 73
enco de() see “FileSystem encode() class method” encodes the input string in UTF-8
on page 73
Description
The decode() class method of File or Folder decodes escaped characters and then interprets them as UTF-8.
Parameters
st r in g string to be decoded
Returns
String.
See also
Description
The encode() class method of File or Folder converts the input string to UTF-8 and then encodes it such that
all characters are usable in a URI (or URL).
Parameters
st r in g string to be encoded
Returns
String.
See also
Description
The fs class attribute of File or Folder holds the name of the file system (operating system). Possible values are
“Windows” or “Macintosh”.
Type
String; read-only.
Example
w r ite("The l o ca l fi l e sy stem is " + Fil e . f s ) ;
FileSystem object
File( “p a th” ).
Folder(“path”).
Description
The FileSystem object contains methods and attributes common to both File and Folder objects. A File object
corresponds to a disk file, while a Folder object matches a folder. “FileSystem” is a name used to refer to both
Folders and Files.
These attributes and methods differ from those found under the FileSystem Class in that they cannot be
applied without referring to a particular instance of a file or folder, expressed as a path to that file or folder.
You can use absolute path names and relative path names. Absolute path names start with one or two slash
characters. These path names describe the full path from a root folder down to a file or folder. Relative path
names start from a known location, the current folder. A relative path name starts either with a folder name
or with one of the special names “.” and “..”. The name “.” refers to the current folder, and the name “..” refers
to the parent folder. The slash character is used to separate path elements. Special characters are encoded in
UTF-8 notation.
The FileSystem objects support a common convention. A volume name may be the first part of an absolute
path. The objects know where to look for the volume names on Mac OS and Windows and they translate the
volume names accordingly.
A path name can also start with the tilde “~” character. This character stands for the user’s home directory (on
Mac OS). On Windows, a directory with the environment variable HOME or, failing that, the desktop is used
as a home directory.
The following table illustrates how the root element of a full path name is used on different file systems. In
these examples, the current drive is C: on Windows and “Macintosh HD” on Mac OS.
Thus if you have to use a script with URI notation on both Mac OS and Windows, try to use relative path
names, or try to originate your path names from the home directory. If that is not possible, it is recommended
that you work with Mac OS X aliases and UNC names on Windows, and store files on a machine that is remote
to the Windows machine on which the script is running.
Attributes
absoluteURI see “FileSystem absoluteURI attribute” full path name for the object in URI notation
on page 75
alias see “FileSystem alias attribute” on returns true if the object refers to a file system
page 76 alias
er ror see “FileSystem error attribute” on contains a message describing the last file sys-
page 76 tem error
ex ists see “FileSystem exists attribute” on returns true if the path name of this object
page 76 refers to an actually existing file or folder
f s Na m e see “FileSystem fsName attribute” on file-system specific name of the object as a full
page 77 path name
n am e see “FileSystem name attribute” on name of the object without the path specifica-
page 77 tion
parent see “FileSystem parent attribute” on folder object containing this object
page 78
pat h see “FileSystem path attribute” on path portion of the absolute URI
page 78
re l a t ive U R I see “FileSystem relativeURI attribute” on path name for the object in URI notation, rela-
page 78 tive to the current folder
Methods
g e t Re l a t ive U R I ( ) see “FileSystem getRelativeURI() calculate and return the relative URI, given a
method” on page 77 base path, in URI notation
rem ove() see “FileSystem remove() method” on delete the file or folder that this object repre-
page 78 sents
rena me() see “FileSystem rename() method” on rename the object to the new name
page 79
reso lve() see “FileSystem resolve() method” on attempt to resolve the file system alias that this
page 79 object points to
Fol d e r ( p a t h ) . absoluteURI
Description
The absoluteURI attribute of File or Folder is the full path name for the object in URI notation.
Type
String; read-only.
Description
The alias attribute of File or Folder returns true if the object refers to a file system alias.
Type
Boolean; read-only.
Description
The created attribute of File or Folder is the creation date of the object. If the object does not refer to a folder
or file on the disk, the value is null.
Type
Date, or null if the object does not refer to a file or folder on disk; read-only.
Description
The error attribute of File or Folder contains a message describing the last file system error. Setting this value
clears any error message and resets the error bit for opened files.
Type
Description
The exists attribute of File or Folder returns true if the path name of this object refers to an already existing
file or folder.
Type
Boolean; read-only.
Description
The fsName attribute of File or Folder is the file-system specific name of that object as a full path name.
Type
String; read-only.
Description
The getRelativeURI() method of File or Folder calculates and returns the relative URI, given a base path, in
URI notation. If the base path is omitted, the path of the current folder is assumed.
Parameters
Returns
String.
Description
The modified attribute of File or Folder is the date of the object's last modification. If the object does not refer
to a folder or file on disk, the value is null.
Type
Description
The name attribute of File or Folder is the name of the object without the path specification.
Type
String; read-only.
Description
The parent attribute of File or Folder is the folder object containing this object. If this object already is the root
folder of a volume, the property value is null.
Type
Description
The path attribute of File or Folder is the path portion of the absolute URI. If the name does not have a path,
this property contains the empty string.
Type
Description
The relativeURI attribute of File or Folder is the path name for the object in URI notation, relative to the
current folder.
Type
String; read-only.
Description
The remove() method of File or Folder deletes the file or folder that this object represents. Folders must be
empty before they can be deleted. The return value is true if the file or folder has been deleted.
IMPORTANT: The remove() method deletes the referenced file or folder immediately. It does not move the refer-
enced file or folder to the system trash. The effects of the remove method cannot be undone. It is recommended that
you prompt the user for permission to delete a file or folder before deleting it. The method does not resolve aliases;
it rather deletes the file alias itself.
Parameters
None.
Returns
Boolean.
Description
The rename() method of File or Folder renames the object to a new name. The new name must not have a
path. This method returns true if the object was renamed. The method does not resolve aliases, but rather
renames the alias file.
Parameters
Returns
Boolean.
Description
The resolve() method of File or Folder attempts to resolve the file system alias that this object points to. If
successful, a new File or Folder object is returned that points to the resolved file system element. If the object
is not an alias, or if the alias could not be resolved, the return value is null.
Parameters
None.
Returns
Folder class
Folder.
Description
The Folder class contains methods and attributes common to Folder objects. A Folder object corresponds to
a folder.
Also included in this class are all attributes and methods within the FileSystem class, as those apply to Folders
as well as Files.
Note that the difference between the Folder Class and Folder object is that the class attributes and methods
require no specific instance of a Folder, whereas class methods and attributes do.
Attributes
cu r ren t see “Folder current Class attribute” on current folder is returned as a Folder object
page 81
star tup see “Folder startup Class attribute” on folder containing the executable image of the
page 81 running application
system see “Folder system Class attribute” on folder containing the operating system files
page 82
temp see “Folder temp Class attribute” on default folder for temporary files
page 82
Class attributes from FileSystem object (see “FileSystem object” on page 74)
Methods
Folder() see “Folder create() method” on page 84 constructs a new Folder object
new Folder()
selectDialog() see “Folder selectDialog() Class method” opens a dialog box that permits you to select a
on page 81 folder using the OS specific folder select dialog
Class methods from FileSystem object (see “FileSystem object” on page 74)
deco de() see “FileSystem decode() class method” decodes the input string from UTF-8
on page 73
enco de() see “FileSystem encode() class method” encodes the input string in UTF-8
on page 73
Description
This function constructs a new Folder object. If the given path name refers to an already existing disk file, a
File object is returned instead.
The folder that the path name refers to does not need to exist. If the argument is omitted, a temporary name
is generated.
Parameters
Returns
Description
The current attribute of Folder is the current folder. It is returned as a Folder object. Assigning either a Folder
object or a string containing the new path name sets the current folder.
Type
Folder; read/write.
Description
The Folder SelectDialog() method opens a dialog box that permits you to select a folder using the platform-
specific selection dialog box. Both arguments are optional.
Parameters
prompt String displays a prompt text if the dialog allows the display
of such a message; optional
Returns
Folder object pointing to the selected folder, or null if the user cancels the dialog.
Description
The startup attribute of Folder is the folder containing the executable image of the running application.
Type
Folder; read-only.
Description
The system attribute of Folder is the folder containing the operating system files.
Type
Folder; read-only.
Description
The temp attribute of Folder is the default folder for temporary files.
Type
Folder; read-only.
Description
Type
Folder; read-only.
Folder object
Folder(“path”).
Description
The Folder object contains methods and attributes common to Folder objects. A Folder object corresponds to
a folder.
Also included in this object are all attributes and methods within the FileSystem object, as those apply to
Folders as well as Files.
Attributes inherited from the FileSystem object (see “FileSystem object” on page 74)
absoluteURI see “FileSystem absoluteURI attribute” full path name for the object in URI notation
on page 75
alias see “FileSystem alias attribute” on returns true if the object refers to a file system
page 76 alias
er ror see “FileSystem error attribute” on contains a message describing the last file sys-
page 76 tem error
ex ists see “FileSystem exists attribute” on returns true if the path name of this object
page 76 refers to an actually existing file or folder
f s Na m e see “FileSystem fsName attribute” on file-system specific name of the object as a full
page 77 path name
n am e see “FileSystem name attribute” on name of the object without the path specifica-
page 77 tion
parent see “FileSystem parent attribute” on folder object containing this object
page 78
pat h see “FileSystem path attribute” on path portion of the absolute URI
page 78
re l a t ive U R I see “FileSystem relativeURI attribute” on path name for the object in URI notation, rela-
page 78 tive to the current folder
Methods
create() see “Folder create() method” on page 84 attempts to create a folder at the location the
path name points to
getFiles() see “Folder getFiles() method” on gets a list of File and Folder objects contained
page 84 in the folder object
Methods inherited from FileSystem object (see “FileSystem object” on page 74)
g e t Re l a t ive U R I ( ) see “FileSystem getRelativeURI() calculates and returns the relative URI, given a
method” on page 77 base path, in URI notation
rem ove() see “FileSystem remove() method” on deletes the file or folder that this object repre-
page 78 sents
rena me() see “FileSystem rename() method” on renames the object to the new name
page 79
reso lve() see “FileSystem resolve() method” on attempts to resolve the file system alias that
page 79 this object points to
Description
The create() method attempts to create a folder at the location the path name points to.
Parameters
None.
Returns
Description
The Folder getFiles() method returns a list of File and Folder objects contained in the folder object. The mask
parameter is the search mask for the file names, expressed as a string. It may contain question marks and
asterisks and is preset to * to find all files.
Alternatively, a function may be supplied. This function is called with a File or Folder object for every file or
folder in the directory search. If the function returns true, the object is added to the array.
On Windows, all aliases end with the extension ".lnk". This extension is stripped from the file name when
found to preserve compatibility with other operating systems. You can, however, search for all aliases by
supplying the search mask "*.lnk". This is not recommended, however, because it is not portable.
Parameters
Returns
Array of File & Folder objects or null if the folder does not exist.
FolderItem object
app. project. FolderItem
Description
The FolderItem object corresponds to any folder in your Project window. It can contain various types of items
(footage, compositions, solids) as well as other folders.
Attributes
items see “FolderItem items attribute” on ItemCollection that represents the contents of
page 85 this FolderItem
num Items see “FolderItem numItems attribute” on number of items contained in the FolderItem
page 86
Methods
Example
Given that the second item in the project is a FolderItem, the following code puts up one alert for each top-
level item in the folder. The alerts display the name of each top-level item.
var secon d Item = a p p. p ro j ect. i tem(2 ) ;
if ( !(secondItem instanceof FolderItem) ) {
aler t( "problem: second item is not a folder");
} else {
for (i = 1; i <= secondItem.numItems; i++ ) {
aler t( "item number " + i + " w ithin the folder is named "
+ secon d Item. i tem(i). n a me);
}
}
Description
The FolderItem item() method returns the top-level item in this FolderItem with the given index. Note that
“top-level” here means top-level within the folder, not necessarily within the project.
Parameters
Returns
Item.
Description
The items attribute is the ItemCollection that represents the contents of this FolderItem.
Unlike the ItemCollection that is owned by the Project object, a FolderItem’s ItemCollection contains only the
top-level Items in the FolderItem.
Note that “top-level” indicates top-level within the folder, not necessarily within the project. Only in the case
of the rootFolder are the top-level items in the FolderItem also top-level items in the Project.
Type
Description
Type
FootageItem object
app. project. item( i n d e x )
app. project .items[ i n d e x ]
Description
The FootageItem object represents a footage item imported into the project, which appears in the Project
window.
Attributes
m a i n S o u rce see “FootageItem mainSource attribute” contains all settings related to the footage
on page 87 item
Methods
rep l a ce ( ) see “FootageItem replace() method” on replaces a footage file with another footage
page 87 file
rep l a ceWi thS equ en ce() see “FootageItem replaceWithSe- replaces a footage file with an image sequence
quence() method” on page 88
rep l a ceWi t h S o l i d ( ) see “FootageItem replaceWithSolid() replaces a footage file with a solid
method” on page 88
Description
The file attribute is the File object of the footage's source file.
If the FootageItem's mainSource is a FileSource, this is the same thing as mainSource.file Otherwise it is
NULL.
Type
Description
The footage item mainSource attribute contains all of the settings related to that footage item, including those
that are normally accessed via the Interpret Footage dialog box. See also FootageSource (and its three types:
SolidSource, FileSource, and PlaceholderSource).
The attribute is read-only, but it can be changed by calling any of the FootageItem methods that change the
footage source: replace(), replaceWithSequence(), replaceWithSolid(), and replaceWithPlaceholder().
Type
FootageSource. Read-only.
Description
The FootageItem replace() method replaces the FootageItem with the file given as a parameter.
In After Effects 6.5, in addition to loading the given file, this method does the following:
• Sets the mainSource to a new value reflecting the contents of the new file.
• Sets the name, width, height, frameDuration, and duration attributes, defined in the base AVItem class,
based on the contents of the file.
• Preserves interpretation parameters from the previous mainSource.
• Guesses the alpha if replace() is called with a file that has an unlabeled alpha channeI.
Parameters
Description
The FootageItem replaceWithSequence() method replaces the FootageItem with the image sequence given as
a parameter.
In After Effects 6.5, in addition to loading the given file, this method does the following:
• Sets the mainSource to a new value reflecting the contents of the new file.
• Sets the name, width, height, frameDuration, and duration attributes, defined in the base AVItem class,
based on the contents of the file.
• Preserves interpretation parameters from the previous mainSource.
• Guesses the alpha if replace() is called with a file that has an unlabeled alpha channeI.
Parameters
Description
The FootageItem replaceWithSequence() method replaces the FootageItem with the image sequence given as
a parameter.
In After Effects 6.5, in addition to loading the given file, this method does the following:
• Sets the mainSource to a new value reflecting the contents of the new file.
• Sets the name, width, height, frameDuration, and duration attributes, defined in the base AVItem class,
based on the contents of the file.
• Preserves interpretation parameters from the previous mainSource.
• Guesses the alpha if replace() is called with a file that has an unlabeled alpha channel.
Parameters
Description
The FootageItem replaceWithSequence() method replaces the FootageItem with the image sequence given as
a parameter.
In After Effects 6.5, in addition to loading the given file, this method does the following:
• Sets the mainSource to a new value reflecting the contents of the new file.
• Sets the name, width, height, frameDuration, and duration attributes, defined in the base AVItem class,
based on the contents of the file.
• Preserves interpretation parameters from the previous mainSource.
• Guesses the alpha if replace() is called with a file that has an unlabeled alpha channeI.
Parameters
color Floating-point array color of the solid (an array of four floating-point values from 0 to
1: [R, G, B, A])
FootageSource object
app. project.ite m(index). m a i n S o u rce.
app. project.ite m(index) .proxySource.
Description
The FootageSource object holds information describing the source of some footage. It is used to hold the
mainSource of a FootageItem, or the proxySource of an AVItem. AVItem is the base class of FootageItem and
CompItem; thus proxySource appears in both these types of Item.
Attributes
hasAlpha see “FootageSource hasAlpha attribute” specifies if a footage clip or proxy includes an
on page 92 alpha channel
inver t Alpha see “FootageSource invertAlpha specifies if an alpha channel in a footage clip or
attribute” on page 93 proxy should be inverted
highQualityFieldSeparation see “FootageSource highQualityField- specifies how the fields are to be separated in
Separation attribute” on page 92 a non-still footage.
removePu l l dow n see “FootageSource removePulldown specifies the Pulldown Type for the footage
attribute” on page 94
loop see “FootageSource loop attribute” on specifies how many times an image sequence
page 93 is set to loop
n a t ive Fr a m e R a te see “FootageSource nativeFrameRate the native frame rate of the footage
attribute” on page 93
d i s p l ay Fr a m e R a te see “FootageSource displayFrameRate the effective frame rate as displayed and ren-
attribute” on page 91 dered in compositions by After Effects
confor mFr ameRate see “FootageSource conformFrameRate specifies the rate to which footage should con-
attribute” on page 90 form
Methods
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
Description
The conformFrameRate attribute of FootageSource determines a frame rate to use instead of the nativeFram-
eRate. If set to 0, the nativeFrameRate will be used instead. Permissible range is [0 .. 99.0].
It is an error to set this value if FootageSource.isStill is true. It is an error to set this value to 0 if remove-
Pulldown is not set to PulldownPhase.OFF. If this is 0 when you set removePulldown to a value other than
PulldownPhase.OFF, then this will be set to be equal to nativeFrameRate by default.
Type
Description
The displayFrameRate attribute of FootageSource corresponds to the effective frame rate as displayed and
rendered in compositions by After Effects.
If removePulldown is PulldownPhase.OFF, then this will be the conformFrameRate (if non-zero) or the
nativeFrameRate (if conformFrameRate is 0). If removePulldown is not PulldownPhase.OFF, then this will be
(0.8 * conformFrameRate), the effective frame rate after removing 1 of every 5 frames.
Type
Description
The fieldSeparationType attribute of FootageSource specifies how the fields are to be separated in a non-still
footage.
It is an error to attempt to write to this attribute if isStill is true. It is an error to set this value to FieldSepara-
tionType.OFF if removePulldown is not PulldownPhase.OFF. You must instead change removePulldown to
PulldownPhase.OFF, and then set the fieldSeparationType to FieldSeparationType.OFF.
Enumerated Types
Description
The guessAlphaMode() method sets alphaMode, premulColor, and invertAlpha to the best guesses for this
footage source. If hasAlpha is false, no change will occur.
Parameters
None.
Returns
None.
Description
The guessPulldown() method sets the fieldSeparationType and removePulldown to the best guesses for this
footage source. If isStill is true, no change will occur.
Parameters
Pul l dow n - used as an input argument to the guessPulldown()method of a FootageSource; use one of Enumerated
Me t h o d Types below
Enumerated Types
Returns
None.
Description
The hasAlpha attribute of FootageSource is true if the footage has an alpha component.
If true, then the attributes alphaMode, invertAlpha, and premulColor will have relevance. If false, then those
three fields have no relevant meaning for the footage.
Type
Description
The highQualityFieldSeparation attribute of FootageSource specifies whether After Effects will use special
algorithms to determine how to perform field separation.
It is an error to attempt to write to this attribute if isStill is true. It is an error to attempt to write to this
attribute if fieldSeparationType is FieldSeparationType.OFF.
Type
Description
The invertAlpha attribute of footageSource determines if 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,
then this attribute has no relevant meaning.
Type
Description
The isStill attribute of footageSource specifies whether the footage is still or 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
Description
The loop attribute of footageSource specifies the number of times that the footage is to be played consecutively
when used in a comp.
Legal range for values is [1 .. 9999] with a default value of 1. It is an error to attempt to write this attribute if
isStill is true.
Type
Description
The nativeFrameRate attribute of footageSource corresponds to the native frame rate of the footage.
Type
Description
The premulColor attribute of footageSource determines the color to be premultiplied. This attribute is valid
only if the alphaType is set to PREMULTIPLIED.
Type
Color (an array of four floating-point values from 0 to 1: [R, G, B, A]); read/write.
Description
The removePulldown attribute of Footage File Info specifies how the pulldowns are to be removed when field
separation is used.
It is an error to attempt to write to this attribute if isStill is true. It is an error to attempt to set this to a value
other than PulldownPhase.OFF in the case where fieldSeparationType is FieldSeparationType.OFF. The field-
SeparationType must be changed first.
Enumerated Type
ImportOptions object
n e w Imp o r tO p t i o n s ( ) ;
n e w Imp o r t O p t i o n s ( Fi l e );
Description
The ImportOptions object provides the ability to create, change, and access options for the importFile()
method. You can create ImportOptions using one of two constructors, one of which takes arguments, the
other which does not.
Constructors
If importFile() is set without arguments, it has a “file” that does not exist unless it is set in another statement:
n e w Imp o r tO p t i o n s ( ) . fi l e = n e w F i l e ( " my fil e . p s d " ) ;
Otherwise importFile can be set with a single argument, which is a File object:
v a r my _ i o = n e w Imp o r tO p t i o n s ( n e w F i l e ( " my fil e . p s d " ) ) ;
Attributes
Methods
canImpor tAs() see “ImportOptions canImportAs() sets the ImportAsType, allowing the input to
method” on page 95 be restricted to a particular type
Description
The canImportAs() method is used to determine whether a given file can be imported as a given Impor-
tAsType, passed in as an argument.
Parameters
Returns
Boolean.
Example
v a r i o = n e w Imp o r tO p t i o n s ( F i l e ( “c : \ \ f o o. p s d ” ) ) ;
i o. c a n Im p o r t As ( Im p o r t As Ty p e . C O M P )
Description
The file attribute specifies the file to be imported. This is used to get or change the file that is set in the
constructor.
Type
File; read/write.
Description
The forceAlphabetical attribute is a boolean. A value of true is equivalent to activating the Force Alphabetical
Order option in the File > Import > File dialog box.
Type
Boolean; read/write.
Description
The importAs attribute holds the importAsType for the file to be imported. You can set it by setting a file of
the type you want to import as an argument.
Enumerated Type
Description
The sequence attribute is a boolean; it determines whether a sequence or an individual file is imported.
Type
Boolean; read/write.
Item object
app. project.item(index)
app. project.items[index]
Description
The Item object represents an item that can appear in the Project window. FootageItem, CompItem, and
FolderItem are all types of Item.
Note that numbering of the index for item starts at 1, not 0.
Attributes
n am e see “Item name attribute” on page 98 name of the object as shown in the Project
window
s e l e c te d see “Item selected attribute” on page 99 true if this item is currently selected
Methods
rem ove() see “Item remove() method” on page 99 deletes the item from the project
Example
The following example will get the second item from the project and check that the typeName of that item is
"Folder". Then it will remove from that folder any top-level item that is a Solid, but only if it is not currently
selected. The example will also check to make sure that, for each item in the folder, the parentFolder is properly
set to be the correct folder.
var my Folder = app. project.item(2);
if (myFolder.t y p eName != "Folder" ) {
aler t("er ror : second item is not a folder");
}
else {
var numInFolder = my Folder.numItems;
// Always r un loops backwards when deleting thing s:
for(i = numInFolder ; i >= 1; i--) {
var curItem = my Folder.item(i);
if ( curItem.parentFolder != my Folder) {
aler t("er ror w ithin AE: the parentFolder is not set cor rectly");
}
else {
i f ( ! c u r Item . s e l e c te d & & c u r Item . t y p e Na m e = = " Fo o t a g e " ) {
/ / A h a ! a n u n s e l e c te d s o l i d .
curItem.remove();
}
}
}
}
Description
The item comment attribute is 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.ite m(index). i d
Description
The item ID attribute is a unique and persistent identification number used to identify an item between
sessions. The value of the ID will not change even after the project is saved to file and read in at a later time.
An ID is thus effectively permanent except when importing a project into another project, in which case new
IDs are assigned to the newly imported items.
Type
Integer; read-only.
Description
The item name attribute is the name of the item as displayed in the Project window.
Type
String; read/write.
Description
The Parent Folder attribute yields the Folder Item that contains the selected item. If this Item is at the top level
of the project, then the parentFolder will be the project's root folder, (app.project.rootFolder).
Type
FolderItem; read-only.
Description
The Item remove() method removes (deletes) this item from the project window. If the item is a FolderItem,
all the items contained in the folder will also be removed.
Parameters
None.
Returns
None.
Description
The selected attribute defines whether an item is selected or not. Multiple Items can be selected simultaneously
at any given time.
The selected attribute is true if this Item is currently selected. Setting this attribute to true will select the item.
Type
Boolean; read/write.
Description
The typeName attribute is a string representing a user-readable name of the type. Examples are Folder,
Footage and Composition.
Type
String; read-only.
ItemCollection
app. project .items
Description
The ItemCollection object represents a collection of Items. The ItemCollection belonging to a Project object
represents all the Items in the project. The ItemCollection belonging to a FolderItem object represents all the
Items in that folder.
Attributes
Methods
Description
The itemCollection addcomp() method creates a new CompItem and adds it to the ItemCollection.
If the ItemCollection belongs to the project or the root folder, then the new comp's parentFolder will be the
root folder. Otherwise, the new comp's parentFolder will be the FolderItem that owns the ItemCollection.
Parameters
Returns
CompItem.
KeyframeEase object
The KeyframeEase object specifies the KeyframeEase setting of a keyframe, which is determined by its speed
and influence settings.
Attributes
speed see “KeyframeEase speed attribute” on corresponds to the speed setting for a key-
page 101 frame
influence see “KeyframeEase influence attribute” corresponds to the influence setting for a key-
on page 101 frame in range [0.1..100.0]
Method
Description
This constructor creates a KeyframeEase value. Both paramters are required. Note that for non-spatial 2D and
3D properties you must set an easeIn and and easeOut for each dimension (see example below). Note also that
there are two types of ease: temporal and spatial.
Parameters
Returns
None.
Example
var ea seIn = n ew Ke y fr a meE a se(0. 5, 5 0 ) ;
var easeOut = new Ke y freameEase(0.75, 85);
myPo sitio n Prop er t y. setTemp o r a l E a se At Ke y( 2 , [ e a s e In ] , [ e a s e O u t ] ) ;
Description
This attribute specifies the influence value of the keyframe. The valid range is 0.1 to 100.0.
Type
Description
Type
Layer object
app. project.ite m(index). l ayer ( i n d e x )
Description
The Layer object provides access to a layer within Compositions. It can be accessed either by index number or
by a name string.
Those layers that are AV layers (Comp layers, footage layers, etc.) will be represented as AVLayer objects.
AVLayer is a subclass of Layer and contains additional methods and attributes. (See “AVLayer object” on
page 45 for more information.)
The Layer object is derived from PropertyGroup. All attributes of the PropertyBase and PropertyGroup
objects are available on Layers, as well.
Attributes
index see “Layer index attribute” on page 105 index of the layer, in the range [1,numLayers]
parent see “Layer parent attribute” on page 107 parent of this layer
time see “Layer time attribute” on page 109 current time of the layer
st ar tTi me see “Layer startTime attribute” on startTime of the layer, expressed in comp time
page 109
inPoint see “Layer inPoint attribute” on inPoint of the layer, expressed in comp time
page 105
outPoint see “Layer outPoint attribute” on outPoint of the layer, expressed in comp time
page 107
solo see “Layer solo attribute” on page 109 true if the layer is soloed
shy see “Layer shy attribute” on page 108 true if the layer is shy
locked see “Layer locked attribute” on page 105 true if the layer is locked
h a s Vi d e o see “Layer hasVideo attribute” on true if the layer contains a video component
page 105
a c t ive see “Layer active attribute” on page 103 true if the layer is active at the current time
nul l L ayer see “Layer nullLayer attribute” on true if this is a null layer
page 107
s e l e c te d Pro p e r t i e s see “Layer selectedProperties attribute” array containing all selected Property and
on page 108 PropertyGroup objects in Layer
Methods
rem ove() see “Layer remove() method” on deletes the layer from the composition
page 108
m ove To B e g i n n i n g ( ) see “Layer moveToBeginning() method” moves the layer to the top of the composition
on page 106 (the first layer)
moveTo E n d () see “Layer moveToEnd() method” on moves the layer to the bottom of the composi-
page 106 tion (the last layer)
moveAfter() see “Layer moveAfter() method” on moves the layer below another, specified layer
page 105
move Before() see “Layer moveBefore() method” on moves the layer above another, specified layer
page 106
copy To Comp () see “Layer copyToComp() method” on copies the layer to the top and beginning of
page 104 another composition
a c t iveAtTi m e ( ) see “Layer activeAtTime() method” on given a time, returns whether this layer will be
page 103 active at that time
set Pa ren tWi thJu mp () see “Layer setParentWithJump() establishes newParent as the parent of this
method” on page 108 layer
Example
If the first item in the project is a CompItem, the following example would disable the first layer in that
composition (i.e., turn the eyeball icon off) and rename it to "Lord High Imperial Layer."
var firstLayer = app. project.item(1).layer(1);
firstLayer. enabled = false;
firstLayer.name = "Lord Hig h Imper ial Layer";
Description
The Layer active attribute is true if the layer's video is active at the current time.
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 in between the inPoint and outPoint of this layer.
Note that an audio layer will not have active as true; there is a separate audioActive attribute in the AVLayer
object.
Type
Boolean; read-only.
Description
The layer activeAtTime method returns whether this layer will be active at a given time. To be true, the layer’s
enabled attribute must be true, no other layer may be soloing unless this layer is soloed too, and the given time
must be between this layer's inPoint and outPoint.
Parameters
Returns
Boolean.
Description
The layer copyToComp() method copies the layer into the comp specified by intoComp. The original layer
will remain unchanged.
Parameters
Returns
None.
Description
The layer duplicate method duplicates the layer. 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.
Description
The Layer enabled attribute is true if the layer is enabled, false otherwise. This corresponds to the toggle
control in the Layer window.
Type
Boolean; read/write.
Description
The Layer hasVideo attribute is true if the layer is enabled, false otherwise. This corresponds to the toggle
control in the Layer window.
Type
Boolean; read-only.
Description
The Layer index attribute is the index of the layer, in the range [1,numLayers].
Type
Integer; read-only.
Description
The Layer inPoint attribute is the in-point of the layer, expressed in comp time. Values may be in the range [-
10800, 10800].
Type
Description
The Layer locked attribute is true if the layer is locked, false otherwise. This correponds to the lock toggle in
the Layer window.
Type
Boolean; read/write.
Description
The Layer moveAfter method moves the layer below another, specified layer
Parameters
Returns
None.
Description
The Layer moveAfter method moves the layer above another, specified layer.
Parameters
Returns
None.
Description
The Layer moveToBeginning method moves the layer to the top of the layer stack (the first layer).
Parameters
None.
Returns
None.
Description
The Layer moveToEndmethod moves the layer to the bottom of the layer stack (the last layer).
Parameters
None.
Returns
None.
Description
The Layer name attribute is the name of the layer. This can be unique from the Source name (which cannot
be changed in the Layer window), although by default they are identical until edited.
Type
String; read/write.
Description
The Layer nullLayer attribute is true if the layer was created as a null object, false otherwise.
Type
Boolean; read/write.
Description
The Layer outPoint attribute is the out-point of the layer, expressed in comp time (seconds). Values may be in
the range [-10800, 10800].
Type
Description
The Layer parent attribute is the parent of this layer. The value may be null and may be set to null.
Note that, as in the regular application, if you set the parent, there will be no apparent jump in the layer's
transform. This is because offset values will be calculated to counterbalance any transforms above it in the
hierarchy. For example, if the new parent has a rotation of 30 degrees, then the child layer would be given a
rotation of -30 degrees.
If you want to set the parent while keeping the child layer's transform values from changing, use the “Layer
setParentWithJump() method” on page 108.
Type
Layer; read/write.
Description
Parameters
None.
Description
This attribute yields an array containing all of the selected Property and PropertyGroup objects in the layer.
Type
Description
The Layer setParentWithJump() method establishes newParent as the parent of this layer.
This method does not change the transform values of the child layer, and as a result, there may be an apparent
jump in the rotation, translation, or scale of the child layer.
If you do not want the child layer to jump, set the parent attribute directly (as in "childLayer.parent =
newParent;"). When you set the parent attribute directly, an offset will be calculated and set in the child layer's
transform fields, which will prevent the jump from occurring.
Parameters
Returns
None.
Description
The Layer shy attribute is true if the layer is shy, and therefore will be hidden in the Layer window if the compo-
sition’s hide all shy layers is toggled on.
Type
Boolean; read/write.
Description
Type
Boolean; read/write.
Description
The Layer startTime attribute is the startTime of the layer, expressed in comp time. Permitted values are in the
range [-10800, 10800] seconds, corresponding to +/- 3 hours.
Type
Description
The Layer stretch attribute is the layer’s time stretch, expressed as a percentage. A value of 100 means no
stretch.
Range can be [-9900, 9900]. Values between [-1, 1] will be clipped to minimum acceptable values. Those
between [0, 1] will be clipped to 1, and those between [-1, 0] (not including 0) will be set to -1.
Type
Description
The Layer time attribute is the current time of the layer, expressed in comp time (seconds).
Type
Returns
None.
LayerCollection
app. project.ite m(index). l co l l
Description
The Layer Collection represents a collection of layers. Each CompItem object contains one LayerCollection.
The LayerCollection attributes and methods provide access to and the ability to add new layers.
Attributes
Methods
add() see “LayerCollection add() method” on creates a new AVLayer containing the given
page 110 AVItem and adds it to the CompItem
a d d Nu l l ( ) see “LayerCollection addNull() method” layer returned is a newly created layer in the
on page 112 Comp that owns the LayerCollection
addSolid() see “LayerCollection addSolid() creates a new FootageItem that has a Solid-
method” on page 112 Source according to the specified parameters,
and adds it to the project
a d d Tex t ( ) see “LayerCollection addText() method” creates a new Text layer with the specified
on page 113 source text
addCamer a() see “LayerCollection addCamera() creates a new Camera layer with the specified
method” on page 111 name and center point
addLight() see “LayerCollection addLight() creates a new Light layer with the specified
method” on page 111 name and center point
byNa me() see “LayerCollection byName() method” returns the first layer found with the given
on page 113 name
precompose() see “LayerCollection precompose() collects the layers referred to by the indices
method” on page 113 given in layerIndices, and puts them into a new
CompItem with the given name
Example
Given that the first item in the project is a CompItem and the second item in the project is an AVItem, the
following code shows how to display the number of layers in the CompItem's layer collection, add a new layer
based on an AVItem in the project, and then display the new number of layers in the layer collection.
var firstComp = app. project.item(1);
v a r l ayer Co l l e c t i o n = fi r s t Co m p. l ayer s ;
aler t( "number of layers before is " + layerCollection.length);
var anAVItem = app. project.item(2);
l ayer Co l l e c t i o n . a d d ( a n AV Item ) ;
aler t( "number of layers after is " + layerCollection.length);
Description
The LayerCollection add() method creates a new AVLayer containing the given AVItem, and adds the new
AVLayer to the containing CompItem.
This method generates an exception if the item cannot be added as a layer to this CompItem.
The duration parameter, if provided, will affect the method only if the given AVItem contains a piece of still
footage; it has no effect on movies, sequences or audio. If duration is provided, then the duration of the newly
created layer will be the passed value. If duration is not provided, then the duration will be determined by the
user preferences.
Note that by default, user preferences proscribe that the duration be set equal to that of the CompItem into
which the layer is being added. The preference can be changed to a specific duration. Choose Edit > Prefer-
ences > Import (Windows) or After Effects > Preferences > Import, and specify options under Still Footage.
Parameters
Returns
AVLayer.
Description
Parameters
Returns
Camera layer.
Description
Parameters
Returns
Light layer.
Description
The LayerCollection addNull() method returns a newly created layer in the Comp that owns the LayerCol-
lection. The method has the same effect as choosing Layer > New > Null Object.
If duration is provided, then the duration of the newly created layer will be the passed value. If duration is not
provided, then the duration will be determined by user preferences.
Note that by default, user preferences specify that the duration be set equal to that of the CompItem into which
the layer is being added. The preference can be changed to a specific duration in the Preferences dialog box.
Choose Edit > Preferences > Import (Windows) or After Effects > Preferences > Import, and specify options
under Still Footage.
Parameters
dur at i on optional floating-point value specifying the duration of the new layer
Returns
AVLayer.
Description
The layerCollection addSolid() method creates a new FootageItem whose mainSource is a SolidSource
according to the specified parameters, and adds it to the project. This method also creates a new AVLayer that
has that new FootageItem as its source, and adds that layer to the containing CompItem.
Note that by default, user preferences proscribe that the duration be set equal to that of the CompItem into
which the layer is being added. The preference can be changed to a specific durationin the Preferences dialog
box. Choose Edit > Preferences > Import (Windows) or After Effects > Preferences > Import, and specify
options under Still Footage.
Parameters
color Establishes the color of the new FootageItem (a solid) contained in the layer. The
color argument must be an array of 3 floats lying in the range [0..1].
n a me Establishes the name of the new layer and the new FootageItem.
w id th Specifies the width, in pixels, of the new layer and the new FootageItem. Permit-
ted values are in the range [1 .. 30,000].
heig ht Specifies the height, in pixels, of the new layer and the new FootageItem. Permit-
ted values are in the range [1 .. 30,000].
Returns
AVLayer.
Description
Parameters
sou rceText string; optional, serves as the source text of the new layer
Returns
Text layer.
Description
The LayerCollection byName() method returns the first layer found with the given name. This method returns
null if no layer with the given name is found.
Parameters
Returns
Description
The LayerCollection precompose() method collects the layers referred to by the given indices (first parameter)
and puts them into a new CompItem that has the given name (second parameter). The given layers are
removed from the LayerCollection. The new CompItem is added into the LayerCollection and is also returned
by the precompose() method.
Parameters
moveAllAtt r i butes Optional boolean, defaults to true; may be set to false only if there is only 1 index
in the layerIndices array. Setting this to true corresponds to selecting the Move
All Attributes into the New Composition option in the Pre-Compose dialog box.
Setting it to false corresponds to selecting the Leave All Attributes In option in
the Pre-Compose dialog box.
Returns
CompItem.
MarkerValue object
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) .Mar kerValue
Description
The MarkerValue object holds the representation of a layer marker. It contains four string attributes:
comment, chapter, url, and frameTarget.
For more on the usage of markers see “Using markers” in After Effects Help.
Methods
Ma r kerVa lue() see “MarkerValue method” on page 115 Returns a MarkerValue. Sets the comment and,
optionally, the chapter, url and frameTarget
attributes.
Attributes
comment see “MarkerValue Comment attribute” string comment included with the marker
on page 116
ch a p ter see “MarkerValue Chapter attribute” on string Chapter Link reference point included
page 115 with the marker
url see “MarkerValue URL attribute” on string Uniform Resource Locator included with
page 116 the marker
Examples
MarkerValue method
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) .Mar kerValue( c o m m e n t )
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) .Mar kerValue( c o m m e n t , c h a p t e r )
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) .Mar kerValue( c o m m e n t , c h a p t e r, u r l )
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) .Mar kerValue( c o m m e n t , c h a p t e r, u r l , f ra m e Ta r g e t )
Description
The markerValue method sets between one and four specific attributes of the marker and returns a Marker-
Value.
Parameters
Returns
Description
The MarkerValue chapter attribute is a text chapter link attached to a given layer marker. Chapter links initiate
a jump to a chapter in a QuickTime movie or in other formats that support chapter marks (for more on
markers see “Using markers” in After Effects Help).
Type
String; read/write.
Description
The MarkerValue comment attribute is a text comment attached to a given layer marker. This comment
appears in the Timeline window next to the layer marker (for more on markers see “Using markers” in After
Effects Help).
Type
String; read/write.
Description
The MarkerValue frameTarget attribute is a text frame marker attached to a given layer marker. Used with a
URL, this can target a specific frame within a Web site (for more on markers see “Using markers” in After
Effects Help).
Type
String; read/write.
Description
The MarkerValue URL attribute is a text Uniform Resource Locator attached to a given layer marker. This URL
is an automatic link to a site (for more on markers see “Using markers” in After Effects Help).
Type
String; read/write.
MaskPropertyGroup object
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) . m a s k
Description
The MaskPropertyGroup object is derived from PropertyGroup and inherits all the attributes and methods of
PropertyBase and PropertyGroup, along with its own attributes and methods as follows.
Attributes
mas k Mo d e see “MaskPropertyGroup maskMode specifies the MaskMode for this mask
attribute” on page 117
roto B ezi er see “MaskPropertyGroup rotoBezier specifies whether the shape of the mask is
attribute” on page 118 Rotobezier
maskMotionBlur see “MaskPropertyGroup maskMotion- specifies how motion blur is applied to this
Blur attribute” on page 118 mask
color see “MaskPropertyGroup color color used to draw the mask outline in the user
attribute” on page 117 interface
Description
This attribute is the color used to draw the mask outline as it appears in the user interface (Composition
window, Layer window, and Timeline window).
Type
Description
Type
Boolean; read/write.
Description
This attribute is a boolean specifying whether the mask is locked and cannot be edited in the user interface.
Type
Boolean; read/write.
Description
This attribute is an enumerated type specifying the MaskMode for this mask.
Enumerated Types
Ma sk Mo d e. N ON E None
Ma sk Mo d e. A D D Add
MaskMode.SUBTRAC T Subtract
Ma sk Mo d e. I N TE R S E C T Intersect
Ma sk Mo d e. L I GH TE N Lighten
Ma sk Mo d e. DA R K E N Darken
Ma sk Mo d e. D I FFE R E N C E Difference
Description
This attribute is an enumerated type specifying how motion blur is applied to this mask.
Enumerated Type
MaskMotionBlur.ON On
MaskMotionBlur.OFF Off
Description
Type
Boolean; read/write.
OutputModule object
a p p. p ro j e c t . re n d e r Q u e u e . i t e m ( i n d e x ) . outputMo dule( i n d e x )
Description
The outputModule object of renderQueueItem generates a single file or sequence via a render, and contains
attributes and methods relating to that file to be rendered. It returns an Output Module with the given index
number. The indexed items are numbered beginning with 1.
Attributes
file see “OutputModule file attribute” on path and name of the file to be rendered
page 120
tem p l a tes see “OutputModule templates array of all Output Module templates
attribute” on page 121
Methods
rem ove() see “OutputModule remove() method” removes the Output Module
on page 120
saveAsTemp l a te() see “OutputModule saveAsTemplate() saves a new Output ModuleTemplate with the
method” on page 121 given name
OMCollection
a p p. p ro j e c t . re n d e r Q u e u e . i t e m s .outputMo dules
Description
Attributes
Methods
See also
Description
Parameters
Returns
None.
Description
The file attribute is the File object to which the output module is set to render.
Type
Description
The name attribute is the output module name as it is presented to the user, expressed as a string.
Type
St r ing; read-only.
Description
The postRenderAction attribute returns the Post Render Action (listed below).
Type
Description
Parameters
None.
Returns
None.
Description
Parameters
Returns
None.
Description
The templates attribute is an array of strings; these are the names of the templates in the local installation of
After Effects.
Type
Ar r ay ; read-only.
PlaceholderSource object
app. project.item(index).mainSource
app. project.item(index).proxySource
Description
The PlaceholderSource object holds information describing the footage source of a placeholder. It is a subclass
of FootageSource and so it inherits all attributes and methods of the FootageSource object. (See “Footage-
Source object” on page 89.)
There are no attributes or methods in PlaceholderSource other than those inherited from the FootageSource
object.
Project object
app. p ro j e c t
Description
The project object enables access to data and functionality within a particularAfter Effects project.
Attributes of the Project object provide access to specific objects within an After Effects project, such as
imported files and footage, comps, as well as project settings such as the timecode base.
Methods of the Project object can import footage, can create solids, compositions and folders, and can save
changes.
Attributes
file see “Project file attribute” on page 124 file object of the currently open project
ro otFolder see “Project rootFolder attribute” on folderItem containing all the contents of the
page 127 project; the equivalent of the Project window
items see “Project items attribute” on itemCollection representing all items in the
page 126 project
a c t iveIte m see “Project activeItem attribute” on currently active item, or null if none is active or
page 123 multiple items are active
bitsPerChannel see “Project bitsPerChannel attribute” color depth of the current project
on page 123
t r ansparencyGr idThumbnails see “Project transparencyGridThumb- determines if thumbnail views should use the
nails attribute” on page 130 transparency checkerboard pattern
t i m e co d e B a s e Ty p e see “Project timecodeBaseType timecode base as set in the File > Project Set-
attribute” on page 128 tings dialog box
timeco deNTSCDropFr ame see “Project timecodeNTSCDropFrame equivalent to Drop Frame or Non-Drop Frame
attribute” on page 129 in the File > Project Settings dialog box
num Items see“Project numItems attribute” on total number of items contained in the project
page 126
selection see “Project selection attribute” on array of the items selected in the Project win-
page 128 dow
Methods
rem oveUnu s e d Fo o t a g e ( ) see “Project removeUnusedFootage() replicates the functionality of File > Remove
method” on page 127 Unused Footage
re d u ce Pro j e c t ( ) see “Project reduceProject() method” on replicates the functionality of File > Reduce
page 126 Project
close() see“Project close() method” on closes the project with normal save options
page 123
save() see “Project save() method” on page 127 saves the project (or displays a Save dialog box
if project has never been saved)
s aveWi t h D i a l o g ( ) see “Project saveWithDialog() method” displays a Save dialog box; returns true if file
on page 128 was saved
impor tPlaceholder() see “Project importPlaceholder() replicates the functionality of File > Import >
method” on page 125 Placeholder.
impor tFile() see “Project importFile() method” on replicates the functionality of File > Import >
page 124 File.
showWindow() see “Project showWindow() method” on if true, shows the project window
page 128
Description
The project attribute activeItem returns the item that is currently active and is to be acted upon, or a null if no
item is currently selected or if multiple items are selected.
Type
Description
The bitsPerChannel attribute is an integer describing the color depth of the current project (either 8 or 16
bits).
Type
Description
Closes the project with the option of saving changes automatically, prompting the user to save changes or
closing without saving changes.
Parameters
Enumerated Types
Returns
Boolean. False only in one case: the file has not been previously saved; the user is presented with a Save dialog
box, and cancels the save.
Description
Parameters
None.
Returns
Description
The file attribute is a File object representing the project that is currently open.
Type
Description
Parameters
Returns
FootageItem
Example
app. p ro j ect. imp o r tFil e( Imp o r tOp ti on s ( F i le ( “s a m p le . p s d ” ) )
See also
Description
Replicates the functionality of File > Import > Placeholder; adds a placeholder footage item of a specified
name, width, height, framerate, and duration to the project.
Parameters
Returns
FootageItem.
Description
Replicates the functionality of File > Import > File and produces an Import dialog box for the user. Unlike
importFile(), importWithDialog() does not take arguments.
Returns
Array of Items created during import; or null if the user cancels the dialog.
Description
Parameters
Returns
Item.
Description
Type
ItemCollection; read-only.
Description
The numItems attribute represents the total number of items contained in the project, including folders and
all types of footage.
Type
Integer; read-only.
Example
n = a p p. p ro j ect. nu mItems;
aler t("There are " + n + " items in this project.")
Description
Parameters
Returns
Example
var theItems = n ew Ar r ay ();
theItems[theItems.length] = app. project.item(1);
theItems[theItems.length] = app. project.item(3);
a p p. p ro j e c t . re d u ce Pro j e c t ( t h e Item s ) ;
Description
Parameters
None.
Returns
Description
Type
RenderQueue; read-only.
Description
The rootFolder attribute is the root folder containing the root contents of the project; this is a conceptual
folder that contains all items in the Project window, but not items contained inside other folders in the Project
window.
Type
FolderItem; read-only.
Description
Saves the project (or prompts the user if the file has never previously been saved). Passing in a File object is
equivalent to the Save As command and allows you to save a project to a new file.
Parameters
Returns
None.
Description
This method presents the Save dialog box to a user. The user can either name a file with a location and save it,
or click Cancel and exit the dialog.
This method returns a boolean that is true if the file was saved, and false if not.
Parameters
None.
Returns
Description
The selection attribute contains an array of the items selected in the Project window.
Type
Array; read-only.
Description
This method shows or hides the Project window, depending on how its argument is set.
Parameters
doShow boolean; if true, shows the Project window, if false, hides the Project window
Returns
None.
Description
The timecodeBaseType attribute reveals the Timecode Base as set in the Project Settings dialog box.
Enumerated Type
Description
The timecodeDisplayType attribute describes the method with which timecode is set to display. The
enumerated values are found in a menu in the Project Settings dialog box.
Enumerated Type
Description
The timecodeFilmType attribute describes the film type that has been selected for the Feet + Frames option
in the Project Settings dialog box.
Enumerated Type
Description
The timecodeNTSCDropFrame attribute describes how timecode for 29.97 fps footage is displayed. This
corresponds to the Drop Frame or Non-Drop Frame pulldown options under “NTSC” in the Project Settings
dialog box.
Type
Boolean (read/write); true if NTSC Drop Frame is set as the current project display style.
Description
The transparencyGridThumbnails attribute determines if thumbnail views should use the transparency
checkerboard pattern (yes or no).
Type
Boolean (read/write).
Property object
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) . prop er t y
Description
The Property object contains value, keyframe, and/or expression information about a particular property of
the layer. Examples of a Property are position, zoom, and mask feather.
Note that in standard JavaScript descriptions a “property” and an “attribute” are synonymous. Because After
Effects contained this separate use of the term “property” before any scripting support was added, this
documentation refers only to “attributes” when speaking about accessible values within scripting. “Property”
meanwhile remains the term for values attached to layers, effects and masks both within this document and
throughout After Effects.
Attributes
prop er t y Va lueTy p e see “Property propertyValueType type of value stored in this property
attribute” on page 142
v a lu e see “Property value attribute” on value of the property at the current time
page 149
has Mi n see “Property hasMin attribute” on true if there is a minimum permitted value
page 135
has Ma x see “Property hasMax attribute” on true if there is a maximum permitted value
page 135
isSpatial see “Property isSpatial attribute” on true if property defines a spatial value
page 136
canVar yOverTime see “Property canVaryOverTime true if the property can be keyframed
attribute” on page 134
isTi meVa r y i n g see “Property isTimeVarying attribute” true if the property has keyframes or an
on page 136 expression enabled that vary its values
u n i tsText see “Property unitsText attribute” on text description of the units in which the value
page 149 is expressed
ex pression see “Property expression attribute” on the expression string for this property
page 134
ex pressionEnabled see “Property expressionEnabled if true, the expression is used to generate val-
attribute” on page 135 ues for the property
expressionEr ror see “Property expressionError attribute” contains error if the last expression evaluated
on page 135 with an error
s e l e c te d Ke y s see “Property selectedKeys attribute” on array containing the indices of all selected key-
page 144 frames of the Property
Methods
valueAtTime() see “Property valueAtTime() method” returns value of the property evaluated at
on page 149 given time
setValue() see “Property setValue() method” on sets the static value of the property
page 147
setValueAtTime() see “Property setValueAtTime() creates a keyframe at the given time (if none
method” on page 148 exists) for the property
setValuesAtTimes() see “Property setValuesAtTimes() creates a keyframe that is an array at the given
method” on page 148 time (if none exists) for the property
setValueAtKe y() see “Property setValueAtKey() method” finds the keyframe with the given index and
on page 148 sets the value of the property at that keyframe
nearestKe y In dex() see “Property nearestKeyIndex() returns the index of the keyframe nearest to
method” on page 142 the given time
ke yTime() see “Property keyTime() method” on returns the time at which the condition given
page 141 by the arguments occurs
ke yValue() see “Property keyValue() method” on returns the value of the property at the time at
page 141 which the condition given by the arguments
occurs
a d d Ke y ( ) see “Property addKey() method” on adds a new keyframe at the given time
page 134
rem oveKe y () see “Property removeKey() method” on removes the keyframe with the given index
page 143
isInterolationTy p eValid() see “Property isInterpolationTypeValid() true if this property can be interpolated
method” on page 136
set In ter p o l a ti o n Ty p eAtKe y () see “Property setInterpolationTypeAt- sets the interpolation type for the key
Key() method” on page 144
ke yInInter polationTy p e() see “Property keyInInterpolationType() returns the 'in' interpolationType for the given
method” on page 137 key
ke yOutInter polationTy p e() see “Property keyOutInterpolation- returns the 'out' interpolationType for the
Type() method” on page 138 given key
set S p a ti a l Ta n g en tsAtKe y () see “Property setSpatialTangentsAt- sets the in and out tangent vectors for the
Key() method” on page 146 given key
ke yInSpatialTangent() see “Property keyInSpatialTangent() returns the 'in' spatial tangent for the given key
method” on page 137
ke yOutSpatialTangent() see “Property keyOutSpatialTangent() returns the 'out' spatial tangent for the given
method” on page 138 key
set Temp o r a l E a seAtKe y () see “Property setTemporalEaseAtKey() sets the in and out temporal ease for the given
method” on page 147 key
ke yInTempor alEase() see “Property keyInTemporalEase() returns the 'in' temporal ease for the given key
method” on page 137
ke yOutTempor alEase() see “Property keyOutTemporalEase() returns the 'out' temporal ease for the given
method” on page 138 key
set Temp o r a l Co n tinu o u - see “Property setTemporalContinuou- specifies whether the keyframe has temporal
sAt Ke y () sAtKey() method” on page 146 continuity
ke yTempor alContinuous() see “Property keyTemporalContinuous() returns whether the keyframe has temporal
method” on page 140 continuity
setTempor alAutoBezierAtKe y() see “Property setTemporalAutoBezier- specifies whether the keyframe has temporal
AtKey() method” on page 146 auto bezier
ke yTempor alAutoBezier() see “Property keyTemporalAutoBezier() returns whether the keyframe has auto bezier
method” on page 140
ke y S p a t i a l Co n t i nu o u s ( ) see “Property keySpatialContinuous() returns whether the keyframe has spatial con-
method” on page 140 tinuity
set S p a ti a l Au to B ezi erAtKe y see “Property setSpatialAutoBezierAt- specifies whether the keyframe has spatial
Key() method” on page 145 auto bezier
ke ySpatialAutoBezier() see “Property keySpatialAutoBezier() returns whether the keyframe has spatial auto
method” on page 139 bezier
ke yRov in g () see “Property keyRoving() method” on returns whether the keyframe is roving
page 139
Examples
5 How to check that a scale calculated by an expression at time 3.5 is the expected value of [10,50]
var my Proper t y = myLayer.scale;
// false value of preExpression means e v aluate the ex pression
var scaleValue = my Proper t y.valueAtTime(3.5,false);
if (scaleValue[0] == 10 && scaleValue[1] == 50) {
aler t("hur r ay");
else {
aler t("oops");
}
7 Changing the keyframe values for the first three keyframes of some source text
myProper t y = my TextLayer.sourceText;
i f ( my Prop e r t y. nu m Ke ys < 3 ) {
aler t("er ror, I thoug ht there were 3 ke y fr ames");
}
my Proper t y.setValueAtKe y(1, new TextDocument("ke y number 1");
my Proper t y.setValueAtKe y(2, new TextDocument("ke y number 2");
8 Setting values using the convenience syntax for position, scale, color, or source text
// These two are equivalent. The second fills in a default of 0.
myLayer. p o sitio n . setVa l u e([ 20, 30, 0 ] ) ;
myLayer. p o sitio n . setVa l u e([ 20, 30 ] ) ;
// These two are equivalent. The second fills in a default of 100.
myLayer.scale.setValue([ 50, 50, 100]);
myLayer.scale.setValue([ 50, 50 ]);
// These two are equivalent. The second fills in a default of 1.0
myLig ht.color.setValue([ .8, .3, .1, 1.0]);
myLig ht.color.setValue([ .8, .3, .1]);
/ / T h e s e t wo a re e q u iv a l e n t . T h e s e con d c re a te s a Tex t D o c u m e n t
myTextL ayer. so u rceText. setVa l u e(n ew Tex t D oc u m e n t ( " f oo" ) ) ;
my TextLayer.sourceText.setValue("foo");
Description
The property addKey method adds a new keyframe at the given time and returns the index of the new
keyframe.
Parameters
Returns
Description
The Property canVaryOverTime attribute is true if this property can vary over time, in other words, if
keyframe values or expressions can be written to this property.
Type
Boolean; read-only.
Description
The Property expression attribute is the expression for this property, expressed as a string. This attribute forces
an evalution of the given expression string. The value always changes to the given expression string even if the
string is not a valid expression.
If the given string is a valid expression, expressionEnabled becomes true. If the given string is not a valid
expression, an error is generated, and expressionEnabled is set to false. If you set a property’s expression to the
empty string, expressionEnabled will be set to false.
Type
String; read/write.
Description
The Property expressionEnabled attribute, if true, uses the expression to generate the value for the property.
If the attribute is false, then the expression is not used; keyframe information or the static value of the property
is used. This attribute can be set to true only if the expression contains a valid expression string.
Type
Boolean; read/write.
Description
The Property expressionError attribute contains the error if the last expression string given to the expression
attribute evaluated with an error.
If no expression string has been given to the expression, or if the last expression string given to expression
evaluated without error, it contains the empty string ("").
Type
String; read-only.
Description
The Property hasMax attribute is true if there is a maximum permitted value for this property.
Type
Boolean; read-only.
Description
The Property hasMin is true if there is a minimum permitted value for this property.
Type
Boolean; read-only.
Description
This method returns true if this Property can be interpolated using the theType.
Parameters
t h eTy p e KeyframeInterpolationType
Returns
Boolean.
Description
The Property isSpatial attribute is true if the property defines a spatial value. Examples are position and effect
point controls.
Type
Boolean; read-only.
Description
The Property isTimeVarying attribute is true if the property is time varying. A property is time varying if it
has keyframes or an enabled expression. If isTimeVarying is true, then canVaryOverTime must also be true.
Type
Boolean; read-only.
Description
Enumerated Types
Description
This method returns the 'in' interpolationType for the given key.
Parameters
Returns
KeyframeInterpolationType.
Description
This method returns the 'in' spatial tangent for the given key.
If the PropertyValueType is TwoD_SPATIAL, the return value contains 2 floating-point values. If the Proper-
tyValueType is ThreeD_SPATIAL, the return value contains 3 floating-point values.
If the PropertyValueType is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
Returns
Description
This method returns the 'in' temporal ease for the given key.
The return value is an array of KeyframeEase objects. The dimension of the array depends on the dimension
of the property's keyframeValueType. For ThreeD, the dimension of the array is 3. For TwoD, it is 2. For all
other keyframeValueTypes, it is 1.
Parameters
Returns
Description
This method returns the 'out' interpolationType for the given key.
Parameters
Returns
KeyframeInterpolationType.
Description
This method returns the 'out' spatial tangent for the given key.
If the PropertyValueType is TwoD_SPATIAL, the return value contains 2 floating-point values. If the Proper-
tyValueType is ThreeD_SPATIAL, the return value contains 3 floating-point values.
If the PropertyValueType is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
Returns
Description
This method returns the 'out' temporal ease for the given key.
The return value is an array of KeyframeEase objects. The dimension of the array depends on the dimension
of the property's keyframeValueType. For ThreeD, the dimension of the array is 3. For TwoD, it is 2. For all
other keyframeValueTypes, it is 1.
Parameters
Returns
Description
Parameters
Returns
Boolean.
Description
Parameters
Returns
Boolean.
Description
This method returns whether the keyframe has spatial auto-bezier interpolation.
If the PropertyValueType is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Note that spatial auto-bezier has an effect at this keyframe only if keySpatialContinuous(keyIndex) is true.
Parameters
Returns
Boolean.
Description
Parameters
Returns
Boolean.
Description
Parameters
Returns
Boolean.
Description
Parameters
Returns
Boolean.
Description
The property keyTime method finds the keyframe or marker specified in the arguments and returns the time
at which it occurs.
If no keyframe or marker can be found that matches the argument, this method generates an exception, and
an error is displayed.
Parameters
mar kerComment string; the comment attached to a marker (see “MarkerValue Comment attribute” on page 116)
Returns
Description
The property keyValue method finds the keyframe or marker specified in the arguments and returns the time
at which it occurs.
If no keyframe or marker can be found that matches the argument, this method generates an exception, and
an error is displayed.
Parameters
mar kerComment string; the comment attached to a marker (see “MarkerValue Comment attribute” on page 116)
Returns
Description
The Property maxValue attribute contains the maximum permitted value of the property. If the hasMax
attribute is false, an exception occurs, and an error is generated.
Type
Description
The Property maxValue attribute contains the minimum permitted value of the property. If the hasMax
attribute is false, an exception occurs, and an error is generated.
Type
Description
The property nearestKeyIndex method returns the index of the keyframe nearest to the given time.
Parameters
time floating-point value; the time at which to search for the nearest key
Returns
Description
The Property numKeys attribute contains the number of keyframes in this property. If this attribute’s value is
0, then the property is not being keyframed.
Type
Integer; read-only.
Description
The Property numKeys attribute contains the type of value stored in this property.
The enumerated type associated with this attribute has one value for each type of data that can be stored in
and/or retrieved from a property. All property objects store data that falls into one of these categories.
Each type of data is stored and retrieved in a different kind of structure. For example, a 3D spatial property
(like a layer's position) is stored as an array of three floating point values. When setting a value for position,
you'd pass in such an array, as in:
my layer. proper t y("position").setValue([10,20,0]);
For another example, a shape property (such as a layer's mask shape) is stored as a Shape object. When setting
a value for a shape, pass in a shape object, as in:
v a r my S h a p e = n e w S h a p e ( ) ;
mySha p e. ver ti ces = [[0, 0], [0, 100], [1 0 0 , 1 0 0 ] , [ 1 0 0 , 0 ] ] ;
var my Mask = my layer. proper t y("ADBE Mask Pa r a de").proper t y(1);
my Ma s k . p rop e r t y ( " A D B E Ma s k S h a p e " ) . s e t Va l u e ( my S h a p e ) ;
Enumerated Types
Proper t y ValueTy p e.ThreeD_SPATIAL array of three floating point positional values, e.g., Anchor
Pont [10, 20.2, 0]
Proper t y ValueTy p e.ThreeD array of three floating point quantitative values, e.g., Scale
[100, 20.2, 0]
Proper t y ValueTy p e.TwoD_SPATIAL array of 2 floating point positional values, e.g., Anchor Pont
[5.1, 10]
Proper t y Va lueTy p e.Two D array of 2 floating point quantitative values, e.g., Scale [5.1,
100]
Proper t yValueTy p e.COLOR array of 4 floating point values in the range 0..1, e.g., [.8, .3, .1,
1.0]
Proper t y ValueTy p e.CUSTOM_VALUE unimplemented type; you cannot get and set values for
properties with this type
Proper t yValueTy p e.MARKER MarkerValue object (see “MarkerValue object” on page 114)
Description
The property removeKey method removes a keyframe with the given keyIndex. If no keyframe with that
keyIndex exists, this method generates an exception and an error is displayed.
Parameters
Returns
None.
Description
The Property selectedKeys attribute yields an array of indices of all the selected keyframes in this Property. If
no keys are selected, or if the property has no keyframes, an empty array is returned.
Type
Description
This method sets the in and out interpolation types for the given key.
If an outType is not provided, then outType will be set equal to the inType.
Parameters
Returns
None.
Description
Parameters
Returns
None.
Description
Parameters
onOff the new setting to use; if true, keyframe is selected, if false, deselected
Returns
None.
Description
Parameters
Returns
None.
Description
Parameters
Returns
None.
Description
This method sets the in and out tangent vectors for the given key.
If no outTangent argument is provided, outTangent will be set equal to inTangent. If the PropertyValueType
is TwoD_SPATIAL, the inputs should be arrays containing 2 floating-point values. If the PropertyValueType
is ThreeD_SPATIAL, the inputs should be arrays containing 3 floating-point values.
If the PropertyValueType is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
outTangent Floating-point value (optional); the out tangent vector for this keyframe
Returns
None.
Description
This method specifies whether the keyframe has temporal auto-bezier interpolation.
Note that spatial auto bezier has an effect at this keyframe only if keySpatialContinuous(keyIndex) is true.
Parameters
Returns
None.
Description
Parameters
Returns
None.
Description
This method sets the in and out temporal ease for the given key.
If outTemporalEase is not provided, then outTemporalEase will be set equal to the inTemporalEase.
InTemporalEase and outTemporalEase are arrays of KeyframeEase objects. The dimension of the array
depends on the dimension of the property's keyframeValueType. For ThreeD, the dimension of the array is 3.
For TwoD, it is 2. For all other keyframeValueTypes, including TwoD_SPATIAL and ThreeD_SPATIAL types,
it is 1.
Parameters
Returns
None.
Description
The property setValue method sets the static value of the property.
If the property has keyframes, this method cannot be used; see “Property setValueAtTime() method” on
page 148 or “Property setValueAtKey() method” on page 148 instead. If used with a property that has
keyframes, this method generates an exception and an error is displayed.
The type of value to use as an argument depends on the propertyValueType.
Parameters
newValue propertyValueType; a value appropriate for the type of property being set
Returns
None.
Description
The property setValueAtKey method finds the keyframe with the given keyIndex and sets the value at that
keyframe.
If the property has no keyframes, or no keyframe with the given keyIndex, this method generates an exception
and an error is displayed.
The type of value to use as an argument depends on the propertyValueType.
Parameters
newValue propertyValueType; a value appropriate for the type of property being set
Returns
None.
Description
The property setValueAtTime method creates a keyframe at the given time (if none exists) and sets the value
at that keyframe.
If no keyframes yet exist, this method creates and sets the first keyframe at the given time. If no keyframe exists
at the given time, this method creates one. If a keyframe does exist at the given time, this method sets its value.
The type of value to use as an argument depends on the propertyValueType.
Parameters
newValue propertyValueType; a value appropriate for the type of property being set
Returns
None.
Description
The property setValuesAtTimes method creates keyframes at a given series of times (for those times where no
keyframes exist) and sets values of those keyframes.
If no keyframes yet exist, this method creates a set of keyframes and sets the first keyframe at the given time.
If no keyframe exists at the given time, this method creates one. If a keyframe does exist at the given time, this
method sets its value.
Times and values are expressed as arrays. The type of value to use as arguments depends on the propertyVal-
ueType.
Parameters
[newValues] propertyValueType; an array of values appropriate for the type of property being set
Returns
None.
Description
The Property unitsText attribute is a text description of the units in which the value is expressed.
Type
String; read-only.
Description
The Property value attribute contains the value of the property at the current time. If expressionEnabled is
true, value returns the evaluated expression value; if there are keyframes, value returns the keyframed value at
the current time; in all other cases, value returns the static value for the property.
The type of value returned depends on the propertyValueType of the stream.
Type
Examples
See “Getting and setting the value of an opacity” on page 132, “Getting and setting the value of a position” on
page 133, and “Changing the value of a mask shape to be open instead of closed” on page 133 under Property
Object Examples.
Description
The property valueAtTime method returns the value of the property as evaluated at the given time. Time is in
seconds with the beginning of the composition represented as zero.
The preExpression option is relevant only if the property has an expression applied; otherwise it is ignored. It
controls whether any expression is used to calculate the value.
Note that the type of value returned is not made explicit; it will be of a different type, depending on the
property evaluated.
Parameters
preExpression boolean; determines whether to evaluate the property before or after applying any active
expression
Returns
PropertyBase object
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) . prop er t y B ase
Description
PropertyBase is the base class for both PropertyGroup and Property, so PropertyBase attributes and methods
are also available to PropertyGroup and Property. Because PropertyGroup is the base class for Layer, its
attributes and methods are available for Layers as well.
Attributes
matchNa me see “PropertyBase matchName special name for the property used to build
attribute” on page 153 unique naming paths
prop er t y In dex see “PropertyBase propertyIndex index of a PropertyBase within its ParentGroup
attribute” on page 155
prop er t y Depth see “PropertyBase propertyDepth indicates number of levels of parent Property-
attribute” on page 154 Groups between the PropertyBase and the
layer
prop er t yTy p e see “PropertyBase propertyType returns the PropertyType describing this Prop-
attribute” on page 155 ertyBase
parentProper t y see “PropertyBase parentProperty returns the PropertyGroup that is the parent of
attribute” on page 154 this PropertyBase
i s Mo d i fi e d see “PropertyBase isModified attribute” returns true if the PropertyBase has been
on page 153 changed since its creation
canSetEnabled see “PropertyBase canSetEnabled true if the user interface displays an eyeball
attribute” on page 151 icon for this property
enabled see “PropertyBase enabled attribute” on corresponds to the setting of the eyeball icon,
page 152 if there is one
elided see “PropertyBase elided attribute” on returns whether this property is elided (not
page 152 displayed) in the user interface
isEffect see “PropertyBase isEffect attribute” on true if this property is an effect PropertyGroup
page 153
isMa sk see “PropertyBase isMask attribute” on true if this property is a mask PropertyGroup
page 153
Methods
rem ove() see “PropertyBase remove() method” on removes the PropertyBase from the project
page 156
moveTo () see “PropertyBase moveTo() method” moves the PropertyBase to the specified
on page 154 newIndex within its PropertyGroup
duplicate() see “PropertyBase duplicate() method” duplicates the PropertyBase and returns the
on page 152 duplicate
Description
This attribute specifies whether the property is active. For a layer, this corresponds to the setting of the eyeball
icon. For an effect and all properties, it is the equivalent to the “enabled” attribute.
This attribute can be written only if canSetEnabled is true.
Type
Description
This attribute specifies whether you can write as well as read the enabled attribute. As a rule of thumb, this
attribute is set to true if the user interface displays an eyeball icon for this property (thus it is true for all layers).
Type
Boolean; read-only.
Description
The PropertyBase duplicate method duplicates the PropertyBase and returns the duplicate.
This method is valid only for children of indexed groups; if not, an exception is generated and an error is
displayed.
Parameters
None.
Returns
Description
This attribute specifies whether this property is elided in the user interface. If elided, then this property is just
a group used to organize other properties. The property is not displayed in the user interface and its child
properties are not indented in the Timeline window.
Type
Boolean; read-only.
Example
Given a text layer with two animators and no properties twirled down, you would see:
• Text
• Path Options
• More Options
• Animator 1
• Animator 2
However, Animator 1 and Animator 2 are actually contained in a PropertyBase called “Text Animators”, which
is not displayed in the user interface, and so these two properties are not indented in the Timeline window.
Description
This attribute specifies whether this property is enabled. It corresponds to the setting of the eyeball icon, if
there is one.
If there is no eyeball icon, this attribute will default to true; you can write this attribute only if canSetEnabled
is true.
If you try to write this attribute and canSetEnabled is false, an exception will be generated.
Type
Description
This attribute specifies whether this property is an effect PropertyGroup (in which case it is set to true).
Type
Boolean; read-only.
Description
This attribute specifies whether this property is a mask PropertyGroup (in which case it is set to true).
Type
Boolean; read-only.
Description
The PropertyBase isModified attribute returns true if the PropertyBase has been changed since its creation.
Type
Boolean; read-only.
Description
The PropertyBase matchName attribute is a special name for the property used to build unique naming paths.
This name helps to identify that the property is part of a unique classification.
Every property has a unique matchName identifier. MatchNames are meant to be stable from version to
version regardless of its "name" in the user interface or any changes to the application. You can't see match-
Names directly through the user interface. But you can refer to them through scripting and sample them via
this attribute.
Note: Unlike names, matchNames do not change based on the language of the After Effects user interface (English/
French/German/Japanese).
Type
String; read-only.
Description
The PropertyBase moveTo method moves the PropertyBase to the specified newIndex within its Property-
Group.
This method is valid only for children of indexed groups; if not, or if newIndex is not valid, an exception is
generated and an error is displayed.
Parameters
newIndex integer; the index within the same PropertyGroup to which the PropertyBase is to be moved.
Returns
None.
Description
Type
String; read/write.
Description
The PropertyBase parentProperty returns the PropertyGroup that is the parent of this PropertyBase, or null
if this PropertyBase is a layer.
Type
PropertyGroup; read-only.
Description
The PropertyBase propertyDepth is 0 for a layer. Add 1 (one) for each level of parent PropertyGroup above
this PropertyBase until the layer has been reached.
Type
String; read-only.
Description
The PropertyBase propertyGroup method returns the parent PropertyGroup, found by moving up the
hierarchy the number of levels proscribed by countUp.
The countUp is optional and defaults to 1 if not provided. Range of countUp must be within [1 ...property-
Depth]. Returns NULL if countUp takes you as far up as the parent of the layer containing this propertyBase.
Parameters
cou n tUp integer (optional); defaults to 1; the number of levels to ascend within the range 1..property-
Depth.
Returns
Description
Type
Integer; read-only.
Description
Enumerated Types
Description
The PropertyBase remove method removes the PropertyBase from its parent group. If the PropertyBase is a
PropertyGroup, it removes the child properties as well.
This method is valid only for children of indexed groups; if not, an exception is generated and an error is
displayed.
This method may be called on a text animation property (any animator that has been set to a text layer).
Parameters
None.
Returns
None.
Description
This attribute specifies whether this PropertyBase is selected. Setting selected to true selects the property;
setting it to false deselects.
The value of this attribute can be read for any Property, PropertyGroup or Layer. The value can be written on
a PropertyGroup only if it is an effect or mask; attempting to set this attribute for any other kind of Property-
Group will generate an exception.
Note that sampling this attribute can slow down system performance if it is used repeatedly to sample a large
number of properties. To read the full set of selected Properties for a Comp or Layer, use the selectedProperties
attribute of Comp or Layer.
Type
Boolean; read/write.
PropertyGroup object
a p p. p ro j e c t . i t e m ( i n d e x ) . l ay e r ( i n d e x ) . prop er t yGroup
Description
The PropertyGroup object represents a group of PropertyBase objects, (i.e., Property objects and/or Proper-
tyGroup objects). PropertyGroups may be nested to provide a chain all the way from the Layer at the top down
to a single Property (such as the mask feather of the third mask).
Attributes
Methods
prop er t y() see “PropertyGroup property() method” returns the child PropertyGroup or Property
on page 158 with the given propertyIndex or name
c a n Ad d Prop e r t y ( ) see “PropertyGroup canAddProperty() true if a property with the given name can be
method” on page 158 added to the PropertyGroup
a d d Prop e r t y ( ) see “PropertyGroup addProperty() adds a property with the given name to the
method” on page 157 PropertyGroup
Description
This method adds a property with the given name to this group.
Properties may only be added to a PropertyGroup whose propertyType is PropertyType.INDEXED_GROUP.
The only exception to this rule is a text animator property, which is contained in a NAMED_GROUP.
This method generates an exception if a property cannot be created with the given name, so it is always a good
idea to call PropertyGroup canAdd Property() method first to check. (See “PropertyGroup canAddProperty()
method” on page 158.)
The following names are supported:
• Any matchName for a property that can be added normally using the user interface. For example, ADBE
Mask Atom, ADBE Paint Atom, ADBE Text Position, ADBE Text Anchor Point.
• When adding to an ADBE Mask Parade: ADBE Mask Atom, Mask.
• When adding to an ADBE Effects Parade, any effect by matchName, such as ADBE Bulge, ADBE Glo2, APC
Vegas.
• Any effect by display name, such as Bulge, Glow, Vegas.
• For text animators and selectors, Text Animator maps to ADBE Text Animator, Range Selector maps to
ADBE Text Selector, Wiggly Selector maps to ADBE Text Wiggly Selector, and Expression Selector maps to
ADBE Text Expressible Selector.
Parameters
Returns
PropertyBase.
Description
This method returns true if a property with the given name can be added to this PropertyGroup.
Parameters
Returns
Boolean.
Example
The maskGroup can only add masks. The only legal input arguments are as follows:
• mask
• ADBE Mask Atom
Any other argument is illegal. Therefore:
• maskGroup.canAddProperty("mask") returns true
• maskGroup.canAddProperty("ADBE Mask Atom") returns true
Any other input for maskGroup argument is false. For example, maskGroup.canAddProperty("blend")
returns false
Description
Type
Integer; read-only.
Description
This method finds and returns the child PropertyBase, using either its propertyIndex or its name.
If using a string to provide the name argument, you may use any of the following:
• Any name used in expressions “parenthesis style” syntax, meaning the display name or the compact English
name
• Any match name
• Any expressions intercap sytax
See below for examples of these various types of names. Essentially, the method replicates syntax available with
expressions. In other words, the following are all allowed and are virtually interchangeable (where “mylayer”
is an already identified layer):
• my l ayer. p o s i t i o n
• my l ayer ( " p o s i t i o n " )
• my layer. proper t y("position")
as well as the following, which are also interchangeable with one another:
• my l ayer(1)
• my layer. proper t y(1)
• Note that some properties of a Layer, such as position and zoom, can be accessed only by name. When using
the name argument to find a property that is multiple levels down, you will need to make more than one
call of this method; for example,
myLayer. proper t y("ADBE Masks").proper t y(1)
will search two levels down, and return the first mask in the mask group.
If no Property or PropertyGroup can be found with the given name, this method returns a value of null.
Properties that can be accessed using this method with the name argument include:
Properties that can be accessed by name from any • "ADBE Mask Parade", or “Masks”
Layer
• "ADBE Effect Parade", or “Effects”
• "Scale" or "scale"
• "Rotation" or "rotation"
• "Opacity" or "opacity"
• "Marker" or "marker"
• "Aperture" or "aperture"
• "Ambient" or "ambient"
• "Diffuse" or "diffuse"
• "Specular" or "specular"
• "Shininess" or "shininess"
• "Metal" or "metal"
Properties that can be accessed by name from a cam- • "X Rotation" or "xRotation" or "Rotation X" or "rotationX"
era, light or 3D layer
• "Y Rotation" or "yRotation" or "Rotation Y" or "rotationY"
• "Orientation" or "orientation"
Properties can be accessed by name from a text layer • "Source Text" or "sourceText" or "Text" or "text"
Properties that can be accessed from an AVLayer with • "Time Remap" or "timeRemapEnabled"
a non-still source
Properties that can be accessed from an AVLayer with • "Audio Levels" or "audioLevels"
an audio
Properties that can be accessed by name from a Prop- • "ADBE Mask Atom"
ertyGroup "ADBE Mask Parade"
Properties that can be accessed by name from a Prop- • "ADBE Mask Shape", or “maskShape”
ertyGroup "ADBE Mask Atom"
• "ADBE Mask Feather", or “maskFeather”
Parameters
index integer; the propertyIndex of the target PropertyBase, in the range [1..numProperties]
n a me string; the name of the target PropertyBase, which is a child of the current one.
Returns
PropertyBase; or NULL if no property with the given string name can be found.
Examples
1 If a layer (e.g., myLayer) has a Box Blur effect, you can retrieve the effect in any of the following ways:
myLayer. proper t y(“Effects”).proper t y(“Box Blur”);
myLayer.proper t y(“Effects”).proper t y(“ boxBlur”);
RenderQueue object
app. project. renderQueue
Description
The RenderQueue object enables access to data and functionality within the Render Queue area of a particular
After Effects project. This object is pivotal to render automation.
Attributes of the RenderQueue object provide access to items in the Render Queue and their render status.
Methods of the RenderQueue object can start, pause, and stop the render process.
The RenderQueueItem object provides access to the specific settings for an item to be rendered.
Attributes
render ing see “RenderQueue rendering attribute” determines whether a render is in progress
on page 163
num Items see “RenderQueue numItems attribute” total number of items in the Render Queue
on page 162
Methods
showWindow() see “RenderQueue showWindow() boolean to show/hide the Render Queue win-
method” on page 163 dow
render() see “RenderQueue render() method” on starts the render; does not return until render
page 162 is complete
Description
This method returns a render queue item with the given index number.
Parameters
Returns
RenderQueueItem.
Description
The items attribute of renderQueue provides a collection of all items in the Render Queue as a collection.
Type
RQItemCollection; read-only.
See also
Description
The numItems attribute indicates the total number of render queue items in the Render Queue.
Type
Integer; read-only.
Description
Pauses the Render Queue; equivalent to use of the Pause button in the Render Queue window during a render.
Parameters
pa u se boolean; set to true, it pauses the render, set to false, it continues a paused render
Returns
None.
Description
Starts the Render Queue; equivalent to use of the Render button in the Render Queue window. Does not
return until render is complete.
Set the app.onError if you wish to be notified of errors during the rendering process.
Set the RenderQueueItem.onStatusChanged attribute of a particular RenderQueueItem to get updates while
the render is progressing.
Parameters
None.
Returns
None.
See also
Description
The rendering attribute indicates whether rendering is in progress. This is a read-only attribute; use the
render() and stopRendering() methods to control it. If the render is paused, this is set to true.
Type
Boolean; read-only.
Description
The showWindow method of RenderQueue is a boolean; if true, it makes the Render Queue window visible,
if false, it hides the window.
Parameters
doShow boolean; if true, shows the Render Queue window; if false, conceals it
Returns
None.
Description
Stops the Render Queue; equivalent to use of the Stop button in the Render Queue window during a render.
Useful to call in the event of an onStatusChanged callback.
Parameters
None.
Returns
None.
See also
RQItemCollection
app. project .renderQueue.items
Description
The RQItemCollection contains all of the Render Queue items. This is the equivalent of all of the items found
in the Render Queue window of a given project.
Attributes
Methods
See also
RenderQueueItem object
app.project.renderQueue.item(index )
Description
Attributes
numOutputMo dules see “RenderQueueItem numOutput- total number of Output Modules assigned to a
Modules attribute” on page 166 given Render Queue item
render see “RenderQueueItem render boolean that shows true if this item will render
attribute” on page 168 when the queue is started
st ar tTi me see “RenderQueueItem startTime Date object representing time program began
attribute” on page 169 rendering the item
timeSpanStart see “RenderQueueItem timeSpanStart start time, in seconds, in the comp to be ren-
attribute” on page 170 dered
skipFr a mes see “RenderQueueItem skipFrames number of frames to skip when rendering
attribute” on page 168
com p see “RenderQueueItem comp attribute” composition being rendered by this RQ item
on page 166
tem p l a tes see “RenderQueueItem templates array of the Render Settings templates
attribute” on page 169
status see “RenderQueueItem status attribute” current status of a Render Queue item
on page 169
Methods
outputMo dule() see “RenderQueueItem outputModule() returns an Output Module for the item
method” on page 167
rem ove() see “RenderQueueItem remove() deletes the item from the Render Queue
method” on page 167
saveAsTemp l a te() see “RenderQueueItem saveAsTem- saves a new Render Settings Template with the
plate() method” on page 168 given name
Description
The applyTemplate method of renderQueueItem applies a Render Settings template to the item.
Parameters
Returns
None.
Description
The comp attribute returns the CompItem object that will be rendered by this Render Queue item. This is a
read-only attribute; to change the Composition, the Render Queue item must be deleted and re-created.
Type
CompItem; read-only.
Description
The elapsedSeconds attribute shows the number of seconds spent rendering the item.
Type
Description
The logType attribute returns one of the log types (listed below).
Enumerated Type
Description
The numOutputModules attribute represents the total number of Output Modules assigned to a given Render
Queue item.
Type
Integer; read-only.
Description
The onStatusChanged attribute is invoked whenever the value of the RenderQueueItem.status attribute is
changed.
Note that changes cannot be made to render queue items (or to the application) while a render is in progress
(including when paused). This mirrors the regular application functionality.
Type
Function.
Example
fu n cti o n my S ta tu sC ha n g ed () {
aler t(app. project.renderQueue.item(1).status)
}
Description
The outputModules attribute returns the collection of Output Modules for the item.
Type
OMCollection; read-only.
Description
Parameters
Returns
OutputModule.
Description
The remove method of renderQueueItem deletes the referenced item from the Render Queue.
Parameters
None.
Returns
None.
Description
The render attribute determines whether an item will render when the Render Queue is started.
Type
Boolean; read/write.
Description
The saveAsTemplate method of RenderQueueItem saves the item’s current render settings as a new template
with the name passed as a parameter.
Parameters
Returns
None.
Description
The skipFrames attribute specifies the number of frames to skip when rendering. It is used to do quicker
rendering tests than a full render. The total length of time remains unchanged.
A value of 0 specifies no skipped frames and results in regular rendering of all frames. A value of 1 specifies
that every other frame is to be skipped. This is equivalent to "rendering on twos." Higher values will skip a
larger number of frames. For example, if skip has a value of 1, for sequence output you'd get half the number
of frames and for movie output each frame would be double the duration.
The permissible range of values for skipFrames is [0..99].
Type
Integer. Read/write.
Description
The startTime attribute returns a Date object showing the day and time that the item started rendering.
Type
Description
The status attribute represents the current render status of the item.
Enumerated Type
RQItemStatus.UNQUEUED render item is listed in the Render Queue window but is not ready to render
Description
The templates attribute returns an array of the names of Render Settings templates available for the item. It is
a read-only attribute.
Type
Array; read-only.
Description
The timeSpanDuration attribute determines the duration, in seconds, of the comp to be rendered. This
achieves the same effect as setting a custom end time in the Render Settings dialog box, although the duration
is determined by subtracting the start time from the end time.
Type
Description
The timeSpanStart attribute determines the time in the comp, in seconds, at which rendering will begin. This
is the equivalent of setting a custom start time in the Render Settings dialog box.
Type
Settings object
Description
The Settings object provides an easy way to manage settings for scripts. The settings are persistent between
application launches, saved in the After Effects Preferences file.
Methods
s ave S e t t i n g ( ) see “Settings saveSetting() method” on can save a default value for a preferences item
page 171
getSetting() see “Settings getSetting() method” on retrieves a setting found in the Prefs file
page 170
h ave S e t t i n g ( ) see “Settings haveSetting() method” on used to determine whether a given section
page 171 name and key name have a setting assigned
Description
Parameters
s e c t i o n Na m e text string that holds the name of a section of settings; in the prefs file these are the names
enclosed in brackets and quotation marks
ke yNa me text string that describes an individual setting name; these are listed in quotation marks below
the sectionName
Returns
Example
v a r n = a p p. s e t t i n g s . g e t S e t t i n g ( " E r a s e r - Pa i n t S e t t i n g s " , " A l i g n e d C l o n e " ) ;
alert("The setting is " + n);
See also
Description
The haveSetting method is used to determine whether a given section name and key name have a setting
assigned.
Returns
Boolean.
See also
Description
The saveSetting method can save a default value for a scripting preferences item.
Parameters
s e c t i o n Na m e text string that holds the name of a section of settings; in the prefs file these are the names
enclosed in brackets and quotations
ke yNa me text string that describes an individual setting name; these are listed in quotations below the
sectionName
See also
Shape object
app. p rojec t . i te m (i n d ex ). l ay er(i n d e x ) . p rop e r t y ( 1 ) . p rop e r t y ( i n d e x ) . p rop e r t y( " m a s k S h a p e " ) . v a lu e
Description
The Shape object holds information describing the outline shape of a Mask.
Attributes
closed see “Shape closed attribute” on specifies whether the shape is a closed curve
page 173
ver t ices see “Shape vertices attribute” on array of floating-point pairs specifying the
page 174 anchor points of the shape
inTangents see “Shape inTangents attribute” on array of floating-point pairs specifying the tan-
page 173 gent vectors coming into the shape vertices
outTangents see “Shape outTangents attribute” on array of floating-point pairs specifying the tan-
page 173 gent vectors coming out of the shape vertices
Methods
Examples
3 Creating an oval
An oval is a closed shape with 4 points and inTangents and outTangents:
v a r my S h a p e = n e w S h a p e ( ) ;
mySha p e. ver ti ces = [[300, 50], [200, 1 5 0 ] , [ 3 0 0 , 2 5 0 ] , [ 4 0 0 , 1 5 0 ] ] ;
mySha p e. in Ta n g en ts = [[55. 23, 0], [0, - 5 5 . 2 3 ] , [ - 5 5 . 2 3 , 0 ] , [ 0 , 5 5 . 2 3 ] ] ;
mySha p e. o u tTa n g en ts = [[- 55. 23, 0], [ 0 , 5 5 . 2 3 ] , [ 5 5 . 2 3 , 0 ] , [ 0 , - 5 5 . 2 3 ] ] ;
my S h a p e . c l o s e d = t r u e ;
Description
This attribute specifies whether the shape is a closed curve. If true, the first and last vertices will be connected
to form a closed curve. If false, the closing segment will not be drawn.
Type
Boolean; read/write.
Description
This attribute describes an array of float pairs specifying the tangent vectors (direction handles) associated
with the vertices of the shape.
Each float pair specifies one inTangent. There is one inTangent and one outTangent associated with each
vertex in the vertices array. However, when creating a shape to set as a keyframe value, you may leave inTangent
and/or outTangent null, or you may leave entries unfilled; they will be automatically padded with zeroes. This
will result in straight line segments in the non-RotoBezier case; in the RotoBezier case the zeros will be ignored
and the inTangents/outTangents will be automatically calculated.
Each vertex on the shape has two direction handles. The inTangent is the direction handle associated with the
line segment 'coming into' the vertex from the preceding vertex in the shape.
The inTangents are x,y coordinates specified relative to the associated vertex. For example, an inTangent of [-
1,-1] is located above and to the left of the vertex and has a 45 degree slope, regardless of the actual location
of the vertex. The longer a handle is, the greater an influence it has, so an incoming shape segment will hug
the tangent vector closer for an inTangent of [-2,-2] than it will for an inTangent of [-1,-1], even though both
of these come toward the vertex from the same direction.
If a shape is not closed, the inTangent for the first vertex and the outTangent for the final vertex will be ignored.
These two vectors would otherwise specify the dirction handles of the final connecting segment out of the final
vertex and back into the first vertex.
Note that if a shape is used in a mask with Rotobeziers, then the tangent values will be ignored on write (i.e.,
ignored when you set the new shape), because RotoBezier masks calculate their tangents automatically. This
means that, for RotoBezier masks, you can construct a shape by setting only the vertices attribute and setting
inTangents and outTangents both to null. If you set the shape without tangents, then follow this by getting the
shape once again; the new shape's tangent values will be filled with the automatically-calculated tangent
values.
Type
Description
This attribute describes an array of float pairs specifying the tangent vectors (direction handles) associated
with the vertices of the shape.
Each float pair specifies one inTangent. There is one inTangent and one outTangent associated with each
vertex in the vertices array. However, when creating a shape to set as a keyframe value, you may leave inTangent
and/or outTangent null, or you may leave entries unfilled; they will be automatically padded with zeroes. This
will result in straight line segments in the non-RotoBezier case; in the RotoBezier case the zeros will be ignored
and the inTangents/outTangents will be automatically calculated.
Each vertex on the shape has two direction handles. The outTangent is the direction handle associated with
the line segment 'going out of ' the vertex toward the next vertex in the shape.
The outsTangent are x,y coordinates specified relative to the associated vertex. For example, an inTangent of
[-1,-1] is located above and to the left of the vertex, and has a 45 degree slope, regardless of the actual location
of the vertex. The longer a handle is, the greater an influence it has, so an incoming shape segment will hug
the tangent vector closer for an inTangent of [-2,-2] than it will for an inTangent of [-1,-1], even though both
of these come toward the vertex from the same direction.
If a shape is not closed, the inTangent for the first vertex and the outTangent for the final vertex will be ignored.
These two vectors would otherwise specify the dirction handles of the final connecting segment out of the final
vertex and back into the first vertex.
Note that if a shape is used in a mask with Rotobeziers, then the tangent values will be ignored on write (i.e.,
ignored when you set the new shape), because RotoBezier masks calculate their tangents automatically. This
means that, for RotoBezier masks, you can construct a shape by setting only the vertices attribute and setting
inTangents and outTangents both to null. If you set the shape without tangents, then follow this by getting the
shape once again, the new shape's tangent values will be filled with the automatically-calculated tangent
values.
Type
Description
This method is the constructor to create a new shape. After constructing a shape with this method, set the
various attributes individually to fill the shape with desired values.
Parameters
None.
Returns
Shape.
Description
This attribute describes an array of float pairs specifying the anchor points of the shape. Each float pair is an
array of two floats.
Type
SolidSource object
app. project.ite m(index) . m a i n S o u rce
app. project.ite m(index) .proxySource
Description
The SolidSource object holds information describing a solid color footage source. It is a subclass of Footage-
Source and so it inherits all attributes and methods of the “FootageSource object” on page 89.
Attributes
Description
The color attribute of SolidSource specifies the color of the solid. The value is an array of three floats for red,
green, and blue, where those floats are in the range [0..1].
Type
System object
system
Description
The System object provides access to attributes found on the user’s system, such as the user name or the name
and version of the operating system.
Attributes
userName see “System userName attribute” on user name logged in to the current session of
page 176 the operating system
o sNa me see “System osName attribute” on name of the operating system currently run-
page 176 ning
osVersion see “System osVersion attribute” on version of the operating system currently run-
page 176 ning
Description
The machineName attribute specifies the name of the machine on which the program is running, and is
expressed as a text string.
Type
String; read-only.
Example
Description
The osName attribute specifies the name of the operating system on which the program is running, and is
expressed as a text string.
Type
String; read-only.
Example
Description
The osVersion attribute specifies the version of the current local operating system, and is expressed as a text
string.
Type
String; read-only.
Example
Description
The userName attribute specifies the name of the user logged on to the system, and is expressed as a text string.
Type
String; read-only.
Example
confir m( "You are: " + system.userName + " r unning on " + system.machineName + ".");
TextDocument object
Description
The TextDocument object holds a string an attribute named "text." It is used to store values for a text layer's
Source Text property.
Attributes
text see “TextDocument text attribute” on text string stored in the TextDocument
page 177
Methods
Examples
1 Set a value of some source text and then display an alert showing the new value:
var my TextD o cu men t = n ew TextD o c u m e n t ( " Ha p py C a ke " ) ;
myTextLayer. proper t y("Source Text").setValue(myTextDocument);
aler t(myTextLayer. proper t y("Source Text").getVa lue());
2 Set keyframe values for text that will show different words over time:
var textProp = my TextLayer. proper t y("Source Text");
textProp.setValueAtTime(0, new TextDocument("Happy"));
tex t Prop. setVa l u eAtTi me(. 33, n ew Tex t D oc u m e n t ( " c a ke " ) ) ;
tex t Prop. setVa l u eAtTi me(. 66, n ew Tex t D oc u m e n t ( " i s " ) ) ;
tex t Prop. setVa l u eAtTi me(1, n ew Text D oc u m e n t ( " yu m my! " ) ) ;
Description
Type
String; read/write.
Description
Parameters
Returns
TextDocument.
Examples
Following are sample scripts included on your CD with an overview of what they do and a step-by-step
breakdown of how they work. This set of examples is by no means exhaustive, but it does demonstrate some
of scripting’s more complex features in action. It also shows some typical programming constructions from
JavaScript that apply to scripting.
For examples specific to the use of the user interface, see “Creating User Interface Elements” on page 197. For
more examples from Adobe, as well as from other After Effects users, visit Adobe Studio Exchange at http://
share.studio.adobe.com, and choose Scripting under the Adobe After Effects section.
Apply effect
This example is a rather simple one; it first requires that the user select an AVLayer and, if that condition is
met, sets a 10-pixel Fast Blur to the selected layer (or layers), with Repeat Edge Pixels set to true.
The comments that appear on lines beginning with double forward slashes (//) describe what is occurring in
each section of the script. The script does the following, in order:
• checks that at least one selected layer can have effects applied to it
• adds Fast Blur to any selected layer that can
• sets Blurriness to 10 and turns on Repeat Edge Pixels
• returns a boolean stating whether the effect was added
• starts an undo group so that if the effect is being applied to more than one layer, the entire script operation
can be undone in one step rather than several
• sets an error with instructions to the user should the script fail to apply an effect to any layer
{
/ / T h i s f u n c t i o n a p p l i e s t h e e f f e c t to o n e s i n g l e l ayer
//
function applyFastBlurToLayer(the_layer)
{
v a r a d d e d It = f a l s e ;
/ / s e t t h e p a r a m e ter v a l u e s
the_layer("Effects")("Fast Blur").blur r iness.setValue(10);
t h e_ l ayer("E ffects")("Fa st B l u r"). rep e a t E d ge P i xe ls . s e t Va lu e ( t r u e ) ;
a d d e d It = t r u e ;
}
}
/ / Re t u r n a b o o l e a n s ay i n g w h e t h e r we a d d e d t h e e f f e c t
re t u r n a d d ed It;
}
/ / G e t t h e a c t ive com p
v a r a c t ive Ite m = a p p. p ro j e c t . a c t ive Item ;
i f ( a c t ive Item ! = nu l l & & ( a c t ive Item i n s t a n ce o f Com p Item ) ) {
v a r a c t iveCom p = a c t iveIte m ;
/ / t r y to a p p l y to e ve r y s e l e c te d l ayer
v a r s e l e c te d L ayer s = a c t iveCom p. s e l e c te d L ayer s ;
f o r ( v a r i = 0 ; i < s e l e c te d L ayer s . l e n g t h ; i + + ) {
v a r c u r L ayer = s e l e c te d L ayer s [ i ] ;
/ / T h e m e t h o d re t u r n s t r u e i f i t a d d s t h e e f f e c t , f a l s e o t h e r w i s e .
if (applyFastBlurToLayer(curLayer) == t r ue) {
numLayersChanged++;
}
}
}
// Pr in t a messa g e i f n o l ayers were af f e c te d
if (numLayersChanged == 0) {
a l e r t ( " P l e a s e s e l e c t a n AV l ayer o r l ayer s a n d r u n s c r i p t a g a i n " ) ;
}
app. endUndoGroup();
}
Replace text
This script performs an action much too specific to be useful as it is, but it shows the basics for a very useful
general operation, which is the automatic editing of text layers. Quite simply, the script looks for selected text
layers that contain the text string “blue” and changes this string to read “monday”--note that “blue” could
appear anywhere in the selected layer, even as part of another word, and still be changed. For example,
“bluejean” will read “mondayjean” after the effect is applied.
The comments that appear on lines beginning with double forward slashes (//) describe what is occurring in
each section of the script. The script does the following, in order:
/ / G e t t h e a c t ive com p
v a r a c t ive Ite m = a p p. p ro j e c t . a c t ive Item ;
i f ( a c t ive Item ! = nu l l & & ( a c t ive Item i n s t a n ce o f Com p Item ) ) {
v a r a c t iveCom p = a c t iveIte m ;
/ / t r y to a p p l y to e ve r y s e l e c te d l ayer
v a r s e l e c te d L ayer s = a c t iveCom p. s e l e c te d L ayer s ;
f o r ( v a r i = 0 ; i < s e l e c te d L ayer s . l e n g t h ; i + + ) {
v a r c u r L ayer = s e l e c te d L ayer s [ i ] ;
app. endUndoGroup();
}
Next, if the project has been saved at least once before, we set some variables to point to the name of the file
and to the numbering and file extension that we plan to add to it. The lastIndexOf() JavaScript searches a
string backwards (from end to start) and in this case looks for the dot that separates the name from the
extension.
} else {
var cu r rFi l e = a p p. p ro j ect. fi l e;
var cu r rFi l eNa me = cu r rFi l e. n a me;
var extPo s = cu r rFil eNa me. l a stIn d ex O f ( " . " ) ;
v a r ex t = " " ;
Now we set the currFileName variable to the current name, before the dot.
if (extPo s ! = - 1) {
ext = cur rFileName.subst r ing(extPos, cur rFileName.length);
cur rFileName = cur rFileName.subst r ing(0, extPos);
}
Next we set a variable that will increment versions starting with 0, and we check to see if there is an underscore
character four characters from the end of currFileName. If there is, we assume that the incrementer has run
before, as its job is to assign a 3-digit suffix after an underscore incremented one higher than the last suffix. In
that case we set incrementer to the current numerical string and extract the name without this numerical
extension.
var incrementer = 0;
if (cur rFileName.charAt(cur rFileName.length -4) == "_") {
incrementer = cur rFileName.subst r ing(cur rFileName.length - 3, cur rFileName.length);
cur rFileName = cur rFileName.subst r ing(0, cur rFileName.length -4);
}
Now we add an incrementer loop and test for whether numbering has extended to two or three digits (e.g., if
the numbering has reached “_010” or above, or “_100” or above), assigning a zero for each if not.
incrementer++;
var ist r ing = incrementer + "";
if (incrementer < 10) {
ist r i n g = "0" + ist r in g ;
}
Finally we create a new file using our updated name and extension, display an alert letting the user know the
new file name being saved, and save the project with the new file name.
var n ewFil e = Fi l e(cu r rFil e. p a th + " / " + c u r r F i le Na m e + " _ " + i s t r i n g + ex t ) ;
ale r t(n ewFi l e. fsNa me);
app. p ro j ect. save(n ewFil e);
}
i f ( a p p. s e t t i n g s . h aveS e t t i n g ( s e c t i o n Na m e , ke y Na m e ) ) {
s e a rch S t r i n g = a p p. s e t t i n g s . g e t S e t t i n g ( s e c t i o n Na m e , ke y Na m e ) ;
}
Now we display a prompt to the user asking for what text string we should use.
searchSt r ing = prompt("What st r ing to render?", searchSt r ing);
We next go through the project looking for the text entered by the user, and seeing if the item that contains
that text is a composition, sending all compositions with that text string in their names to the Render Queue.
If the user cancels, the text is undefined. Otherwise, we save the new setting in preferences, convert it to all
lowercase letters for consistency’s sake (keeping in mind that the search will not be case sensitive).
if ( s ea rchS t r i n g ) {
a p p. s e t t i n g s . s aveS e t t i n g ( s e c t i o n Na m e , ke y Na m e , s e a rch S t r i n g ) ;
searchSt r ing = searchSt r ing .toLowerCase();
for (i = 1; i <= app. project.numItems; ++i) {
var curItem = app. project.item(i);
if (cu rItem i n sta n ceo f Comp Item ) {
if (curItem.name.toLowerCase().indexOf(searchSt r ing) != -1) {
app. project.renderQueue.items.add(curItem);
}
}
}
Finally, we make the Render Queue window visible and bring it to the front, ready for the user to assign save
locations for the new render queue items.
app. project.renderQueue.showWindow(t r ue);
}
Next, we make certain that the user entered a new location (and didn’t cancel the dialog). Then we create a
loop for each selected render queue item. If this item is queued, we take the current render location, give it a
new name and location, and then display an alert stating the new file path.
i f ( n e w L o c a t i o n ) { / / b o o l e a n to s e e i f t h e u s e r c a n ce l l e d
for (i = 1; i <= app. project.renderQueue.numItems; ++i) {
var curItem = app. project.renderQueue.item(i);
if (curItem.status == RQItemStatus.QUEUED) {
for (j = 1; j <= curItem.numOutputMo dules; ++j) {
var curOM = curItem.outputMo dule(j);
va r o l d L o ca tio n = cu rOM. fi l e;
curOM.file = new File(newLocation.toSt r ing() + "/" + oldLocation.name);
a l er t(cu rOM. fi l e. fsNa me);
}
}
}
}
Smart import
This script allows the user to import the full, nested contents of a folder just by selecting it. It attempts to detect
whether each item is a still, moving footage, or an image sequence. The user still has to make other choices via
dialogs, such as which layer of a multi-layer image (e.g., a .psd file) to import.
First, we prompt the user for a folder whose contents are to be imported, and ascertain that the user chooses
a folder rather than cancelling the dialog. We then call a function that appears below to import all of the files,
one by one.
var targetFolder = folderGetDialog("Impor t Items from Folder...");
//ret u r n s a fo l d er o r nu l l
if (targetFolder) {
f u n c t i o n p ro ce s s F i l e ( t h e F i l e ) {
v a r i m p o r t O p t i o n s = n e w Imp o r tO p t i o n s ( t h e F i l e ) ;
/ / c re a te a v a r i a b l e con t a i n i n g Im p o r t O p t i o n s
impor tSafeWithEr ror (impor tOptions);
}
Now we add a function to test whether a given file is part of a sequence. This uses Regular Expressions, which
are a special type of JavaScript designed to reduce the number of steps required to evaluate a string. The first
one tests for the presence of sequential numbers anywhere in the file name, followed by another making
certain that the sequential files aren’t of a type that can’t be imported as a sequence (moving image files).
We then check adjacent files to see if a sequence exists, stopping after we’ve evaluated ten files to save
processing time.
fu n cti o n testFo rS equ en ce (fi l es){
var searcher = new Re gExp ("[0-9]+");
va r mov ieFil eS ea rcher = n ew Re gE x p ( " ( m ov |av i |m p g) $ " , " i " ) ;
var parseResults = new Ar r ay ;
If no match is found using the Regular Expression looking for a number string, we get null and assume there
is no image sequence. Otherwise, we want an array consisting of the matched string and its location within
the file name.
if (cur rentResult) {
//we have a match - the st r ing contains numbers
//the match of those numbers is stored in the ar r ay[1]
//take that number and save it into parseResults
parseResults[parseResults.length] = cur rentResult[0];
}
else {
parseResults[parseResults.length] = nu ll;
}
}
else {
parseResults[parseResults.length] = nu ll;
}
}
Now if all of the files just evaluated indicated that they are part of a numbered sequence, we assume that we
have a sequence and return the first file of that sequence. Otherwise, we end this function.
v a r res u l t = nu l l ;
for (i = 0; i < parseResults.length; ++i) {
if (parseResults[i]) {
if (! result) {
result = files[i];
}
} else {
/ / ca se i n which a fi l e n a me d i d n ot con t a i n a nu m b e r
res u l t = nu l l ;
break;
}
}
re tur n result;
}
Next we add a function to pop up error dialogs if there is a problem with any file we are attempting to import.
f u n c t i o n i m p o r t S a f e Wi t h E r ror ( i m p o r t O p t i o n s ) {
try {
a p p. p ro j ect. imp o r tFil e (imp o r tO p t i on s ) ;
} catch (er ror) {
aler t(er ror.toSt r ing() + impor tOptions.file.fsName);
}
}
Next comes a function to actually import any image sequence that we discover using testForSequence(),
above. Note that there is an option for forcing alphabetical order in sequences, which is commented out in the
script as written. If you want to force alphabetical order, un-comment the line “importOptions.forceAlpha-
betical = true” by removing the two slashes at the beginning of that line.
function processFolder(theFolder) {
var files = theFolder.getFiles();
//Get an ar r ay of files in the target folder
//test whether theFolder contains a sequence
var sequenceStar tFile = testForSequence(files);
//if it does contain a sequence, impor t the sequence
if (sequenceStar tFile) {
va r imp o r tOp ti o n s = n ew Imp o r t O p t i on s ( s e q u e n ce S t a r t F i le ) ;
/ / c re a te a v a r i a b l e con t a i n i n g Imp o r t O p t i o n s
impor tOptions.sequence = t r ue;
/ / i m p o r t O p t i o n s . f o rceA l p h a b e t i c a l = t r u e ;
//un-comment this if you want to force alpha order by default
impor tSafeWithEr ror (impor tOptions);
}
processFolder(targetFolder);
s a f e To Ru n S c r i p t = a p p. p ro j e c t ! = nul l ;
if (! a p p. p ro j ect) {
a l er t ("A p ro j ect mu st be o p en to r u n t h i s s c r i p t . " ) ;
}
if (sa feTo Ru n S cr i p t) {
debugger ;
//check the render queue and make cer tain at least one item is queued
sa feTo Ru n S cr i p t = fa l se;
for (i = 1; i <= app. project.renderQueue.numItems; ++i) {
if (app. project.renderQueue.item(i).status ==
RQItemStatus.QUEUED) {
sa feTo Ru n S cr i p t = t r u e;
break;
}
}
if (! sa feTo Ru n S cr ip t) {
aler t ("You do not have any items set to render.");
}
}
Now we check whether we have email settings already saved in the Preferences. If so, we don’t need to prompt
the user. If not, we run the email_setup.jsx script, which prompts the user as to the mail gateway, sender and
recipient addresses. If there are saved settings that you need to change, you can always run email_setup.jsx to
make new settings that overwrite the existing ones.
if (sa feTo Ru n S cr i p t) {
v a r s e t t i n g s = a p p. s e t t i n g s ;
i f ( ! s e t t i n g s . h aveS e t t i n g ( " E m a i l S e t t i n g s " , " Ma i l S e r ve r " ) | |
! s e t t i n g s . h aveS e t t i n g ( " E m a i l S e t t i n g s " , " Re p l y - to Ad d re s s " ) | |
! s e t t i n g s . h aveS e t t i n g ( " E m a i l S e t t i n g s " , " Re n d e r Rep o r t
Re cipient")){
e v al( email_setupfile.read() );
email_setupfile.close();
}
Now we’re ready to render. Once rendering is complete, the script creates a text string for the email message
that contains the start time of the render, the render time of each item in the queue, and the total render time.
myQueue.render();
Now email the message, using the three settings from the email_methods.jsx script that has been automatically
run to prompt the user for the server, above.
i f ( ! s e t t i n g s . h aveS e t t i n g ( " E m a i l S e t t i n g s " , " Ma i l S e r ve r " ) | |
! s e t t i n g s . h aveS e t t i n g ( " E m a i l S e t t i n g s " , " Re p l y - to Ad d re s s " ) | |
! s e t t i n g s . h aveS e t t i n g ( " E m a i l S e t t i n g s " , " Re n d e r Rep o r t
Re cipient")){
aler t("Can't send an email, I don't have all the setting s I need.
Ab or ting .");
} else {
/ / L o a d co d e fro m a fi l e w ith han dy e m a i li n g m e t h od s :
va r ema i l Co d eFi l e = n ew Fi l e("e m a i l_ m e t h od s . js x " ) ;
emailCodeFile.open("r");
e v a l ( ema il Co d eFil e. rea d () );
emailCodeFile.close();
Finally, we send an error if for any reason we are unable to send the mail.
v a r s e r ve r S e t t i n g = s e t t i n g s . g e t S e t t i n g ( " E m a i l S e t t i n g s " , " Ma i l
Ser ver");
v a r f ro m S e t t i n g = s e t t i n g s . g e t S e t t i n g ( " E m a i l S e t t i n g s " , " Re p l y -
to Ad d ress");
v a r to S e t t i n g = s e t t i n g s . g e t S e t t i n g ( " E m a i l S e t t i n g s " , " Re n d e r
Repor t Re cipient");
v a r my Ma i l = n e w E m a i l S o c ke t ( s e r ve r S e t t i n g ) ;
i f ( ! my Ma i l . s e n d ( f ro m S e t t i n g , toS e t t i n g , " A E Ren d e r Com p l e te d " , myMe s s a g e ) ) {
aler t("Sending mail failed");
}
}
}
}
Email methods
This script creates an email object for use with the Render and Email script, described above. It uses code that
is specific to the socket object and therefore requires advanced understanding of networking to edit; the
comments below describe its operation.
/ / Cre a te a n e m a i l o b j e c t . T h e f u n c t i o n m ay b e c a l l e d b o t h
/ / a s a g l o b a l f u n c t i o n a n d a s a con s t r u c to r. It t a ke s t h e
// name of the email ser ver, and an optional Boolean that,
// if t r ue, pr ints debugg ing messages.
/ / T h i s o b j e c t i s n o t g u a r a n te e d to wor k f o r a l l S M T P s e r ve r s ,
// some of them may re quire a different set of commands.
// functions:
// send (fromAddress, to Address, subject, text) - send an email
// auth (name, pass) - do an author ization v ia POP3
// both functions re tur n false on er rors
// sa mp l e:
// e = new EmailSocke t ("mail.host.com");
// au tho r i ze v i a P OP 3 (n o t a l l ser vers re quire author ization)
// e.auth ("myname", "my pass");
// send the email
// e. sen d ("me@ my. com", "yo u @ yo u . com " , " My Su b je c t " , " Hi t h e re ! " )
//This is the const r u ctor for the email socket. It takes as arguments:
//ser ver - the address of the email ser ver (is not ch ecke d for validit y here)
//dbg - a boolean, if t r ue, pr ints additional er ror infor mation
E m a i l S o c ke t . p ro to t y p e . s e n d = f u n c t i o n ( f ro m , to, s u b j e c t , tex t ) {
// open the socket on por t 25 (SMTP)
if (!this.open (this._host + ":25"))
re tur n false;
try {
/ / d i s c a rd t h e g re e t i n g
v a r g re e t i n g = t h i s . re a d ( ) ;
if (this._debug)
w r i te ( " R E C V: " + g re e t i n g ) ;
// issue EHLO and other commands
this._SMTP ("EHLO " + from);
this._SMTP ("MAIL FROM: " + from);
this. _ S MTP ("RC P T TO: " + to );
this. _ S MTP ("DATA ");
// send subject and time stamp
this.w r ite ln ("From: " + from);
this. w r i te l n ("To : " + to );
this. w r i te l n ("D a te: " + n ew D a te( ) . toS t r i n g( ) ) ;
i f ( t y p e o f s u b j e c t ! = u n d e fi n e d )
t h i s . w r i te l n ( " Su b j e c t : " + s u b j e c t ) ;
this. w r i te l n ();
// send the text
if (t y p eof text != undefined)
this. w r i te l n (text);
// ter minate w ith a sing le dot and wait for response
this. _ S MTP (". ");
// ter minate the session
this._SMTP ("QUIT");
this.close();
re tur n t r ue;
}
catch (e) {
this.close();
re tur n false;
}
}
//
// Arguments:
// name - the userName of the account
// pass - the password
E m a i l S o c ke t . p ro to t y p e . a u t h = f u n c t i o n ( n a m e , p a s s ) {
// o p en the con n ectio n o n p o r t 110 ( P O P 3 )
if (!this.open (this._host + ":110"))
re tur n false;
try {
/ / d i s c a rd t h e g re e t i n g
v a r g re e t i n g = t h i s . re a d ( ) ;
if (this._debug)
w r i te ( " R E C V: " + g re e t i n g ) ;
// issue POP3 commands
this. _ P OP 3 ("U S E R " + n a me);
this. _ P OP 3 ("PA S S " + p a ss);
this._POP3 ("QUIT");
this.close();
re tur n t r ue;
}
catch (e) {
this.close();
re tur n false;
}
}
E m a i l S o c ke t . p ro to t y p e . _ S M T P = f u n c t i o n ( c m d ) {
if (this._debug)
w r i te l n ( " S E N D : " + c m d ) ;
if (! this. w r i te l n (cmd ))
throw "E r ror";
var rep l y = thi s. rea d ();
if (this._debug)
w r ite ("RECV: " + reply);
/ / t h e rep l y i s a t h re e - d i g i t co d e f o l l owe d by a s p a ce
var match = reply.match (/^(\d{3})\s/m);
if (match.length == 2) {
va r n = Nu mber (ma tch [1]);
if (n >= 200 && n <= 399)
re tu r n ;
}
t h row "E r ror";
}
// n i ce to have: a to S t r i n g ()
/ / T h i s f u n c t i o n a l l ow s t h e e m a i l o b j e c t to b e p r i n te d .
E m a i l S o c ke t . p ro to t y p e . to S t r i n g = f u n c t i o n ( ) {
re t u r n " [ o b j e c t E m a i l ] " ;
}
Email setup
A simple script that prompts the user for the server name, email sender, and email recipient that are saved as
Settings for the Render and Email script (above). You can run this script as standalone any time you want to
change the settings. The script will run email_setup.jsx whenever the settings don't exist; under normal
circumstances this would happen only the first time, or if the settings/preferences file is deleted.
This script is a good example of how a script can create settings that are saved in Preferences for the sole use
of scripting (as opposed to altering existing After Effects Preferences settings).
{
// This script sets up 3 email settings.
/ / It c a n b e r u n a l l by i t s e l f , b u t i t i s a l s o c a l l e d
// w i thin "3- Ren d er a n d Ma i l . j sx" i f t h e s e t t i n g s a re n ' t ye t s e t .
// w r ite and w r iteLn w ill w r ite to the info tab w ith or w ithout a
//'newline'
// at the end.
w r ite("Ro ses a re re d , ");
w r iteLn("v iolets are blue");
w r i te ( " Su g a r i s s we e t , " ) ;
w r iteL n ("a n d so i s E qu a l . ");
File fun
This script shows how to open files, open projects, collect names of the Comps in the scene, prompt a user for
where to write a file, write to a text file, and save the text file. It is useful only as an example of how the
individual methods and attributes operate; it doesn’t serve any useful production purpose.
// First, close any project that mig ht be open.
i f ( a p p. p ro j e c t ! = nu l l ) {
// 3 choices here, CloseOptions.D O_NOT_SAVE_CHANGES,
/ / C l o s e O p t i o n s . P RO M P T _ TO _ S AV E _ C H A N G E S , a n d C l o s e O p t i o n s . S AV E _ C H A N G E S
app. p ro j ect. cl o se(C l o seOp tio n s. D O _ N OT _ S AV E _ C HAN G E S ) ;
}
i f ( p fi l e = = nu l l ) {
a l e r t ( " No p ro j e c t fi l e s e l e c te d . Ab o r t i n g . " ) ;
} else {
/ / O p e n t h a t fi l e . It b e com e s t h e c u r ren t p ro j e c t .
var my_pro ject = app. open( pfile );
i f ( tex t _ fi l e = = nu l l ) {
a l e r t ( " No o u t p u t fi l e s e l e c te d . Ab o r t i n g . " ) ;
} else {
// opens file for w r iting . First argument is mode ("w" for w r iting),
// second argument is file t y pe (for mac only),
// third argument is creator (mac only, "????" is no specific app).
text_file.open("w","TEXT","????");
text_file.close();
JavaScript UI interface
This section provides a description of the scripting user interface programming model.
UI objects
The scripting user interface defines Window objects that wrap native windows and various control elements
(Buttons, StaticText, etc.), which wrap simple native controls. These objects share common methods such as
“query the element type”, “move the elements around”, and “set the title, caption or content”. For a complete
list of properties and methods, see “Reference” on page 21.
Creating a window
To create a new window, use the Window constructor function. The constructor takes the desired type of the
window (dialog) as a parameter. You can supply optional arguments to specify an initial window title and
bounds.
The code examples provided in the JavaScript Interface section consist of short segments from a complete
script that is included later in this document. The examples presented build upon each other.
The following example creates an empty dialog with the variable name dlg. This dialog is carried though to
subsequent examples:
// Create an empt y dialog w indow near upper left of the screen var
var dlg = new Window('dialog', 'Aler t Box Builder', [100,100,480,245]);
d l g . s h ow ( ) ;
.Newly created windows are initially invisible; the show() method makes them visible.
Roughly speaking, the numeric parameters to the constructor correspond to the top left and bottom right
coordinates of the window. The bounds supplied when creating the dialog specify the requested size of the
client area, which is the area of the dialog on which you can create controls. It does not include the title bar
and borders around the client area. The size and position of the dialog as a whole are automatically adjusted
to maintain the requested client area size.
For a more detailed description of window bounds, see “Element size and location” on page 198.
Container elements
All windows are containers, which is to say that they contain other elements such as panels, buttons, and check-
boxes within their boundaries.
Within a window, you can create other types of container elements and add interface components to them,
just as you add elements to a window. Elements added to a container are considered children of that container,
and certain operations performed on a container element also apply to its children. For instance, calling the
container’s hide() method makes the container invisible and makes all of its visible children invisible as well.
Along the same lines, calling the container’s show() method makes the container visible as well as any child
elements that were visible before the container was hidden. The following properties and methods of
containers also apply to all children of that container: visible, enabled, hide(), show().
The location of an element within a window or other container element is defined as the point where the top
left corner of an element is specified in the window coordinate system, relative to the container the element
lies within. Size is specified by width and height in pixels. A complete bounds specification therefore consists
of 4 integer values that define the position of the upper left corner of the object and its dimensions.
The value of the bounds property can take several forms: a string with special contents, an inline JavaScript
“Bounds” object, or a four-element array. The following examples show equivalent ways of placing a 380-by-
390 pixel window near the upper left corner of the screen:
var d l g = n ew Wi n d ow(‘d i a l o g’, ‘Al e r t B ox Bu i ld e r ’, [ 1 0 0 , 1 0 0 , 4 8 0 , 4 9 0 ] ) ;
dlg.bounds = [100,100,480,490];
d l g . b o u n d s = { l e f t : 1 0 0 , top : 1 0 0 , r ig h t : 4 8 0 , b o t to m : 4 9 0 } ;
d l g . b o u n d s = “ l e f t : 1 0 0 , top : 1 0 0 , r ig h t : 4 8 0 , b o t to m : 4 9 0 ” ;
Note that the window dimensions define the size of the “client area” of the window, which is the portion of
the window that an application can directly control. The actual window size will typically be larger, because
the host platform’s window system can add title bars and borders to windows.
When read, the bounds property returns a Bounds object--an array of four values representing the coordi-
nates of the upper left and lower right corners of the element: [left, top, right, bottom].
Adding elements
To add elements to a window or other container, use the container’s add() method. This method accepts the
type of the element to be created and some optional parameters, depending on the element type. The return
value is the UI object created or null on errors. The value of the element’s visible property defaults to “true”.
The element is initially visible, but it will remain invisible as long as its parent object is invisible.
A second (optional) parameter may be used to specify the initial bounds. The bounds is relative to the working
area of its parent container. For elements that display text, the text may be specified as the third (optional)
parameter--other types of elements have different semantics for a third argument.
For more information on the way in which each type of element interprets optional parameters, see “JavaS-
cript UI reference” on page 213. These optional parameters are positional, meaning that if you want to specify
some text for an element, but don’t care about its bounds, you must still provide an argument for the second
parameter in order to supply a value for the third (text) parameter. You can ‘skip over’ a positional parameter
by specifying the ‘undefined’ value as its argument value. In the example below, a Button element is created
with an initial text value, but no bounds value.
d l g . b t n Pn l = d l g . a d d ( ‘p a n e l ’, [ 1 5 , 3 3 0 , 3 6 5 , 3 7 5 ] , ‘ Bu i l d i t’ ) ;
d l g . b t n Pn l . te s t B t n = d l g . b t n Pn l . a d d ( ‘ b u t ton’, u n d e fi n e d , ‘ Te s t’ ) ;
Dynamically creating a property such as btnPnl to reference the control object returned by add() is not
required, but can make it easier to later refer to the control. See “Accessing child elements” on page 200 for
more information.
Creation properties
Some element types have attributes that may only--in fact, can only--be specified when the element is created.
These are not normal properties of the element, in that they cannot be changed during the element’s lifetime,
and they are needed only once. For these element types, an optional creation properties argument may be
supplied to the add() method--this argument is an object with one or more properties that control things like
the element’s appearance, or special functions like ‘read-only’ for an edit text element.
All UI elements have a creation property called name, which can be used to assign a name for identifying that
element. In the following example, the new Button element is assigned the name ‘ok’:
d l g . b t n Pn l . b u i l d B t n = d l g . b t n Pn l . a d d ( ‘ b u t ton’, [ 1 2 5 , 1 5 , 2 2 5 , 3 5 ] , ‘ Bu i l d ’,
{n a me: ’o k’});
Using creation properties, a name can be assigned to a newly created element. If this is done, a child can be
referred to by its name. For instance, the Button in the example in the previous section was named ‘ok’, so the
Button could now be referred to like this:
d l g . b t n Pn l . ch i l d re n [ ‘o k’ ] . tex t = “ Bu i l d ” ;
An even simpler way to refer to a named child element is to use its name as a property of its parent element.
We can also refer to the Button from the previous example like this:
d l g . b t n Pn l . o k . tex t = “ Bu i l d ” ;
The value of an element’s internal name property is used by the scripting user interface when a script accesses
a property of the element’s parent object that does not match any of the predefined properties.
In this case, the framework searches the names of the parent element’s children to see if a match exists, and if
so, returns a reference to the matching child object.
Types of UI elements
This section introduces the types of user interface elements you can create within a Window or other type of
container element.
The Panel element is the only type of non-window container that is currently defined. Panels are typically used
to visually organize related controls.
You can also use panels as separators: panels with width = 0 appear as vertical lines and panels with height =
0 appear as horizontal lines. When you create a Panel, you can specify an optional borderStyle property (used
only at creation time) to control the appearance of the border drawn around the panel.
var dlg = new Window('dialog', 'Aler t Box Builder',[100,100,480,245]);
d l g . m s g Pn l = d l g . a d d ( ' p a n e l ' , [ 2 5 , 1 5 , 3 5 5 , 1 3 0 ] , ' Me s s a g e s ' ) ;
d l g . s h ow ( ) ;
StaticText elements are typically used to display text strings that are not intended for direct manipulation by
a user, like informative messages or identifying information for other elements. In the following example, a
Panel is created, and several StaticText elements are added to it:
// sample co de for section 2.6.2
var dlg = new Window('dialog', 'Aler t Box Builder',[100,100,480,245]);
d l g . m s g Pn l = d l g . a d d ( ' p a n e l ' , [ 2 5 , 1 5 , 3 5 5 , 1 3 0 ] , ' Me s s a g e s ' ) ;
d l g . m s g Pn l . t i t l e S t = d l g . m s g Pn l . a d d ( ' s t a t i c tex t ' , [ 1 5 , 1 5 , 1 0 5 , 3 5 ] ,
' A l e r t b ox t i t l e : ' ) ;
d l g . m s g Pn l . m s g S t = d l g . m s g Pn l . a d d ( ' s t a t i c tex t ' , [ 1 5 , 6 5 , 1 0 5 , 8 5 ] ,
'Aler t message:');
d l g . s h ow ( ) ;
EditText elements are typically used to provide a means for users to enter text to be supplied to the script when
the dialog is dismissed. Text in EditText elements can be selected by a user and copied from or pasted into. The
text property can be assigned to in order to display text in the element, and it can be read from to obtain the
current text value.
The textselection property can be assigned to in order to replace the current selection with new text, or to insert
text at the cursor (insertion point). It can be read from to obtain the current selection, if any.
Using the same panel pictured above, the example now adds some EditText elements, with initial values that
a user can accept or replace:
var dlg = new Window('dialog', 'Aler t Box Builder',[100,100,480,245]);
d l g . m s g Pn l = d l g . a d d ( ' p a n e l ' , [ 2 5 , 1 5 , 3 5 5 , 1 3 0 ] , ' Me s s a g e s ' ) ;
d l g . m s g Pn l . t i t l e S t = d l g . m s g Pn l . a d d ( ' s t a t i c tex t ' , [ 1 5 , 1 5 , 1 0 5 , 3 5 ] ,
' A l e r t b ox t i t l e : ' ) ;
d l g . m s g Pn l . t i t l e Et = d l g . m s g Pn l . a d d ( ' e d i t tex t ' , [ 1 1 5 , 1 5 , 3 1 5 , 3 5 ] , ' S a m p l e A l e r t ' ) ;
d l g . m s g Pn l . m s g S t = d l g . m s g Pn l . a d d ( ' s t a t i c tex t ' , [ 1 5 , 6 5 , 1 0 5 , 8 5 ] , ' A l e r t m e s s a g e : ' ) ;
d l g . m s g Pn l . m s g Et = d l g . m s g Pn l . a d d ( ' e d i t tex t ' , [ 1 1 5 , 4 5 , 3 1 5 , 1 0 5 ] ,
'<your message here>', {multiline:t r ue});
d l g . s h ow ( ) ;
Note the creation property on the second EditText field, where multiline:true is specified. multiline:true
indicates that the text in the item should wrap to the next page. In other words, it specifies a field in which a
long text string may be entered, and the text will wrap to appear as multiple lines.
Button elements are typically used to initiate some action from a Window when a user clicks the mouse pointer
over the button; for example: accepting a dialog’s current settings, canceling a dialog, bringing up a new dialog
box, etc. The text property provides a label to identify a Button’s function:
var dlg = new Window('dialog', 'Aler t Box Builder',[100,100,480,245]);
d l g . b t n Pn l = d l g . a d d ( ' p a n e l ' , [ 1 5 , 5 0 , 3 6 5 , 9 5 ] , ' Bu i l d i t ' ) ;
d l g . b t n Pn l . te s t B t n = d l g . b t n Pn l . a d d ( ' b u t ton ' , [ 1 5 , 1 5 , 1 1 5 , 3 5 ] , ' Te s t ' ) ;
d l g . b t n Pn l . b u i l d B t n = d l g . b t n Pn l . a d d ( ' b u t ton ' , [ 1 2 5 , 1 5 , 2 2 5 , 3 5 ] ,
' Bu il d ' , {n a me: ' o k ' });
d l g . b t n Pn l . c a n ce l B t n = d l g . b t n Pn l . a d d ( ' b u t ton ' , [ 2 3 5 , 1 5 , 3 3 5 , 3 5 ] ,
' C a n cel ' , {n a me: ' ca n cel ' });
d l g . s h ow ( ) ;
Slider elements are typically used to select within a range of values, allowing the user to hold the mouse pointer
down over a moveable position indicator on the slider and drag this indicator within the range of the slider.
If you click the mouse pointer on a point on the slider bar, the position indicator will jump to that location.
A Slider has a value property that reflects the position of the moveable indicator, and minvalue and maxvalue
properties to define the endpoints of the slider’s range of values.
To make a slider control appear like those used in After Effects, adjust the height of the control until the slider
bar appears as a single line.
Scrollbar elements are similar to Slider elements, in that they are often used to select within a range of values,
and have a moveable position indicator. They have all the properties of sliders, and in addition, they have
‘stepper buttons’ at each end of the scrollbar for moving the position indicator in fixed-size steps.
You can control the size of each ‘step’ by setting the stepdelta property. Clicking ahead of or behind the position
indicator makes the position indicator jump a fixed number of values toward the point where you clicked. You
can control the size of this jump by setting the jumpdelta property.
You can create scrollbars with horizontal or vertical orientation; if width is greater than height, the orientation
is horizontal, otherwise it is vertical. The following example creates a Scrollbar element with associated
StaticText and EditText elements within a panel:
d l g . s i ze Pn l = d l g . a d d ( ‘p a n e l ’, [ 6 0 , 2 4 0 , 3 2 0 , 3 1 5 ] , ‘ D i m e n s i o n s’ ) ;
d l g . s i ze Pn l . w i d t h S t = d l g . s i ze Pn l . a d d ( ‘s t a t i c tex t’, [ 1 5 , 1 5 , 6 5 , 3 5 ] ,
‘Wid th: ’;
d l g . s i ze Pn l . w i d t h S c r l = d l g . s i ze Pn l . a d d ( ‘s c ro l l b a r ’,
[75, 15, 195, 35], 300, 300, 800) ;
d l g . s i ze Pn l . w i d t h Et = d l g . s i ze Pn l . a d d ( ‘e d i t tex t’, [ 2 0 5 , 1 5 , 2 4 5 , 3 5 ] ) ;
Note that the last 3 arguments to the add() method that creates the scrollbar define the values for the value,
minvalue and maxvalue properties. Scrollbars are often created with an associated EditText field to display the
current value of the scrollbar, and to allow setting the scrollbar’s position to a specific value.
The general structure of a window resource specification is a Window type specification (i.e., “dialog”),
followed by a set of braces enclosing one or more property definitions. Controls are defined as properties
within windows and other containers by specifying the classname of the control in a property definition, with
properties of the control enclosed in braces {}, for example: testBtn: Button { text: ‘Test’ }.
Creation properties are specified in a properties property as named properties of an inline object (see example
above). The syntax of window resource specification strings is completely described below.
The window resource specification syntax is given in BNF (Backus-Naur Form) below:
re s o u rce S p e c = ‘ ” ’ w i n d ow Ty p e Na m e i n l i n e O b j e c t ‘ ” ’
w i n d owTy p e Na m e = [a modal dialog]
in lin eO bj ect = “ {“ p ro p er ti e s L i s t “ } ”
proper tiesList = proper t y De fn { “,” proper t yDefn }
proper t y Defn = proper t y Name “:” proper t yValue
proper t yName = [a JavaScr ipt proper t y name]
proper t y Value = “null” | “t r u e” | “false” | st r ing | number
| i n l i n e Ar r ay | o b j e c t D e f n
st r ing = [a JavaScr ipt st r ing liter al]
number = [any JavaScr ipt integer or real number liter al]
inlineAr r ay = “[“ proper t y Va lue { “,” proper t yVa lue } “]”
objectDefn = ( namedObject | inlineObject )
namedObject = [ a ny o b j e c t c l a s s n a m e ] i n l i n e O b j e c t
Note: To create a UI element, the classname in the namedObject definition above can be any element classname
referred to in “Types of interface elements” on page 197. For example:
“d i a l o g { \
tex t : ‘ From Re s o u rce’, b o u n d s : [ 1 0 , 1 0 , 2 1 0 , 1 1 0 ] , \
b ox : Pa n e l { \
bounds: [10, 10, 190, 90], \
o k : But to n { \
tex t : ‘O K ’, b o u n d s : [ 4 0 , 3 0 , 1 4 0 , 5 0 ] , \
} \
} \
}” ;
Each class of UI element has a set of callback methods defined for it. For windows, there are callbacks like
onClose(), onMove(), and onResize(). For controls, callbacks vary from type to type. A typical callback is
onClick() for button, radiobutton, and checkbox elements, and onChange() for edittext fields, scrollbars, and
sliders.
To handle a given event for some UI element, simply define a property of the same name as the event callback
in the element and assign a JavaScript function you have defined to it. The example below uses "in line"
functions, which employ a unique syntax and do not require a name. However, you can also define the
function elsewhere in the script. In that case, simply assign the name of the function to the event handler
property. The scripting user interface calls these functions on event notifications if defined.
Examples:
/*‘ has buttons’ checkbox enables or disables the panel that
deter mines the justification of the ‘aler t’ button g roup */
dlg .hasBt nsCb.onClick =
function () { this.parent.aler tBt nsPnl.enabled = this.value; };
button
panel
dialog
Also be aware that you can simulate user actions by sending an event notification directly to a UI element, via
the element’s notify() method. In this manner, a script can generate events in the controls of a window, as if a
user was clicking buttons, entering text, moving a window, etc.
radiobutton and checkbox elements have a boolean value property; using notify() to simulate a click on these
elements also changes the value of this property, just like clicking the element would do. For instance, if the
value of a checkbox ‘hasBtnsCb’ in our example above is true, the following example changes the value to false:
if (d l g . ha sB t n sC b. va l u e == t r u e)
d l g . h a s B t n s C b. n o t i f y ( ) ;
// d l g . ha sB t n sC b. va l u e i s n ow fa l se
For a complete description of the different event callback methods and notify(), see “Common methods and
event handlers” on page 217.
Modal dialogs
A modal dialog is initially invisible. When calling its show() method, the dialog is displayed and starts
executing. The call to show() does not return until the dialog has been dismissed, typically by the user clicking
an OK or Cancel button.
When calling the hide() or close() methods during the execution of a modal dialog, the dialog is dismissed.
The close() method accepts an optional argument that the call to show() returns.
Warning: You cannot use the JavaScript Debugger to debug event callback functions for modal dialogs, because
once the dialog starts executing, it captures all mouse events. Setting a breakpoint in an event callback function for
a modal dialog will result in an apparent application hang if the breakpoint is ever reached.
To work around this restriction, an effective debugging technique is to create your dialog, but not call its show()
method to make it visible. Then use the debugger to call the notify() method on controls whose event callback
functions you wish to debug. It’s considered good design practice to keep the code in the event callback functions
simple, while deferring the primary script logic execution until after the dialog has been dismissed.
Modal dialogs can usually be dismissed by typing certain keyboard shortcuts. In addition to clicking the ‘OK’
or ‘Cancel’ buttons, typing the ‘Enter’ key normally produces the same results as clicking the ‘OK’ (or default)
button, and typing the ‘Esc’ key is equivalent to clicking the ‘Cancel’ button. In each case, the keyboard
shortcut is the same as if your script had called the notify() method for the associated Button. The dialog
designer has explicit control over which Button elements are notified by these keyboard shortcuts: a newly-
created dialog has defaultElement and cancelElement properties that are initially undefined. The dialog
designer can set these properties to the objects representing the buttons that should be notified when the
respective keyboard shortcut is typed.
The scripting user interface provides reasonable defaults if the defaultElement and cancelElement properties
are still undefined when the dialog is about to be shown for the first time.
Default values for the defaultElement property are determined by the following algorithm:
• The scripting user interface searches the dialog’s buttons for a button whose name property has the string
value “ok” (case is not important). If one is found, defaultElement is set to that object.
• If no matching named object is found, the scripting user interface searches the dialog’s buttons for a button
whose text property has the string value “ok” (case is not important). If one is found, defaultElement is set
to that object.
Default value for the cancelElement property are determined by the following algorithm:
• The scripting user interface searches the dialog’s buttons for a button whose name property has the string
value “cancel” (case is not important). If one is found, cancelElement is set to that object.
• If no matching named object is found, the scripting user interface searches the dialog’s buttons for a button
whose text property has the string value “cancel” (case is not important). If one is found, cancelElement is
set to that object.
These algorithms handle most dialog boxes without the designer having to explicitly set these properties.
When you add buttons to a dialog that will be used to dismiss the dialog, use creation properties to set the name
property of such buttons to ‘ok’ or ‘cancel’, depending on the desired semantics; this precaution makes the
above algorithm work properly even when the text of such buttons is localized. If the scripting user interface
cannot find a matching button for either case, the respective property is set to null, which means that keyboard
shortcuts for default or cancel will not notify any elements.
When your script creates a dialog, you typically create controls that the user must interact with in order to
enter values that your script will use. In general, you can minimize the number of event callback functions you
attach to various controls in your dialogs, unless interaction with those controls changes the operation of the
dialog itself. In most cases where you simply want to read the states of various controls when the dialog is
dismissed, you do not need to handle events for them. For instance, you often don’t need onClick() functions
for every checkbox and radiobutton in your dialog: when the dialog is dismissed, read their states using their
value properties.
Some exceptions to this guideline:
• onChange() functions are needed for edittext elements, if users enter values which must be validated (like a
number within a range). The event callback must perform any necessary validation, and interact with the
user on errors.
• Define onClick() for OK and Cancel buttons which close the dialog with a given value.
Note: Perform this function only if you have not defined the defaultElement and/or cancelElement properties or
named these buttons in such a way that they will automatically be identified as the OK and Cancel buttons.
Some JavaScript environments provide functions on the global window object to display message boxes or
alert boxes and a prompt box that displays one or two lines of text and then allows the user to enter one line
of text.
The scripting user interface defines functions alert(), confirm() and prompt() on the Window class that
provides this standard functionality. The host application controls the appearance of these simple dialog
boxes, so they are consistent with other alert and message boxes displayed by the application. See the “JavaS-
cript UI reference” on page 213 for details.
JavaScript UI example
Having explored the individual scripting components that make up the user interface, you are now ready to
see the parts assembled into real-world JavaScript code that produces a fully functional user interface.
The JavaScript UI code sample described below includes the following functions, which creates a simple user
interface builder window populated with various panels, checkboxes, buttons and controls. When you run the
builder, you can then cause it to create an Alert Box.
• createBuilderDialog() -- Creates an empty dialog window near the upper left of the screen and adds a title
panel, a checkbox, a control panel and a panel with buttons to test parameters and create the Alert Box
specification.
• initializeBuilder() --Sets up initial control states and attaches event callback functions to controls.
• runBuilder() -- Runs the builder dialog and returns the resulting Alert Box UI
• createResource() -- Creates and returns a string containing a dialog resource specification that creates the
Alert Box UI using the parameters entered
• stringProperty() -- Returns a formatted string
• arrayProperty() -- Returns a formatted array
• createTestDialog() -- Creates a new Test dialog
These functions are bundled together into a Main script, which assembles the final Alert Box dialog.
createBuilderDialog
Most of the heavy-lifting for visual components of the JavaScript UI code sample occurs in the createBuilder-
Dialog() function, where the main components of the dialog are configured, as displayed below.
f u n c t i o n c re a te Bu i l d e r D i a l o g ( )
{
//Create an empt y dialog w indow near the upper left of the screen
var dlg = new Window('dialog', 'Aler t Box Builder', [100,100,480,490]);
1
/ / Ad d a p a n e l to h o l d t i t l e a n d ' m e s s a g e tex t ' s t r i n g s
d l g . m s g Pn l = d l g .a d d ( ' p a n e l ' , [ 2 5 , 1 5 , 3 5 5 , 1 3 0 ] , ' Me s s a g e s ' ) ;
d l g . m s g Pn l . t i t l e S t = d l g . m s g Pn l . a d d ( ' s t a t i c tex t ' , [ 1 5 , 1 5 , 1 0 5 , 3 5 ] , ' A l e r t b ox t i t l e : ' ) ;
d l g . m s g Pn l . t i t l e Et = d l g . m s g Pn l . a d d ( ' e d i t tex t ' , [ 1 1 5 , 1 5 , 3 1 5 , 3 5 ] , ' S a m p l e A l e r t ' ) ;
d l g . m s g Pn l . m s g S t = d l g . m s g Pn l . a d d ( ' s t a t i c tex t ' , [ 1 5 , 6 5 , 1 0 5 , 8 5 ] , ' A l e r t m e s s a g e : ' ) ;
d l g . m s g Pn l . m s g Et = d l g . m s g Pn l . a d d ( ' e d i t tex t ' , [ 1 1 5 , 4 5 , 3 1 5 , 1 0 5 ] , ' < yo u r m e s s a g e h e re > ' ,
{ mu l t i l i n e : t r u e } ) ;
//Add a ch eckbox to cont rol the presence of buttons to dismiss the aler t box
d l g . h a s B t n s C b = d l g .a d d ( ' ch e c k b ox ' , [ 1 2 5 , 1 4 5 , 2 5 5 , 1 6 5 ] , ' Ha s a l e r t b u t ton s ? ' ) ; 2
//Add panel to deter mine alig nment of buttons on the aler t box
d l g . a l e r t B t n s Pn l = d l g .a d d ( ' p a n e l ' , [ 4 5 , 1 8 0 , 3 3 5 , 2 2 5 ] , ' Bu t ton a l i g n m e n t ' ) ;
d l g .a ler tBt nsPnl.a li g nLeftRb = dlg .a ler tB t nsPnl.add( 'r adio bu tton', [ 15,15,95,35] , 'Left') ;
dlg .aler tBt nsPnl.alig nCenterRb = dlg .aler tBt nsPnl.add('r adiobutton', [105,15,185,35], 'Center');
d l g .a ler tBt nsPnl.a li g nRi g h tRb = dlg .a ler tB t nsPnl.add( 'r adio bu tton', [ 195,15,275,35] , 'Rig ht') ;
//Add a panel w ith cont rols for the dimensions of the aler t box
d l g . s i ze Pn l = d l g . a d d ( ' p a n e l ' , [ 6 0 , 2 4 0 , 3 2 0 , 3 1 5 ] , ' D i m e n s i o n s ' ) ;
d l g . s i ze Pn l . w i d t h S t = d l g . s i ze Pn l . a d d ( ' s t a t i c tex t ' , [ 1 5 , 1 5 , 6 5 , 3 5 ] , ' Wi d t h : ' ) ;
d l g . s i ze Pn l . w i d t h S c r l = d l g . s i ze Pn l . a d d ( ' s c ro l l b a r ' , [ 7 5 , 1 5 , 1 9 5 , 3 5 ] , 3 0 0 , 3 0 0 , 8 0 0 ) ;
d l g . s i ze Pn l . w i d t h Et = d l g . s i ze Pn l . a d d ( ' e d i t tex t ' , [ 2 0 5 , 1 5 , 2 4 5 , 3 5 ] ) ;
d l g . s i ze Pn l . h e i g h t S t = d l g . s i ze Pn l . a d d ( ' s t a t i c tex t ' , [ 1 5 , 4 5 , 6 5 , 6 5 ] , ' He i g h t : ' ) ;
3
d l g . s i ze Pn l . h e i g h t S c r l = d l g . s i ze Pn l . a d d ( ' s c ro l l b a r ' , [ 7 5 , 4 5 , 1 9 5 , 6 5 ] , 2 0 0 , 2 0 0 , 6 0 0 ) ;
d l g . s i ze Pn l . h e i g h t Et = d l g . s i ze Pn l . a d d ( ' e d i t tex t ' , [ 2 0 5 , 4 5 , 2 4 5 , 6 5 ] ) ;
/ / Ad d a p a n e l w i t h b u t ton s to te s t p a r a m e ter s a n d c re a te t h e a l e r t b ox s p e c i fi c a t i o n
d l g .b t n Pn l = d l g .a d d ( ' p a n e l ' , [ 1 5 , 3 3 0 , 3 6 5 , 3 7 5 ] , ' Bu i l d i t ' ) ;
d l g . b t n Pn l . te s t B t n = d l g . b t n Pn l . a d d ( ' b u t ton ' , [ 1 5 , 1 5 , 1 1 5 , 3 5 ] , ' Te s t ' ) ;
d l g . b t n Pn l . b u i l d B t n = d l g . b t n Pn l . a d d ( ' b u t ton ' , [ 1 2 5 , 1 5 , 2 2 5 , 3 5 ] , ' Bu i l d ' , { n a m e : ' o k ' } ) ;
4
d l g . b t n Pn l . c a n ce l B t n = d l g . b t n Pn l . a d d ( ' b u t ton ' , [ 2 3 5 , 1 5 , 3 3 5 , 3 5 ] , ' C a n ce l ' , { n a m e : ' c a n ce l ' } ) ;
re t u r n d l g ;
This code snippet, when broken down into smaller segments--and run in the context of the entire UI sample
code that follows--produces the following succession of dialogs, which coalesce into one final Alert Box
window.
Final Dialog
Created
For the final dialog to actually display, supporting code to initialize and run the Alert Box Builder must be
included, as illustrated below.
function initializeBuilder(builder)
{
/ / S e t u p i n i t i a l con t ro l s t a te s
w ith (builder) {
hasBt nsCb.value = t r ue;
aler tBt nsPnl.alig nCenterRb.value = t r ue;
w i th (si zePnl) {
w i dth Et.tex t = w i dth S crl.valu e;
heig htEt.text = heig htScrl.value;
}
/ / At t a ch e ve n t c a l l b a c k f u n c t i o n s to con t ro l s
builder.hasBt nsCb.onClick =
function () { this.parent.aler tBt nsPnl.enabled = this.value; };
/ * T h e e d i t tex t fi e l d s a n d s c ro l l b a r s i n s i ze Pn l a re con n e c te d * /
w ith (builder.sizePnl) {
w idthEt.onChange =
f u n c t i o n ( ) { t h i s . p a re n t . w i d t h S c r l . v a l u e = t h i s . tex t ; } ;
w idthScrl.onChange =
functi on () { th i s.pa ren t.w idthEt.text = this.valu e; } ;
heig htEt.onChange =
f u n c t i o n ( ) { t h i s . p a re n t . h e i g h t S c r l . v a l u e = t h i s . tex t ; } ;
heig htScrl.onChange =
functi on () { th i s.pa ren t.heig htEt.text = this.valu e; } ;
}
function r unBuilder(builder)
{
/ / Ru n t h e b u i l d e r d i a l o g , re t u r n i t s res u l t
re tur n builder.show();
}
/ * T h i s f u n c t i o n c re a te s a n d re t u r n s a s t r i n g con t a i n i n g a d i a l o g
re s o u rce s p e c i fi c a t i o n t h a t w i l l c re a te a n A l e r t d i a l o g u s i n g
the par ameters the user entere d. */
function createResource(builder)
{
//Define the initial par t of the resource spec w ith dialog par ameters
var dlgWidth = Number(builder.sizePnl.w idthEt.text);
var dlgHeig ht = Number(builder.sizePnl.heig htEt.text);
v a r re s = " d i a l o g { " +
st r ingProper t y("text", builder.msgPnl.titleEt.text) +
a r r ay Prop e r t y ( " b o u n d s " , 0 , 0 , d l g Wi d t h , d l g He i g h t ) +
" \n" ;
/ / D e fi n e t h e a l e r t m e s s a g e s t a t i c tex t e l e m e n t , s i z i n g i t to t h e a l e r t b ox
var margin = 15; var l, t;
v a r m s g Wi d t h , m s g He i g h t ;
var hasButtons = builder.hasBt nsCb.value;
v a r b t n s He i g h t Us e d = h a s Bu t ton s ? 2 0 + m a r g i n : 0 ;
m s g He i g h t = 6 0 ;
m s g Wi d t h = d l g Wi d t h - ( m a r g i n * 2 ) ;
l = ma r g i n;
t = ( d l g He i g h t - m s g He i g h t - b t n s He i g h t Us e d ) / 2 ;
re s + = " m s g : S t a t i c Tex t { " +
st r ingProper t y("text", builder.msgPnl.msgEt.text) +
a r r ay Prop e r t y ( " b o u n d s " , l , t , l + m s g Wi d t h , t + m s g He i g h t ) +
"justify :'center', proper ties:{multiline:t r ue} }";
l = ma r g i n;
else if (alig nCenterRb.value)
l = ( d l g Wi d t h - ( b t nWi d t h * 2 + 1 0 ) ) / 2 ;
else
l = d l g Wi d t h - ( ( b t nWi d t h * 2 + 1 0 ) + m a r g i n ) ;
}
t = d l g He i g h t - b t n s He i g h t Us e d ;
res + = " ,\n" +
" o k B t n : But to n { " +
s t r i n g Prop e r t y ( " tex t " , " O K " ) +
a r r ay Prop e r t y ( " b o u n d s " , l , t , l + b t n Wi d t h , t + 2 0 ) +
" },\n" ;
l + = b t n Wi d t h + 1 0 ;
re s + = " c a n ce l B t n : But to n { " +
s t r i ngProper t y (" tex t" , "Cancel") +
a r r ay Prop e r t y ( " b o u n d s " , l , t , l + b t n Wi d t h , t + 2 0 ) +
" }" ;
}
//All done!
res + = " \n}" ;
re tur n res;
}
f u n c t i o n s t r i n g Prop e r t y ( p n a m e , p v a l )
{
re t u r n p n a m e + " : ' " + p v a l + " ' , " ;
}
f u n c t i o n a r r ay Prop e r t y ( p n a m e , l , t , r, b )
{
re tur n pna me + " :[" + l + " ," + t + "," + r + "," + b + "] , ";
}
f u n c t i o n c re a te Te s t D i a l o g ( re s o u rce)
{
var target = new Window (resource);
re tur n ta r get.s h ow();
}
/ / ------------- Ma i n s cr i pt ------------- //
var builder = createBuilderDialog();
initializeBuilder(builder);
if (r unBuilder(builder) == 1) {
//Crea te th e A ler t di a log res ource spec ifi c atio n st r ing
va r res S pec = crea teResource(b ui l der) ;
/ / Wr i te t h e re s o u rce s p e c i fi c a t i o n s t r i n g to a fi l e , u s i n g t h e s t a n d a rd fi l e o p e n d i a l o g
v a r f n a m e = F i l e . o p e n D i a l o g ( ' S ave re s o u rce s p e c i fi c a t i o n ' ) ;
var f = File(fname);
if (f.open('w')) {
v a r o k = f . w r ite ( re s S p e c ) ;
i f (ok)
ok = f.close();
i f (! ok)
Window.aler t("Er ror creating " + fname + ": " + f.er ror);
}
}
• To show how simple event callback functions work and how you can attach event handler functions to any
controls that can generate events.
• To show how to enable and disable sets of controls. For example, in the alert checkbox,
if you unclick the checkbox then everything in the button alignment field suddenly gets greyed out.
• To demonstrate how you typically dismiss a modal dialog by providing an OK and Cancel button.
• To show you can still read property values out of the dialog and its controls after the dialog has been
dismissed.
To run this JavaScript UI code using a resource specification, change the lines indicated below and include the
resource specification sample code. For more information on resource specifications, refer to “Creating a
window using window resource specifications” on page 203.
Note: This is a complete example of a resource specification string. The alertBuilderResource() code displayed
below is a way to create the same main dialog box created by the createBuilderDialog() function.
/ / - - - - - - - - - - - - - A l ter n a te d i a l o g c re a t i o n u s i n g re s o u rce s p e c i fi c a t i o n - - - - - - - - - - - - - / /
/*
To u s e t h i s co d e , rep l a ce t h e l i n e a b ove t h a t s ay s
var builder = createBuilderDialog();
w i th
var builder = createBuilderDialogFromResource();
*/
f u n c t i o n c re a te Bu i l d e r D i a l o g From Re s o u rce ( )
{
//Create from resource
re tur n new Window(aler tBuilderResource);
} / / crea teBui lder Di a logFromRes ource
JavaScript UI reference
The JavaScript user interface defines the global elements of the Window object and properties and methods
of all the UI classes.
aler t (text)
Displays the specified string in a user alert box that provides an OK button. The alert dialog is not intended
for lengthy messages. When the string argument to the alert method is too long, the alert dialog truncates it.
con fi r m (text)
Displays the specified string in a self-sizing modal dialog box that provides Yes (default) and No buttons.
When this user clicks one of these buttons, this method hides the dialog and returns a value indicating the
button the user clicked to dismiss the dialog. A return value of true indicates that the user clicked the Yes
button to dismiss the confirm box. The confirmation dialog displays lengthier messages than the alert and
prompt dialogs do, but if this string is too long, the dialog truncates it.
fi n d ( t y p e , t i t l e )
return value: Object
Finds an existing window already created by a script. title is the title of the window and type is modal dialog.
This value is a hint in case more than one window has the same title; if the type is unimportant, null or an
empty string can be passed. If the window was found, the corresponding JavaScript Window object is
generated and returned; if the window cannot be determined, the return value is null.
prompt (prompt [, default])
Displays a modal dialog that returns the user’s text input. When the dialog opens, it displays the given prompt
text and its text edit field is initialized with any specified default text. When the user clicks OK to dismiss the
dialog, it returns the text the user entered. If the user clicks the Cancel button in this dialog, this method’s
result is the value null.
RadioButton
StaticText
Checkbox
Scrollbar
Window
EditText
Button
Slider
Panel
active x x x x x x x
bounds x x x x x x x x x
children x x x x x x x x x
enabled x x x x x x x x x
jumpdelta x
justify x x x x x x x
maxvalue x x
minvalue x x
parent x x x x x x x x x
stepdelta x
text x x x x x x x
textselection x
type x x x x x x x x x
value x x x x
visible x x x x x x x x x
Properties
Following are the properties defined for each element types listed above.
Property Type Description
active Boolean Contains true if the object is active, false otherwise. An active floating dialog
is the front-most dialog. A modal dialog that is visible is by definition the
active dialog. An active control is the one which will accept keystrokes, or in
the case of a Button, be activated (clicked) when the user types a return. Set
this true to make a given control or dialog active.
bounds Bounds Contains a Bounds object describing the location and size of the element as
array values representing the coordinates of the upper left and lower right
corners of the element: [left, top, right, bottom]. These are screen coordinates
for window elements, and window-relative coordinates for other elements.
See “Element Size and Location “
Window elements contain the following properties, in addition to those described in the previous section.
defaultElement -- Object
The element to notify when a user types the Enter key, with the intent to dismiss the dialog as if the “OK”
button had been clicked.
cancelElement -- Object
The element to notify when a user types the Esc key (or the <Cmd .> combination on a Mac), with the intent
to dismiss the dialog as if the “Cancel” button had been clicked.
A Bounds object is used to define the boundaries of a Window or UI element within its
coordinate space. You cannot directly create a Bounds object; one is created when you set an
element’s bounds property. Reading the bounds property always yields a Bounds object. Bounds
contains an array describing the position and size of a UI element. The array values represent
the coordinates of the upper left and lower right corners of the element: [left, top, right,
bottom]. These are screen coordinates for window elements, and are relative to the coordinate
space of the parent (container) element for other element types.
You can set an element’s bounds property and indirectly create a Bounds object in any of
these ways:
e . b o u n d s = O b j ec t
The object must contain properties named left, top, right, bottom, or x, y, width, height, where each property
has an integer coordinate value.
e . b o u n d s = Ar ray
The array must have integer coordinate values in the order [left, top, right, bottom].
e . b o u n d s = St r i n g
The string must be an executable JavaScript inline object declaration, containing the same property names as
in the object case just described.
A Bounds object may be accessed as an array. In addition, it supports the following properties
Property Type Description
left Number The ‘x’ coordinate value of the left edge of the element.
top Number The ‘y’ coordinate value of the top edge of the element.
RadioButton
StaticText
Checkbox
Scrollbar
Window
EditText
Button
Slider
Panel
add() x x
center() x
close() x
hide() x x x x x x x x x
notify() x x x x x x
show() x x x x x x x x x
onChange() x x x
onClick() x x x
onClose() x
onMove() x
onResize() x
Methods
Descriptions of the common methods and event handlers listed above follow:
Method Returns Description
add (type [, bounds, text, { Object Creates a new UI element and add it to the children
<creation array of its parent Window or Panel element. The
optional parameter bounds is a Bounds object
properties> } ]); describing its position and size. This may also be a
four-element array. The optional parameter text is
assigned to the UI element as the initial text or title.
The UI element itself decides how to use this string; it
may be ignored.
hide() no return value Hides the element. If hide() is called on a modal dia-
log, dismiss the dialog and set the dialog result to 0.
The application may choose to ignore this call for cer-
tain UI object types.
onClick() no return value This method is called when a control has been acti-
vated by clicking it. Not all types of controls imple-
ment this callback. If you are interested in processing
this event, define a function of this name in the con-
trol element.
onChange() no return value This method is called when the content of a control
has been changed. Not all types of controls imple-
ment this callback. If you are interested in processing
this event, define a function of this name in the con-
trol element.
onClose() no return value This method is called when a Window is closed. If you
are interested in processing this event, define a func-
tion of this name in the Window object.
UI object descriptions
This section describes UI objects such as windows, panels, buttons, checkboxes and so on.
Window object
If you specify a Panel whose width is 0, it will appear as a vertical line; a panel whose height is 0 will appear as
a horizontal line. Making a panel invisible will also hide all its children; making it visible again will also make
visible those children that were visible when the panel was made invisible.
The EditText control calls the onChange() event method if the editable text is changed or if its notify() method
is called. It also has a textselection property to access any text selection within the edit field.
The Button control calls the onClick() event method if the control is clicked or if its notify() method is called.
The Checkbox control calls the onClick() event method if the control is clicked or if its notify() method is called.
It also has a value property which indicates whether the control is set or not.
All RadioButtons in a group must be created sequentially, with no intervening creation of other element types.
Only one RadioButton in a group can be set at a time; setting a different RadioButton unsets the original one.
The RadioButton control calls the onClick() event method if the control is clicked or if its notify() method is
called. It also has a value property which indicates whether the control is set or not.
The Scrollbar control will have a horizontal orientation if the specified width is greater than its height at
creation time; its orientation will be vertical if its height is greater than its width. It calls the onChange() event
method if the position of the moveable element is changed by the user, or if its notify() method is called. The
value property contains the current position of the scrollbar’s moveable position indicator within the scrolling
area, within the range of minvalue and maxvalue.
All Slider controls have a horizontal orientation. The Slider control calls the onChange() event method if the
position of the slider is changed by the user, or if its notify() method is called. The value property contains the
current position of the slider’s moveable position indicator, within the range of minvalue and maxvalue.
After executing above code, the variable homepage contains the contents of the Adobe home page together
with a HTTP response header.
Establishing an Internet server is a bit more complicated. A typical server program sits and waits for incoming
connections, which it then processes. Usually, you would not want your application to run in an endless loop,
waiting for any incoming connection request. Therefore, you can ask a Socket object for an incoming
connection by calling the poll() method of a Socket object. This call would just check the incoming connec-
tions and then return immediately. If there is a connection request, the call to poll() would return another
Socket object containing the brand new connection. Use this connection object to talk to the calling client;
when finished, close the connection and discard the connection object.
Before a Socket object is able to check for an incoming connection, it must be told to listen on a specific port,
like port 80 for HTTP requests. Do this by calling the listen() method instead of the open() method.
The following example is a very simple Web server. It listens on port 80, waiting until it detects an incoming
request. The HTTP header is discarded, and a dummy HTML page is transmitted to the caller.
conn = new Socket;
// listen on por t 80
if conn.listen (80)) {
// wait fore ver for a connection
var incoming;
do in co mi n g = con n . p o l l ();
w h i l e ( i n co m i n g = = nu l l ) ;
// discard the re quest
rea d ( ) ;
// Reply w ith a HT TP header
incoming .w r ite ln ("HT TP/1.0 200 OK");
incoming .w r ite ln ("Content-Ty p e: text/ht ml");
incoming .w r ite ln();
// Tr ansmit a dummy homepage
i n co m i n g . w r i te l n ( " < h t m l > < b o dy > < h 1 > Ho m e p a g e < / h 1 > < / b o dy > < / h t m l > " ) ;
// done!
incoming .close();
delete incoming;
}
Often, the remote endpoint terminates the connection after transmitting data. Therefore, there is a connected
property that contains true as long as the connection still exists. If the connected property returns false, the
connection is closed automatically.
On errors, the error property of the Socket object contains a short message describing the type of the error.
The Socket object lets you easily implement software that talks to each other via the Internet. You could, for
example, let two Adobe applications exchange documents and data simply by writing and executing JavaScript
programs.
JavaScript Reference
Properties
con n e c te d Boolean Contains true if the connection is still active. Read only.
eof Boolean This property has the value true if the receive buffer is empty. Read only.
er ror String Contains a message describing the last error. Setting this value clears any error mes-
sage.
ho st String Contains the name of the remote computer when a connection is established. If the
connection is shut down or does not exist, the property contains the empty string.
Read only.
timeout Number The timeout in seconds to be applied to read or write operations. Defaults to 10 (ten
seconds).
Methods
[new] Socket ();
Returns
Object.
close();
Terminates the open connection. The return value is true if the connection was closed, false on I/O errors.
Deleting the connection has the same effect. Remember, however, that JavaScript garbage collects the object
at some null time, so the connection may stay open longer than you want to if you do not close it explicitly.
Returns
Boolean
listen (Number por t [, St r ing enco ding]);
Instructs the object to start listening for an incoming connection. The port argument is the TCP/IP port
number where the object should listen on; typical values are 80 for a Web server, 23 for a Telnet server and so
on. The encoding parameter is optional. The call to listen() is mutually exclusive to a call to open(). The result
is true if the connection object successfully started listening, false otherwise.
Parameters
p or t Number The port number to listen on. Valid port numbers are 1 to 65535.
enco ding String The encoding to be used for the connection. Typical values are "ASCII", "binary", or
"UTF-8". This parameter defaults to ASCII.
Returns
Boolean
open (St r ing computer [, St r ing enco ding]);
Open the connection for subsequent read/write operations. The computer name is the name or IP address,
followed by a colon and the port number to connect to. The port number is mandatory. Valid computer names
are, for example, "www.adobe.com:80" or "192.150.14.12:80". The encoding parameter is optional; currently,
it can be one of "ASCII", "binary" or "UTF-8". The call to open() is mutually exclusive to a call to listen().
Parameters
ho st String The name or IP address of the remote computer, followed by a colon and the port
number to connect to. The port number is mandatory. Valid computer names are e.g.
"www.adobe.com:80" or "192.150.14.12:80".
enco ding String The encoding to be used for the connection. Typical values are "ASCII", "binary", or
"UTF-8". This parameter defaults to ASCII.
Returns
Boolean
poll();
Check a listening object for a new incoming connection. If a connection request was detected, the method
returns a new Socket object that wraps the new connection. Use this connection object to communicate with
the remote computer. After use, close the connection and delete the JavaScript object. If no new connection
request was detected, the method returns null.
Returns
Read up to the given number of characters from the connection. Returns a string that contains up to the
number of characters that were supposed to be read. If no count is supplied, the connection attempts to read
as many characters it can get until the remote server closes the connection or a timeout occurs.
Parameters
cou n t Number The number of characters to read. If no count is supplied, the connection attempts to
read as many characters it can get until the remote server closes the connection or a
timeout occurs.
Returns
String
re a d l n ( ) ;
Read one line of text up to the next line feed. Line feeds are recognized as CR, LF, CRLF or LFCR pairs.
Returns
String
w r ite (S t r in g text, … );
Write the given string to the connection. The parameters of this function are concatenated to a single string.
Returns true on success.
Parameters
text String All arguments are concatenated to form the string to be written.
Returns
Boolean
w r i te l n ( S t r i n g tex t , … ) ;
Write the given string to the connection and append a Line Feed character. The parameters of this function
are concatenated to a single string. Returns true on success.
Parameters
text String All arguments are concatenated to form the string to be written.
Returns
Boolean
f u n c t i o n ch a t S e r ver ( ) {
var tcp = new Socket;
// listen on por t 1234
w r iteln ("Chat ser ver listening on por t 1234");
if (tcp.listen (1234)) {
for (;;) {
/ / p o l l f o r a n e w con n e c t i o n
v a r con n e c t i o n = tc p. p o l l ( ) ;
i f ( co n n e c t i o n ! = nu l l ) {
w r i te l n ( " Co n n e c t i o n f ro m " + con n e c t i o n . h o s t ) ;
/ / we h ave a n e w con n e c t i o n , s o we l co m e a n d ch a t
// until client ter minates the session
con n e c t i o n . w r i te l n ( " We l com e to a l i t t l e ch a t ! " ) ;
ch a t ( co n n e c t i o n ) ;
con n e c t i o n . w r ite l n ( " * * * G o o d bye * * * " ) ;
con n e c t i o n . c l o s e ( ) ;
d e l e te con n e c t i o n ;
w r i te l n ( " Co n n e c t i o n c l o s e d " ) ;
}
}
}
}
f u n c t i o n ch a t ( c ) {
// select a long timeout
c.timeout=1000;
while (true) {
/ / g e t o n e l i n e a n d e ch o i t
w r i te l n ( c . re a d ( ) ) ;
// stop if the connection is broken
i f ( ! c . co n n e c te d )
break;
// read a line of text
w r i te ("cha t: ");
v a r tex t = rea d l n ( ) ;
if (text == "bye")
// stop conversation if the user entere d "bye"
break;
else
// other w ise t r ansmit to ser ver
c. w r i te l n (text);
}
}
The ASCII encoder raises errors for characters greater than 127, and the BINARY encoder simply converts
between bytes and Unicode characters by using the lower 8 bits. This encoder is convenient for reading and
writing binary data.
Additional encodings
In Windows, all encodings use so-called code pages. These code pages are assigned numeric values. The usual
Western character set that Windows uses is, for example, the code page 1252. Windows code pages may be
selected by prepending the number of the code page with "CP" or "WINDOWS- like "CP1252" for the code
page 1252. The File object has a lot of other encoding names built-in that match predefined code page
numbers. If a code page is not present, the encoding cannot be selected.
On Mac OS, encoders may be selected by name rather than by code page number. The File object queries Mac
OS directly for an encoder. As far as Mac OS character sets are identical with Windows code pages, Mac OS
also knows the Windows code page numbers.
Object Properties
(output of dump_objects.jsx from After Effects 6.5)
====================================================================
=======
AlphaMode enum
--------------------------------------------------------------------
-------
AlphaMode.IGNORE
AlphaMode.PREMULTIPLIED
AlphaMode.STRAIGHT
--------------------------------------------------------------------
-------
====================================================================
=======
Application object
--------------------------------------------------------------------
-------
beginSuppressDialogs() no return
beginUndoGroup(string undoName) no return
buildName : string : readOnly
buildNumber : integer : readOnly
endSuppressDialogs(boolean showAlert) no return
endUndoGroup() no return
endWatchFolder() no return
exitAfterLaunchAndEval : boolean : read/write
exitCode : integer : read/write
isProfessionalVersion : boolean : readOnly
isRenderEngine : boolean : readOnly
isUISuppressed : boolean : readOnly
isWatchFolder : boolean : readOnly
language : Language : readOnly
newProject() no return
open([File file]) returns Project
pauseWatchFolder(boolean doPause) no return
project : Project : readOnly
purge(PurgeTarget target) no return
quit() no return
registeredCompany : string : readOnly
registeredName : string : readOnly
serialNumber : string : readOnly
setMemoryUsageLimits(float imageCachePercent,
float maximumMemoryPercent) no return
setSavePreferencesOnQuit(boolean doSave) no return
settings : Settings : readOnly
version : string : readOnly
watchFolder(File file) no return
onError(string errorString,
string severity) no return
--------------------------------------------------------------------
-------
====================================================================
=======
AVLayer object
--------------------------------------------------------------------
-------
(integer propertyIndex) returns
PropertyBase
(string propertyName) returns
PropertyBase
active : boolean : readOnly
activeAtTime(float atTime) returns boolean
addProperty(string propertyName) returns
PropertyBase
adjustmentLayer : boolean : read/write
audioActive : boolean : readOnly
audioActiveAtTime(float atTime) returns boolean
audioEnabled : boolean : read/write
blendingMode : BlendingMode : read/write
canAddProperty(string propertyName) returns boolean
canSetCollapseTransformation : boolean : readOnly
canSetEnabled : boolean : readOnly
canSetTimeRemapEnabled : boolean : readOnly
collapseTransformation : boolean : read/write
copyToComp(CompItem intoComp) no return
duplicate() returns AVLayer
effectsActive : boolean : read/write
elided : boolean : readOnly
enabled : boolean : read/write
frameBlending : boolean : read/write
guideLayer : boolean : read/write
hasAudio : boolean : readOnly
hasTrackMatte : boolean : readOnly
hasVideo : boolean : readOnly
height : float : readOnly
inPoint : float : read/write
index : integer : readOnly
isEffect : boolean : readOnly
isMask : boolean : readOnly
isModified : boolean : readOnly
isNameFromSource : boolean : readOnly
isTrackMatte : boolean : readOnly
locked : boolean : read/write
matchName : string : readOnly
motionBlur : boolean : read/write
moveAfter(Layer otherLayer) no return
moveBefore(Layer otherLayer) no return
moveTo(integer index) no return
moveToBeginning() no return
moveToEnd() no return
name : string : read/write
nullLayer : boolean : readOnly
====================================================================
=======
BlendingMode enum
--------------------------------------------------------------------
-------
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.DIFFERENCE
BlendingMode.DISSOLVE
BlendingMode.EXCLUSION
BlendingMode.HARD_LIGHT
BlendingMode.HARD_MIX
BlendingMode.HUE
BlendingMode.LIGHTEN
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
--------------------------------------------------------------------
-------
====================================================================
=======
CloseOptions enum
--------------------------------------------------------------------
-------
CloseOptions.DO_NOT_SAVE_CHANGES
CloseOptions.PROMPT_TO_SAVE_CHANGES
CloseOptions.SAVE_CHANGES
--------------------------------------------------------------------
-------
====================================================================
=======
CompItem object
--------------------------------------------------------------------
-------
activeCamera : Layer : readOnly
bgColor : Array of float : read/write
comment : string : read/write
displayStartTime : float : read/write
draft3d : boolean : read/write
duplicate() returns
CompItem
duration : float : read/write
footageMissing : boolean : readOnly
frameBlending : boolean : read/write
frameDuration : float : read/write
frameRate : float : read/write
hasAudio : boolean : readOnly
hasVideo : boolean : readOnly
====================================================================
=======
FieldSeparationType enum
--------------------------------------------------------------------
-------
FieldSeparationType.LOWER_FIELD_FIRST
FieldSeparationType.OFF
FieldSeparationType.UPPER_FIELD_FIRST
--------------------------------------------------------------------
-------
====================================================================
=======
FileSource object
--------------------------------------------------------------------
-------
alphaMode : AlphaMode : read/write
conformFrameRate : float : read/write
displayFrameRate : float : readOnly
fieldSeparationType : FieldSeparationType : readOnly
file : File : readOnly
guessAlphaMode() no return
guessPulldown(PulldownMethod pulldownMethod) no return
hasAlpha : boolean : readOnly
highQualityFieldSeparation : boolean : read/write
invertAlpha : boolean : read/write
isStill : boolean : readOnly
loop : integer : read/write
nativeFrameRate : float : readOnly
premulColor : Array of float : read/write
reload() no return
removePulldown : PulldownPhase : readOnly
--------------------------------------------------------------------
-------
====================================================================
=======
FolderItem object
--------------------------------------------------------------------
-------
comment : string : read/write
id : integer : readOnly
item(integer itemIndex) returns Item
items : ItemCollection : readOnly
name : string : read/write
numItems : integer : readOnly
parentFolder : FolderItem : readOnly
remove() no return
selected : boolean : read/write
typeName : string : readOnly
--------------------------------------------------------------------
-------
====================================================================
=======
FootageItem object
--------------------------------------------------------------------
-------
comment : string : read/write
duration : float : readOnly
file : File : readOnly
footageMissing : boolean : readOnly
frameDuration : float : readOnly
frameRate : float : readOnly
hasAudio : boolean : readOnly
hasVideo : boolean : readOnly
height : integer : read/write
id : integer : readOnly
mainSource : FootageSource : readOnly
name : string : read/write
parentFolder : FolderItem : readOnly
pixelAspect : float : read/write
proxySource : FootageSource : readOnly
remove() no return
replace(File proxyFile) no return
replaceWithPlaceholder(string name,
integer width,
integer height,
float frameRate,
float duration) no return
replaceWithSequence(File proxyFile,
boolean forceAlphabetical) no return
replaceWithSolid(ArrayOfFloat color,
string name,
integer width,
integer height,
float pixelAspecRatio) no return
selected : boolean : read/write
setProxy(File proxyFile) no return
setProxyToNone() no return
setProxyWithPlaceholder(string name,
integer width,
integer height,
float frameRate,
float duration) no return
setProxyWithSequence(File proxyFile,
boolean forceAlphabetical) no return
setProxyWithSolid(ArrayOfFloat color,
string name,
integer width,
integer height,
float pixelAspecRatio) no return
time : float : readOnly
typeName : string : readOnly
useProxy : boolean : read/write
usedIn : Array of CompItem : readOnly
width : integer : read/write
--------------------------------------------------------------------
-------
====================================================================
=======
ImportAsType enum
--------------------------------------------------------------------
-------
ImportAsType.COMP
ImportAsType.COMP_CROPPED_LAYERS
ImportAsType.FOOTAGE
ImportAsType.PROJECT
--------------------------------------------------------------------
-------
====================================================================
=======
ImportOptions object
--------------------------------------------------------------------
-------
new ImportOptions(File fileToImport) returns
ImportOptions
canImportAs(ImportAsType asType) returns boolean
file : File : read/write
forceAlphabetical : boolean : read/write
importAs : ImportAsType : read/write
sequence : boolean : read/write
--------------------------------------------------------------------
-------
====================================================================
=======
ItemCollection object
--------------------------------------------------------------------
-------
addComp(string name,
integer width,
integer height,
float pixelAspectRatio,
float duration,
float frameRate) returns
CompItem
--------------------------------------------------------------------
-------
====================================================================
=======
KeyframeEase object
--------------------------------------------------------------------
-------
new KeyframeEase(float speed,
====================================================================
=======
KeyframeInterpolationType enum
--------------------------------------------------------------------
-------
KeyframeInterpolationType.BEZIER
KeyframeInterpolationType.HOLD
KeyframeInterpolationType.LINEAR
--------------------------------------------------------------------
-------
====================================================================
=======
Language enum
--------------------------------------------------------------------
-------
Language.ENGLISH
Language.FRENCH
Language.GERMAN
Language.JAPANESE
--------------------------------------------------------------------
-------
====================================================================
=======
Layer object
--------------------------------------------------------------------
-------
(integer propertyIndex) returns
PropertyBase
(string propertyName) returns
PropertyBase
active : boolean : readOnly
activeAtTime(float atTime) returns boolean
addProperty(string propertyName) returns
PropertyBase
canAddProperty(string propertyName) returns boolean
canSetEnabled : boolean : readOnly
copyToComp(CompItem intoComp) no return
duplicate() returns Layer
elided : boolean : readOnly
enabled : boolean : read/write
hasVideo : boolean : readOnly
====================================================================
=======
LayerCollection object
--------------------------------------------------------------------
-------
add(AVItem theItem,
[float duration]) returns AVLayer
addCamera(string name,
ArrayOfFloat centerPoint) returns Layer
addLight(string name,
ArrayOfFloat centerPoint) returns Layer
addNull([float duration]) returns AVLayer
addSolid(ArrayOfFloat color,
string name,
integer width,
integer height,
float pixelAspectRatio,
[float duration]) returns AVLayer
addText([TextDocument textDoc]) returns AVLayer
addText(string text) returns AVLayer
byName(string name) returns Layer
precompose(ArrayOfInteger layerIndices,
string name,
[boolean moveAllAttributes]) returns
CompItem
--------------------------------------------------------------------
-------
====================================================================
=======
LayerQuality enum
--------------------------------------------------------------------
-------
LayerQuality.BEST
LayerQuality.DRAFT
LayerQuality.WIREFRAME
--------------------------------------------------------------------
-------
====================================================================
=======
LogType enum
--------------------------------------------------------------------
-------
LogType.ERRORS_AND_PER_FRAME_INFO
LogType.ERRORS_AND_SETTINGS
LogType.ERRORS_ONLY
--------------------------------------------------------------------
-------
====================================================================
=======
MarkerValue object
--------------------------------------------------------------------
-------
new MarkerValue(string comment,
[string chapter],
[string url],
[string frameTarget]) returns
MarkerValue
chapter : string : read/write
comment : string : read/write
frameTarget : string : read/write
url : string : read/write
--------------------------------------------------------------------
-------
====================================================================
=======
MaskMode enum
--------------------------------------------------------------------
-------
MaskMode.ADD
MaskMode.DARKEN
MaskMode.DIFFERENCE
MaskMode.INTERSECT
MaskMode.LIGHTEN
MaskMode.NONE
MaskMode.SUBTRACT
--------------------------------------------------------------------
-------
====================================================================
=======
MaskMotionBlur enum
--------------------------------------------------------------------
-------
MaskMotionBlur.OFF
MaskMotionBlur.ON
MaskMotionBlur.SAME_AS_LAYER
--------------------------------------------------------------------
-------
====================================================================
=======
MaskPropertyGroup object
--------------------------------------------------------------------
-------
(integer propertyIndex) returns
PropertyBase
(string propertyName) returns
PropertyBase
active : boolean : readOnly
addProperty(string propertyName) returns
PropertyBase
canAddProperty(string propertyName) returns boolean
canSetEnabled : boolean : readOnly
color : Array of float : read/write
duplicate() returns
MaskPropertyGroup
elided : boolean : readOnly
enabled : boolean : readOnly
inverted : boolean : read/write
isEffect : boolean : readOnly
====================================================================
=======
OMCollection object
--------------------------------------------------------------------
-------
add() returns
OutputModule
--------------------------------------------------------------------
-------
====================================================================
=======
OutputModule object
--------------------------------------------------------------------
-------
applyTemplate(string templateName) no return
file : File : read/write
name : string : readOnly
postRenderAction : PostRenderAction : read/write
remove() no return
saveAsTemplate(string templateName) no return
templates : Array of string: readOnly
--------------------------------------------------------------------
-------
====================================================================
=======
PlaceholderSource object
--------------------------------------------------------------------
-------
alphaMode : AlphaMode : read/write
conformFrameRate : float : read/write
displayFrameRate : float : readOnly
fieldSeparationType : FieldSeparationType : read/write
guessAlphaMode() no return
guessPulldown(PulldownMethod pulldownMethod) no return
hasAlpha : boolean : readOnly
highQualityFieldSeparation : boolean : read/write
invertAlpha : boolean : read/write
isStill : boolean : readOnly
loop : integer : read/write
nativeFrameRate : float : readOnly
premulColor : Array of float : read/write
removePulldown : PulldownPhase : read/write
--------------------------------------------------------------------
-------
====================================================================
=======
PostRenderAction enum
--------------------------------------------------------------------
-------
PostRenderAction.IMPORT
PostRenderAction.IMPORT_AND_REPLACE_USAGE
PostRenderAction.NONE
PostRenderAction.SET_PROXY
--------------------------------------------------------------------
-------
====================================================================
=======
Project object
--------------------------------------------------------------------
-------
activeItem : Item : readOnly
bitsPerChannel : integer : read/write
close(CloseOptions closeOptions) returns boolean
consolidateFootage() returns integer
file : File : readOnly
importFile(ImportOptions importOptions) returns Item
importFileWithDialog() returns
ArrayOfItem
importPlaceholder(string itemName,
integer itemWidth,
integer itemHeight,
float frameRate,
====================================================================
=======
Property object
--------------------------------------------------------------------
-------
active : boolean : readOnly
addKey(float atTime) returns integer
canSetEnabled : boolean : readOnly
canVaryOverTime : boolean : readOnly
duplicate() returns
Property
elided : boolean : readOnly
enabled : boolean : readOnly
expression : string : read/write
expressionEnabled : boolean : read/write
expressionError : string : readOnly
hasMax : boolean : readOnly
hasMin : boolean : readOnly
isEffect : boolean : readOnly
isInterpolationTypeValid(
KeyframeInterpolationType type) returns boolean
isMask : boolean : readOnly
isModified : boolean : readOnly
isSpatial : boolean : readOnly
isTimeVarying : boolean : readOnly
keyInInterpolationType(integer keyIndex) returns
KeyframeInterpolationType
keyInSpatialTangent(integer keyIndex) returns
ArrayOfFloat
keyInTemporalEase(integer keyIndex) returns
ArrayOfKeyframeEase
====================================================================
=======
PropertyGroup object
--------------------------------------------------------------------
-------
(integer propertyIndex) returns
PropertyBase
(string propertyName) returns
PropertyBase
active : boolean : readOnly
addProperty(string propertyName) returns
PropertyBase
canAddProperty(string propertyName) returns boolean
canSetEnabled : boolean : readOnly
duplicate() returns
PropertyGroup
elided : boolean : readOnly
enabled : boolean : readOnly
isEffect : boolean : readOnly
isMask : boolean : readOnly
isModified : boolean : readOnly
matchName : string : readOnly
moveTo(integer index) no return
name : string : readOnly
numProperties : integer : readOnly
parentProperty : PropertyGroup : readOnly
property(integer propertyIndex) returns
PropertyBase
property(string propertyName) returns
PropertyBase
propertyDepth : integer : readOnly
propertyGroup([integer countUp]) returns
PropertyGroup
propertyIndex : integer : readOnly
propertyType : PropertyType : readOnly
remove() no return
selected : boolean : readOnly
--------------------------------------------------------------------
-------
====================================================================
=======
PropertyType enum
--------------------------------------------------------------------
-------
PropertyType.INDEXED_GROUP
PropertyType.NAMED_GROUP
PropertyType.PROPERTY
--------------------------------------------------------------------
-------
====================================================================
=======
PropertyValueType enum
--------------------------------------------------------------------
-------
PropertyValueType.COLOR
PropertyValueType.CUSTOM_VALUE
PropertyValueType.LAYER_INDEX
PropertyValueType.MARKER
PropertyValueType.MASK_INDEX
PropertyValueType.NO_VALUE
PropertyValueType.OneD
PropertyValueType.SHAPE
PropertyValueType.TEXT_DOCUMENT
PropertyValueType.ThreeD
PropertyValueType.ThreeD_SPATIAL
PropertyValueType.TwoD
PropertyValueType.TwoD_SPATIAL
--------------------------------------------------------------------
-------
====================================================================
=======
PulldownPhase enum
--------------------------------------------------------------------
-------
PulldownPhase.OFF
PulldownPhase.SSWWW
PulldownPhase.SWWWS
PulldownPhase.SWWWW_24P_ADVANCE
PulldownPhase.WSSWW
PulldownPhase.WSWWW_24P_ADVANCE
PulldownPhase.WWSSW
PulldownPhase.WWSWW_24P_ADVANCE
PulldownPhase.WWWSS
PulldownPhase.WWWSW_24P_ADVANCE
PulldownPhase.WWWWS_24P_ADVANCE
--------------------------------------------------------------------
-------
====================================================================
=======
PulldownMethod enum
--------------------------------------------------------------------
-------
PulldownMethod.ADVANCE_24P
PulldownMethod.PULLDOWN_3_2
--------------------------------------------------------------------
-------
====================================================================
=======
PurgeTarget enum
--------------------------------------------------------------------
-------
PurgeTarget.ALL_CACHES
PurgeTarget.IMAGE_CACHES
PurgeTarget.SNAPSHOT_CACHES
PurgeTarget.UNDO_CACHES
--------------------------------------------------------------------
-------
====================================================================
=======
RenderQueue object
--------------------------------------------------------------------
-------
item(integer itemIndex) returns
RenderQueueItem
items : RQItemCollection : readOnly
numItems : integer : readOnly
pauseRendering(boolean doPause) no return
render() no return
rendering : boolean : readOnly
showWindow(boolean doShow) no return
stopRendering() no return
--------------------------------------------------------------------
-------
====================================================================
=======
RenderQueueItem object
--------------------------------------------------------------------
-------
applyTemplate(string templateName) no return
comp : CompItem : readOnly
elapsedSeconds : float : readOnly
logType : LogType : read/write
numOutputModules : integer : readOnly
outputModule(integer outputModuleIndex) returns
OutputModule
outputModules : OMCollection : readOnly
remove() no return
render : boolean : read/write
saveAsTemplate(string templateName) no return
skipFrames : integer : read/write
startTime : float : readOnly
status : RQItemStatus : readOnly
templates : Array of string: readOnly
timeSpanDuration : float : read/write
timeSpanStart : float : read/write
onStatusChanged() no return
--------------------------------------------------------------------
-------
====================================================================
=======
RQItemCollection object
--------------------------------------------------------------------
-------
add(CompItem compToAdd) returns
RenderQueueItem
--------------------------------------------------------------------
-------
====================================================================
=======
RQItemStatus enum
--------------------------------------------------------------------
-------
RQItemStatus.DONE
RQItemStatus.ERR_STOPPED
RQItemStatus.NEEDS_OUTPUT
RQItemStatus.QUEUED
RQItemStatus.RENDERING
RQItemStatus.UNQUEUED
RQItemStatus.USER_STOPPED
RQItemStatus.WILL_CONTINUE
--------------------------------------------------------------------
-------
====================================================================
=======
Settings object
--------------------------------------------------------------------
-------
getSetting(string sectionName,
string sectionKey) returns string
haveSetting(string sectionName,
string sectionKey) returns boolean
saveSetting(string sectionName,
string sectionKey,
string newValue) no return
--------------------------------------------------------------------
-------
====================================================================
=======
Shape object
--------------------------------------------------------------------
-------
new Shape() returns Shape
closed : boolean : read/write
inTangents : Array of float[2] : read/write
outTangents : Array of float[2] : read/write
vertices : Array of float[2] : read/write
--------------------------------------------------------------------
-------
====================================================================
=======
SolidSource object
--------------------------------------------------------------------
-------
alphaMode : AlphaMode : read/write
color : Array of float : read/write
conformFrameRate : float : readOnly
displayFrameRate : float : readOnly
fieldSeparationType : FieldSeparationType : readOnly
guessAlphaMode() no return
guessPulldown(PulldownMethod pulldownMethod) no return
hasAlpha : boolean : readOnly
highQualityFieldSeparation : boolean : readOnly
invertAlpha : boolean : read/write
isStill : boolean : readOnly
loop : integer : readOnly
nativeFrameRate : float : readOnly
premulColor : Array of float : read/write
removePulldown : PulldownPhase : readOnly
--------------------------------------------------------------------
-------
====================================================================
=======
System object
--------------------------------------------------------------------
-------
machineName : string : readOnly
osName : string : readOnly
osVersion : string : readOnly
userName : string : readOnly
--------------------------------------------------------------------
-------
====================================================================
=======
TextDocument object
--------------------------------------------------------------------
-------
new TextDocument(string text) returns
TextDocument
text : string : read/write
--------------------------------------------------------------------
-------
====================================================================
=======
TimecodeBaseType enum
--------------------------------------------------------------------
-------
TimecodeBaseType.FPS100
TimecodeBaseType.FPS24
TimecodeBaseType.FPS25
TimecodeBaseType.FPS30
TimecodeBaseType.FPS48
TimecodeBaseType.FPS50
TimecodeBaseType.FPS60
--------------------------------------------------------------------
-------
====================================================================
=======
TimecodeDisplayType enum
--------------------------------------------------------------------
-------
TimecodeDisplayType.FEET_AND_FRAMES
TimecodeDisplayType.FRAMES
TimecodeDisplayType.TIMECODE
--------------------------------------------------------------------
-------
====================================================================
=======
TimecodeFilmType enum
--------------------------------------------------------------------
-------
TimecodeFilmType.MM16
TimecodeFilmType.MM35
--------------------------------------------------------------------
-------
====================================================================
=======
TrackMatteType enum
--------------------------------------------------------------------
-------
TrackMatteType.ALPHA
TrackMatteType.ALPHA_INVERTED
TrackMatteType.LUMA
TrackMatteType.LUMA_INVERTED
TrackMatteType.NO_TRACK_MATTE
--------------------------------------------------------------------
-------