Está en la página 1de 209

Gua de secuencias de comandos

de After Effects

bc

Copyright 2005 Adobe Systems Incorporated. Todos los derechos reservados.


Gua de secuencias de comandos de Adobe After Effects
AVISO: Toda la informacin contenida en este documento es propiedad de Adobe Systems Incorporated. Se prohbe reproducir y transmitir
cualquier parte de esta publicacin (ya sea en formato impreso o electrnico) en cualquier forma o por cualquier medio (electrnico,
mecnico, fotocopiado, grabacin o de otro tipo) sin el previo consentimiento por escrito de Adobe Systems Incorporated. El software
descrito en este documento se proporciona bajo licencia y slo puede utilizarse o copiarse de acuerdo con los trminos de dicha licencia.
Esta publicacin y la informacin que contiene se proporciona TAL CUAL, est sujeta a cambios sin previo aviso y no debe interpretarse como
un compromiso por parte de Adobe Systems Incorporated. Adobe Systems Incorporated no asume ninguna responsabilidad ni compromiso
por errores o inexactitudes, no ofrece garanta de ningn tipo (ya sean expresas, implcitas o legales) respecto a esta publicacin y niega
expresamente todas las garantas de comerciabilidad, adaptacin para un propsito particular y no-infraccin de derechos de terceros.
Cualquier referencia a nombres de empresas en las plantillas de ejemplo tiene slo fines informativos y no pretende referirse a ninguna
organizacin real.
Adobe, el logotipo de Adobe, After Effects y Photoshop son marcas comerciales o marcas registradas de Adobe Systems Incorporated en
Estados Unidos y en otros pases.
Apple, Mac y Macintosh son marcas comerciales de Apple Computer, Inc., registradas en Estados Unidos y en otros pases. Microsoft y
Windows son marcas comerciales o marcas registradas de Microsoft Corporation en Estados Unidos y en otros pases. JavaScript y todas las
marcas relativas a Java son marcas comerciales o marcas registradas de Sun Microsystems, Inc. en Estados Unidos y en otros pases. UNIX es
una marca registrada de The Open Group. Cualquier otra marca comercial es propiedad de sus propietarios respectivos.
Cualquier otra marca comercial es propiedad de sus propietarios respectivos.
Si esta gua se distribuye con software que incluye un contrato de licencia de usuario final, la gua, as como el software que en ella se
describe, se proporcionan bajo licencia y pueden utilizarse o copiarse slo de acuerdo con los trminos de dicha licencia. Exceptuando lo
permitido por tal licencia, se prohbe reproducir, almacenar en un sistema de recuperacin o transmitir cualquier parte de esta gua, en
cualquier forma o por cualquier medio, ya sea electrnico, mecnico, en grabacin o de otra forma, sin el previo consentimiento por escrito
por parte de Adobe Systems Incorporated. Tenga en cuenta que el contenido de esta gua est protegido por leyes de derechos de autor
(copyright), aunque no se distribuya con software que incluya un contrato de licencia de usuario final.
El contenido de esta gua se proporciona slo con fines informativos, est sujeto a cambios sin previo aviso y no debe interpretarse como un
compromiso por parte de Adobe Systems Incorporated. Adobe Systems Incorporated no asume ninguna responsabilidad o compromiso por
errores o inexactitudes que puedan aparecer en el contenido informativo de esta gua.
Adobe Systems Incorporated, 345 Park Avenue, San Jos, California 95110, EE.UU.

Introduccin

La Gua de secuencias de comandos de After Effects muestra cmo obtener un control de los procedimientos de
los proyectos de After Effects mediante secuencias de comandos. Este conjunto de funciones est disponible
nicamente en Adobe After Effects 7.0 Professional Edition.
Mediante las secuencias de comandos del sistema, puede simplificar la canalizacin de procesos y evitar tener
que seleccionar y hacer clic repetidamente. Si ha utilizado expresiones u otras tcnicas similares a JavaScript
para la animacin, o ha trabajado con secuencias de comandos del sistema en AppleScript o Visual Basic,
reconocer la eficacia de las secuencias de comandos en After Effects. Con prctica y experiencia suficiente en
el lenguaje JavaScript, podr controlar la canalizacin de los grficos.

Automatizacin de procesos
Uno de los usos principales de las secuencias de comandos en After Effects 7.0 es la automatizacin de procesos.
Interesar a cualquier persona responsable de administrar una canalizacin de procesos compleja.
La automatizacin de procesos se puede llevar a cabo mediante secuencias de comandos codificadas
manualmente o mediante una solucin de procesamiento en red de terceros que admita la administracin
automatizada de las canalizaciones de procesos en red.
Adems de las soluciones de secuencias de comandos, After Effects proporciona una herramienta de lnea de
comandos para la automatizacin de procesos. Esta herramienta, a eren der, permite procesar composiciones
desde la lnea de comandos, sin pasar por la interfaz de usuario de After Effects. Para obtener informacin de
referencia completa sobre esta herramienta, consulte Render Automation Command en la pgina 207.

Si no est familiarizado con las secuencias de comandos


After Effects 7.0 es una herramienta visual con una interfaz de usuario grfica; est acostumbrado a interactuar
con ella mediante elementos de la interfaz, como mens, paneles e iconos. Para la mayor parte, sta es la
manera ms asequible de trabajar. Las secuencias de comandos estn diseadas para situaciones en las que
esta metodologa conlleva numerosas repeticiones o laboriosas bsquedas y ordenaciones que se pueden
automatizar. Las secuencias de comandos son un mtodo abreviado para tareas tediosas que, de otra manera,
exigen seleccionar y hacer clic muchas veces. Tambin resultan tiles para aprovechar la eficacia del
procesamiento en red en situaciones en las que la Carpeta de inspeccin es menos eficaz (y ms difcil de
configurar). Consulte Examples en la pgina 167 para ver ejemplos de lo que hacen las secuencias de comandos.
Las secuencias de comandos estn disponibles incluso para usuarios no interesados en aprender a utilizar el
lenguaje JavaScript. Si usted es este tipo de usuario, an puede aprovechar la eficacia de las secuencias de
comandos mediante soluciones de terceros como Rush Network Render Queue, una interfaz de usuario grfica
que permite configurar procesos distribuidos desde cualquier equipo de la red sin tener que configurarlos en
equipos individuales.
Uno de los usos principales de las secuencias de comandos en After Effects 7.0 es la automatizacin de procesos.
Adems de la interfaz de secuencias de comandos, After Effects ofrece una herramienta de lnea de comandos,
a eren der , especial para este fin (consulte Render Automation Command en la pgina 207).

Gua de secuencias de comandos de After Effects

Introduccin

Tambin puede aprovechar la contribucin de usuarios que comparten secuencias de comandos con otros
usuarios. Los grandes estudios pueden tener a estos usuarios en plantilla, mientras que otros usuarios pueden
visitar foros como los que encontrar en
w w w. a dob efor u m s . com .

Objetos de After Effects


Es posible que no considere After Effects como un conjunto de objetos jerrquicos, pero cuando utiliza
elementos de la cola de procesamiento, composiciones y proyectos, as es cmo aparecern en las secuencias
de comandos. Al igual que las funciones de expresiones en After Effects permiten el acceso prcticamente a
cualquier propiedad de cualquier capa en una composicin del proyecto (a cada una de las cuales llamamos
objeto), las secuencias de comandos permiten el acceso a la jerarqua de objetos de After Effects y la realizacin
de cambios en estos objetos.
Las secuencias de comandos de After Effects estn basadas en ECMAScript (o ms concretamente,
la tercera edicin de la norma ECMA-262). Puede obtener documentacin adicional sobre este estndar
en www.ecma-international.org.

Expresiones y matemtica del movimiento


Puesto que las secuencias de comandos tienen acceso a propiedades de capas individuales y utilizan JavaScript,
se puede suponer que las expresiones y las secuencias de comandos son lo mismo. Pero son dos entidades
totalmente distintas. Las expresiones no pueden tener acceso a informacin de las secuencias de comandos
(como variables y funciones), mientras que una secuencia de comandos puede crear o editar una expresin.
No obstante, la similitud entre las expresiones y las secuencias de comandos reside en que se crean con el
mismo lenguaje, la norma ECMA de JavaScript. Por tanto, saber cmo se utilizan unas es til para entender
las otras.
La matemtica del movimiento ya no se incluye en After Effects; su funcionalidad ha sido reemplazada por
las secuencias de comandos y las expresiones. Todos los operadores matemticos y lgicos comunes para
ECMAScript estn disponibles en las secuencias de comandos.
Por ejemplo, con expresiones se puede simular la fsica de una pelota que bota mediante la aplicacin de reglas
matemticas a una capa pelota. Pero con secuencias de comandos, se puede crear una interfaz de usuario
completa que permita la animacin de una capa de una pelota que bota y su sombra utilizando los criterios
que especifica el usuario.

Acerca de esta gua


Esta gua est destinada a usuarios que administren canalizaciones de grficos (que pueden incluir tambin
otras aplicaciones de secuencias de comandos) y que deseen escribir secuencias de comandos que agreguen
capacidades personalizadas a After Effects.
Esta funcionalidad tambin la ofrecen soluciones de administracin de procesos en red de terceros. Estos
productos incluyen software diseado para facilitar la administracin de este proceso, por lo que es posible
aprovechar la funcionalidad sin necesidad de editar manualmente las secuencias de comandos.
Aunque esta gua est destinada a proporcionar informacin sobre las extensiones que se han agregado al
lenguaje ECMAScript/JavaScript para la aplicacin de secuencias de comandos a proyectos de After Effects,
para aprovechar al mximo las posibilidades de las secuencias de comandos necesitar saber cmo escribirlas
en el nivel del sistema (para la integracin con AppleScript o la lnea de comandos Terminal en Mac OS y las
secuencias de comandos de la lnea de comandos en Windows) y tener nociones bsicas sobre JavaScript.

Gua de secuencias de comandos de After Effects

Introduccin

Las secuencias de comandos reproducen gran parte de lo que se puede hacer mediante la interfaz de usuario
de After Effects, por lo que es fundamental tener un slido conocimiento de la aplicacin para saber cmo
utilizar esta funcionalidad.
NOTA: Los objetos de JavaScript llamados normalmente propiedades reciben el nombre de atributos en esta
gua para evitar la confusin con la propia definicin de una propiedad en After Effects (un valor que se puede
animar de un efecto, mscara o transformacin en una capa individual).

Activacin de funciones de secuencias de comandos completas


Por motivos de seguridad, las funciones de secuencias de comandos que se ejecutan fuera de la aplicacin After
Effects (como agregar y eliminar archivos y carpetas en volmenes, o el acceso a la red) estn deshabilitadas
de forma predeterminada.
Para habilitar estas funciones, elija Preferencias > General y seleccione Permitir que los scripts puedan
escribir archivos y acceder a la red.
Al seleccionar esta opcin, permitir lo siguiente:
Escribir archivos
Crear carpetas
Definir la carpeta actual
Crear un socket
Abrir un socket
Escuchar un socket

El kit de herramientas de ExtendScript (un depurador de JavaScript) est deshabilitado de forma


predeterminada para que los usuarios que no lo van a utilizar no lo encuentren. Al editar o escribir secuencias
de comandos, el kit de herramientas ayuda a detectar problemas relativos a secuencias de comandos. Para
activar el kit de herramientas en el equipo local cuando se produzca un error de una secuencia de comandos,
elija Preferencias > General y seleccione Activar el depurador de JavaScript. Para obtener informacin
detallada sobre el kit de herramientas de ExtendScript, consulte la Bridge JavaScript Reference.
Tenga en cuenta que el kit de herramientas se inicia slo cuando se ejecuta una secuencia de comandos, no
con expresiones, aunque stas tambin utilicen JavaScript.

Acceso y escritura de secuencias de comandos


Para crear y editar secuencias de comandos para After Effects, puede utilizar el kit de herramientas de
ExtendScript o una aplicacin de edicin de texto externa que permita crear archivos con la codificacin de
texto Unicode UTF-8. Tenga cuidado con aplicaciones como Microsoft Word, que de forma predeterminada
agregan informacin de encabezado a los archivos; estas aplicaciones crean errores de lnea 0 en las secuencias
de comandos y provocan un fallo de ejecucin.
Una secuencia de comandos puede residir en cualquier lugar, pero para que se muestre en el men Scripts es
necesario que se guarde en la carpeta Scripts, dentro de la carpeta de la aplicacin After Effects. Para obtener
ms informacin sobre cmo escribir y modificar secuencias de comandos, consulte Escritura de secuencias
de comandos en la pgina 6.
No hay un mtodo integrado de grabar una serie de acciones en una secuencia de comandos en After Effects
del modo en que se realiza en Photoshop. Las secuencias de comandos se crean fuera de After Effects y se
ejecutan dentro, o externamente mediante una lnea de comandos, el kit de herramientas de ExtendScript o
el software de administracin de procesos de terceros.

Escritura de secuencias de comandos

Cuando utiliza Adobe After Effects, crea proyectos, composiciones y elementos de la cola de procesamiento
junto con todos los elementos que contienen: material de archivo, imgenes, slidos, capas, mscaras, efectos
y propiedades. En trminos de secuencia de comandos, cada uno de estos elementos es un objeto.
El ncleo de una aplicacin de secuencia de comandos es el modelo de objetos. En After Effects, el modelo
de objetos est formado por un proyecto, elementos, composiciones, capas y elementos de la cola de
procesamiento. Cada objeto tiene sus atributos especiales y cada objeto de un proyecto de After Effects
tiene una identidad propia (aunque no todos se pueden utilizar con secuencias de comandos).
Debe estar familiarizado con el modelo de objetos de After Effects para poder crear secuencias de comandos.
Si desea conocer ms recursos para aprender a utilizar secuencias de comandos, consulte Ms recursos para
aprender a utilizar secuencias de comandos en la pgina 9.

Edicin de secuencias de comandos


After Effects 7.0 incluye un editor de JavaScript. Para iniciarlo, elija Archivo > Scripts > Abrir el Editor de
secuencias de comandos. Este depurador y editor de secuencias de comandos, llamado Kit de herramientas de
ExtendScript, proporciona una cmoda interfaz para crear y probar sus propias secuencias de comandos.
Puede utilizar cualquier editor de texto para crear, editar y guardar secuencias de comandos, pero se
recomienda que elija una aplicacin que no agregue automticamente informacin de encabezado al guardar
los archivos y que guarde con la codificacin Unicode (UTF-8).
Algunas aplicaciones de Windows tiles para editar secuencias de comandos son EM Editor o el Bloc de

notas integrado (asegrese de definir la codificacin como UTF-8 en las opciones de guardar).
Entre las aplicaciones de Mac OS tiles para editar secuencias de comandos se incluyen BBEdit o la

aplicacin integrada OS X TextEdit (asegrese de definir el tipo de almacenamiento como Unicode [UTF8] en las preferencias).

Formato JSX de ExtendScript


After Effects admite ExtendScript, la implementacin extendida de JavaScript de Adobe. Todas las aplicaciones
de Adobe que proporcionan una interfaz de secuencias de comandos utilizan ExtendScript. Adems de
implementar el lenguaje JavaScript segn la especificacin ECMA 2.6.2, ExtendScript ofrece funciones y
utilidades adicionales:
Kit de herramientas de ExtendScript: Como ayuda para crear, depurar y probar secuencias de comandos,

ExtendScript proporciona un entorno de desarrollo y de prueba interactivo, el Kit de herramientas de


ExtendScript. Tambin define un objeto de depuracin global, el objeto de dlar ($) y una utilidad de
generacin de informes para elementos de ExtendScript, la interfaz ExtendScript Reflection.
Objetos File y Folder: Puesto que la sintaxis de los nombres de rutas es muy diferente en los distintos sistemas

operativos, Adobe ExendScript define los objetos F i l e y Fo l der para proporcionar un acceso independiente de
la plataforma al sistema de archivos subyacente.

Gua de secuencias de comandos de After Effects

Escritura de secuencias de comandos

Mdulo de interfaz de usuario ScriptUI: El mdulo ScriptUI de ExtendScript permite crear e interactuar con

elementos de la interfaz de usuario. ScriptUI proporciona un modelo de objetos para ventanas y elementos de
control de UI en una aplicacin de Adobe.
NOTA: After Effects no admite la personalizacin de la funcin de diseo automtico de ScriptUI.
Herramientas y utilidades: Adems, ExtendScript ofrece herramientas y funciones, como una utilidad de

traduccin que proporciona valores de cadenas de la interfaz de usuario en distintos idiomas y funciones
globales para mostrar mensajes cortos en cuadros de dilogo (a l er t , con fi r m y prom p t ).
Comunicacin entre aplicaciones: ExtendScript proporciona un entorno de secuencias de comandos comn

para todas las aplicaciones de Adobe y permite la comunicacin entre aplicaciones mediante secuencias de
comandos.
Estas funciones se describen en detalle en Bridge JavaScript Reference, disponible con After Effects.
Los archivos de secuencias de comandos de ExtendScript se diferencian por la extensin . j s x , una variacin de
la extensin estndar . j s utilizada con los archivos de JavaScript. Las secuencias de comandos de After Effects
deben incluir la extensin de archivo . j s x para que la aplicacin las reconozca correctamente. Cualquier
archivo de texto codificado con UTF-8 que tenga la extensin . j s x se reconocer como un archivo de
ExtendScript.

Men y carpeta Scripts


Las secuencias de comandos de After Effects residen en la carpeta Scripts, dentro de la misma carpeta que el
archivo de la aplicacin After Effects 7.0. Cuando se inicia la aplicacin, slo las secuencias de comandos
guardadas en esta carpeta Scripts se enumeran automticamente en el men Scripts, aunque los archivos de
secuencias de comandos pueden residir en cualquier lugar.
Para ejecutar una secuencia de comandos que no aparece en el men Scripts, elija Archivo > Scripts > Ejecutar
guin y seleccione la secuencia de comandos en el cuadro de dilogo Abrir. Tambin puede enviar a After
Effects una secuencia de comandos desde el Kit de herramientas de ExtendScript, la lnea de comandos
(en Windows) o AppleScript (en Mac OS).
Para que se muestre en el cuadro de dilogo Abrir, la secuencia de comandos debe incluir la extensin de
archivo . j s x adecuada.

Carpetas Shutdown y Startup


La carpeta Scripts contiene dos carpetas llamadas Startup y Shutdown. After Effects ejecuta automticamente
las secuencias de comandos guardadas en estas carpetas, en orden alfabtico, al iniciar y cerrar la aplicacin,
respectivamente.
En la carpeta Startup puede colocar las secuencias de comandos que desea que se ejecuten al iniciar la
aplicacin. Se ejecutarn despus de que se inicialice la aplicacin y todos los plugins estn cargados.
Las secuencias de comandos comparten un entorno global, de manera que cualquier secuencia que se ejecute
al inicio puede definir variables y funciones disponibles para todas las secuencias de comandos. En todos los
casos, las variables y las funciones, una vez definidas mediante la ejecucin de la secuencia de comandos que
las contiene, continan en las siguientes secuencias de comandos durante una sesin de After Effects
especfica. Cuando se cierra la aplicacin, todas estas variables y funciones definidas globalmente se eliminan.
Los creadores de secuencias de comandos deben tener precaucin a la hora de asignar nombres nicos a las
variables incluidas en secuencias, de manera que una secuencia de comandos no vuelva a asignar por
equivocacin variables globales destinadas a continuar durante toda una sesin.
Tambin se pueden agregar atributos a objetos existentes, como el objeto Application (consulte Application
object en la pgina 19), para extender la aplicacin a otras secuencias de comandos.

Gua de secuencias de comandos de After Effects

Escritura de secuencias de comandos

Las secuencias de comandos guardadas en la carpeta Shutdown se ejecutan cuando se cierra la aplicacin. Esto
se produce despus de cerrar el proyecto pero antes de que se cierre otra aplicacin.

Envo de secuencias de comandos a After Effects desde el sistema


Si est familiarizado con la ejecucin de secuencias de comandos desde la lnea de comandos en Windows o
mediante AppleScript, puede enviar una secuencia directamente a la aplicacin After Effects abierta, que
despus se ejecutar automticamente.

Cmo incluir secuencias de comandos de After Effects en una lnea de comandos (Windows)
A continuacin se indican algunos ejemplos de entradas de la lnea de comandos de Windows que envan una
secuencia de comandos de After Effects a la aplicacin sin utilizar la interfaz de usuario de After Effects para
ejecutarla.
En el primer ejemplo, se copia y pega la secuencia de comandos de After Effects directamente en la lnea
de comandos y despus se ejecuta. El texto de la secuencia aparecer entre comillas despus del comando
a f ter f x . exe s :
a f ter f x . exe s " a l er t ( " Ac a b a de env i a r u n a a l er t a a Af ter E f fe c t s " ) "

Tambin puede especificar la ubicacin del archivo JSX que se va a ejecutar. Por ejemplo:
a f ter f x . exe r c : \ m i s D o c u m en to s \ S c r i p t s \ su A E S c r i p t Here . j s x
a f ter f x . exe r " c : \ m i s D o c u m en to s \ S c r i p t s \ Nom bre de S c r i p t con S p a ce s . j s x "

Cmo incluir secuencias de comandos de After Effects en AppleScript (Mac OS)


A continuacin se indican tres ejemplos de AppleScript que envan un archivo JSX que contiene una secuencia
de comandos de After Effects a la aplicacin sin utilizar la interfaz de usuario de After Effects para ejecutarla.
En el primer ejemplo, se copia la secuencia de comandos de After Effects directamente en AppleScript y
despus se ejecuta. El texto de la secuencia aparecer entre comillas despus del comando DoScript, de manera
que deben omitirse las comillas internas de la secuencia con el carcter de escape de barra invertida, como se
muestra a continuacin:
te l l a pp l i c a t i on " Adob e Af ter E f fe c t s 7 . 0 "
D o S c r i p t " a l er t ( \ " Ac a b a de env i a r u n a a l er t a a Af ter E f fe c t s \ " ) "
en d te l l

Tambin puede mostrar un cuadro de dilogo que pida la ubicacin del archivo JSX que se va a ejecutar,
de la siguiente manera:
s e t t h e F i l e to ch o o s e fi l e
te l l a pp l i c a t i on " Adob e Af ter E f fe c t s 7 . 0 "
DoScript theFile
en d te l l

Por ltimo, esta secuencia de comandos es quiz la ms til cuando se trabaja directamente en la edicin de
una secuencia de comandos JSX y se desea enviarla a After Effects para probarla o ejecutarla. Para utilizarla de
manera eficaz, debe especificar la aplicacin que contiene el archivo JSX abierto (en este ejemplo, TextEdit);
si no sabe el nombre exacto de la aplicacin, escriba lo ms parecido a TextEdit y AppleScript le pedir que
la busque.

Gua de secuencias de comandos de After Effects

Escritura de secuencias de comandos

Basta con que resalte el texto de la secuencia que desea ejecutar y, a continuacin, active este AppleScript:
(*
E s t a s e c u en c i a de com a n do s env a l a s e l e cc i n a c tu a l a Af ter E f fe c t s com o u n a s e c u en c i a de com a n do s .
*)
te l l a pp l i c a t i on 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 on a s tex t
en d te l l
te l l a pp l i c a t i on " Adob e Af ter E f fe c t s 7 . 0 "
a c t iv a te
DoScript the_script
en d te l l

Para obtener ms informacin sobre cmo utilizar AppleScript, consulte AppleScript: the Definitive Guide de
Matt Neuberg (OReilly & Associates) o AppleScript 1-2-3 de Sal Soghoian (Peachpit Press).

Prueba y solucin de problemas


Cualquier secuencia de comandos de After Effects que contenga un error que impida que se complete genera
un mensaje de error en la aplicacin. Este mensaje de error contiene informacin sobre la naturaleza del error
y la lnea de la secuencia de comandos en la que se ha producido.
Adems, After Effects incluye un depurador de JavaScript. Para obtener ms informacin sobre cmo activar
y utilizar el depurador, consulte la documentacin del Kit de herramientas de ExtendScript en Bridge
JavaScript Reference.

Ms recursos para aprender a utilizar secuencias de comandos


Existen muchos recursos para aprender ms sobre las secuencias de comandos que utilizan la norma ECMA.
El motor de secuencias de comandos de After Effects admite la tercera edicin de la norma ECMA-262,
incluidos las convenciones lxicas y de anotacin, tipos, objetos, expresiones e instrucciones.
Para obtener una lista completa de las palabras clave y los operadores que se incluyen con ECMAScript,
consulte el archivo ECMA-262.pdf, disponible en w w w. e c m a - i n ter n a t i on a l . or g / p u bl i c a t i on s / s t a n d a rd s /
Ecma-262.htm.
Los libros relativos a JavaScript 1.2 tambin resultan tiles para entender cmo funcionan las secuencias de
comandos en After Effects. Un libro que constituye una norma para los usuarios de JavaScript es JavaScript:
The Definitive Guide (OReilly) de David Flanagan. Otro libro muy til es JavaScript: A Beginners Guide
(Osborne) de John Pollock. Ambos contienen informacin relativa nicamente a las extensiones de JavaScript
para exploradores de Internet; no obstante, tambin describen de forma detallada los conceptos bsicos de las
secuencias de comandos.
Tambin hay libros sobre cmo usar AppleScript y cmo crear secuencias de comandos desde la lnea de
comandos de Windows, y ambas se pueden utilizar para enviar secuencias a After Effects.

Gua de secuencias de comandos de After Effects

Escritura de secuencias de comandos

10

Sintaxis de instrucciones y palabras clave


Aunque no se puede proporcionar un recurso que describa de forma exhaustiva el uso de JavaScript, las
siguientes tablas ofrecen una descripcin general de las palabras clave, instrucciones, operadores, prioridad y
asociatividad.
En la siguiente tabla se enumeran y se describen todas las palabras clave e instrucciones que reconoce el motor
de secuencias de comandos de After Effects.

Table 1

Sintaxis de instrucciones y palabras clave

Palabra clave/instruccin

Descripcin

bre a k

JavaScript estndar; cierra el bucle que se est ejecutando actualmente.

con t i nu e

JavaScript estndar; interrumpe la ejecucin de la repeticin del bucle actual.

case

Etiqueta que se utiliza en una instruccin s w i tch .

def a u l t

Etiqueta que se utiliza en una instruccin s w i tch cuando no se encuentra una etiqueta c a s e .

do. . . w h i l e

Constructor estndar de JavaScript. Similar al bucle w h i l e , salvo que la evaluacin de la condicin


del bucle se produce al final del mismo.

false

Literal que representa el valor falso booleano.

for

Construccin de bucle estndar de JavaScript.

for. . . i n

Construccin estndar de JavaScript. Proporciona una manera de desplazarse fcilmente por las
propiedades de un objeto.

f u n c t i on

Se utiliza para definir una funcin.

if/if...else

Construcciones condicionales estndar de JavaScript.

n ew

Instruccin de constructor estndar de JavaScript.

nu l l

Se asigna a una variable, elemento de conjunto o propiedad de objeto para indicar que no
contiene un valor vlido.

re tu r n

Forma estndar de JavaScript de devolver un valor de una funcin o salir de una funcin.

s w i tch

Forma estndar de JavaScript de evaluar una expresin de JavaScript e intentar corresponder el


valor de la expresin con una etiqueta c a s e .

this

Mtodo estndar de JavaScript para indicar el objeto actual.

true

Literal que representa el valor verdadero booleano.

u n defi n e d

Indica que todava no se ha asignado un valor a la variable, elemento de conjunto o propiedad de


objeto.

var

Sintaxis estndar de JavaScript que se utiliza para declarar una variable local.

while

Construccin estndar de JavaScript. Similar al bucle do. . . w h i l e , salvo que la evaluacin de la


condicin del bucle se produce al principio del mismo.

with

Construccin estndar de JavaScript que se utiliza para especificar un objeto que se va a utilizar
en instrucciones posteriores.

10

Gua de secuencias de comandos de After Effects

Escritura de secuencias de comandos

11

Operadores
En las siguientes tablas se enumeran y se describen todos los operadores que reconoce el motor de secuencia
de comandos de After Effects, y se indica la prioridad y la asociatividad de todos ellos.

Table 2

Descripcin de los operadores

Operadores

Descripcin

n ew

Asigna un objeto.

de l e te

Anula la asignacin de un objeto.

t y p e of

Devuelve un tipo de datos.

voi d

Devuelve un valor sin definir.

Miembro de una estructura.

[]

Elemento de una matriz.

()

Llamada a una funcin.

++

Aumento anterior o posterior.

Reduccin anterior o posterior.

Resta o negacin unaria.

NOT bit a bit.

NOT lgico.

Multiplicar.

Dividir.

Divisin modular.

Sumar.

<<

Desplazamiento a la izquierda bit a bit.

>>

Desplazamiento a la derecha bit a bit.

>>>

Desplazamiento a la derecha bit a bit sin signo.

<

Menor que.

<=

Menor o igual que .

>

Mayor que.

>=

Mayor o igual que .

==

Igual.

!=

Distinto.

&

AND bit a bit.

XOR bit a bit.

OR bit a bit.

&&

AND lgico.

||

OR lgico.

11

Gua de secuencias de comandos de After Effects

Escritura de secuencias de comandos

12

Operadores

Descripcin

?:

Condicional (ternario).

Asignacin.

+=

Asignacin con operacin de suma.

Asignacin con operacin de resta.

*=

Asignacin con operacin de multiplicacin.

/=

Asignacin con operacin de divisin.

%=

Asignacin con operacin de divisin modular.

<<=

Asignacin con operacin de desplazamiento a la izquierda bit a bit.

>>=

Asignacin con operacin de desplazamiento a la derecha bit a bit.

>>>=

Asignacin con operacin de desplazamiento a la derecha bit a bit sin signo.

&=

Asignacin con operacin AND bit a bit.

^=

Asignacin con operacin XOR bit a bit.

|=

Asignacin con operacin OR bit a bit.

Evaluacin mltiple.

Table 3

Prioridad de los operadores

Operadores (de mayor a menor prioridad)

Asociatividad

[], (), .

izquierda a derecha

n ew, de l e te , ( n e g a c i n u n a r i a ) , ! , t y p e of , voi d , + + ,

derecha a izquierda

*, /, %

izquierda a derecha

+ , ( re s t a )

izquierda a derecha

<<, >>, >>>

izquierda a derecha

<, <=, >, >=

izquierda a derecha

==, !=

izquierda a derecha

&

izquierda a derecha

izquierda a derecha

izquierda a derecha

&&

izquierda a derecha

||

izquierda a derecha

?:

derecha a izquierda

=, /=, %=, <<=, >>=, >>>=, &=, ^=, |=, +=, =, *=

derecha a izquierda

izquierda a derecha

12

JavaScript Reference

This chapter lists and describes JavaScript classes, objects, methods, attributes, and global functions defined by
After Effects.
The After Effects scripting engine supports ExtendScript, Adobes extended version of JavaScript, which implements the 3rd Edition of the ECMA-262 Standard, including its notational and lexical conventions, types,
objects, expressions and statements. For a complete listing of the keywords and operators included with
ECMAScript, refer to E C M A- 2 6 2 .p d f , available at w w w. e cm a - i n ter n a t ion a l . o r g / p u b l i ca t i on s/ s ta n d a rds /
E c ma-26 2.h t m . For an overview of the most common keywords and statements available from ECMA-262, see
Keywords and statement syntax on page 9.

The After Effects Object Model


As you look through this reference section, which is organized alphabetically by object, you can refer to the
following diagrams for an overview of where the various objects fall within the hierarchy, and their correspondence to the user interface.
SYSTEM

APPLICATION

SETTINGS

FOLDER

SOCKET

ITEMS MAYBEANYOFTHEFOLLOWINGTYPESOFITEM

PROJECT
COMP)TEM

RENDER1UEUE

FILE

/2

/2

FOOTAGE)TEM

FOLDER)TEM

ITEMS
LAYERS

ITEMS
PROXY3OURCE

RENDER1UEUE)TEMS
PROPERTIES

MAIN3OURCE

PROXY3OURCE

MAIN3OURCEPROXY3OURCE
MAYBEANYOFTHEFOLLOWINGTYPESOFITEM

OUTPUT-ODULES
SOLID3OURCE

COLOR

/2

PLACEHOLDER3OURCE

/2

FILE3OURCE

FILE

Hierarchy diagram of the main After Effects scripting objects

Note that the File and Folder objects are defined by ExtendScript, and are documented in the Bridge JavaScript
Reference. The Socket object is defined by ExtendScript, and is documented in The Socket Object on
page 201.
ExtendScript also defines the ScriptUI module, a set of window and user-interface control objects, which are
available to After Effects scripts. These are documented in the Bridge JavaScript Reference.

13

After Effects Scripting Guide

JavaScript Reference

14

The hierarchy of objects in scripting corresponds to the hierarchy in the user interface.

The application contains a Project panel, which displays a project. The project contains compositions, which
contain layers. The source for a layer can be a footage file, placeholder, or solid, also listed in the Project panel.
Each layer contains settings known as properties, and these can contain markers and keyframes. The render
queue contains render-queue items as well as render settings and output modules. All of these entities are represented by objects in scripting.
NOTE: To avoid ambiguity, this manual uses the term attribute to refer to JavaScript object properties, and the
term property or AE property to refer to After-Effects layer properties.

Object summary
The following table lists all objects alphabetically, with links to the documentation page for each.
Object

Description

Global functions on page 16

Globally available functions that allow you to display text for script debugging purposes,
and help convert time values between seconds and frames.

Application object on page 19

A single global object, available by its name (a pp ), that provides access to objects and
application settings within the After Effects application.

AVItem object on page 32

Represents audio/visual files imported into After Effects.

AVLayer object on page 39

Represents those layers that contain AVItems (Comp layers, footage layers, solid layers,
text layers, and sound layers).

CameraLayer object on page 48

Represents a camera layer within a composition.

14

After Effects Scripting Guide

JavaScript Reference

15

Object

Description

Collection object on page 49

Associates a set of objects or values as a logical group and provides access to them by
index.

CompItem object on page 50

Represents a composition, and allows you to manipulate it and get information about it.

FileSource object on page 58

Describes footage that comes from a file.

FolderItem object on page 60

Represents a folder in the Project panel.

FootageItem object on page 62

Represents a footage item imported into a project, which appears in the Project panel.

FootageSource object on page 65

Describes the file source of some footage.

ImportOptions object on page 71

Encapsulates options for importing files into After Effects.

Item object on page 74

Represents an item in a project that appears in the Project panel.

ItemCollection object on page 77

Collects items in a project.

KeyframeEase object on page 79

Encapsulates keyframe ease values in an After Effects property.

Layer object on page 81

A base class for layer classes.

LayerCollection object on page 90

Collects layers in a project.

LightLayer object on page 94

Represents a light layer within a composition.

MarkerValue object on page 95

Encapsulates marker values in an AE property.

MaskPropertyGroup object on page 97 Encapsulates mask attributes in a layer.


OMCollection object on page 99

Collects output modules in a render queue.

OutputModule object on page 100

Represents an output module for a render queue.

PlaceholderSource object on page 103 Describes a placeholder for footage.


Project object on page 104

Represents an After Effects project.

Property object on page 113

Represents an After Effects property.

PropertyBase object on page 135

A base class for After Effects property and property group classes.

PropertyGroup object on page 142

Represents an After Effects property group.

RenderQueue object on page 147

Represents the After Effects render queue.

RenderQueueItem object on page 150

Represents a renderable item in a render queue.

RenderQueueItem object on page 150

Collects render-queue items in a render queue.

RQItemCollection object on page 156

Provides access to application settings and preferences.

Shape object on page 159

Encapsulates the outline shape information for a mask.

SolidSource object on page 162

Describes a solid color that is the source of some footage.

System object on page 163

Provides access to the operating system from the application.

TextDocument object on page 165

Encapsulates the text in a text layer.

TextLayer object on page 166

Represents a text layer within a composition.

15

After Effects Scripting Guide

JavaScript Reference

16

Global functions
These globally available functions that are specific to After Effects. Any JavaScript object or function can call
these functions, which allow you to display text in a small (3-line) area of the Info panel, and to convert
numeric time values to and from string values.
Global function

Description

w r ite( )

Writes text to the Info panel, with no line break added.

w r ite L n ( )

Writes text to the Info panel, adding a line break at the end.

cl e arO ut put ()

Clears text from the Info panel.

t i m eToCur ren t For m at ()

Converts a numeric time value to a string time value.

c u r re n t Fo r m a t To Ti m e ( )

Converts string time value to a numeric time value.

Additional global functions for standard user I/O (aler t , con fi r m , and prom pt ) and static functions for file
I/O, are defined by ExtendScript; for detailed reference information, see the Bridge JavaScript Reference.
NOTE: The After Effects global functions for standard dialogs and file I/O are still supported in this release, but
are deprecated and will not be supported in future releases. For details, see the After Effects 6.5 documentation.

clearOutput() global function


cl e arO ut put ()
Description

Clears the output in the Info panel.


Parameters

None.
Returns

Nothing.

currentFormatToTime() global function


c u r re n t Fo r m a t To Ti m e ( fo r m at te d Ti m e, f ps , is D ura t io n )
Description

Converts a formatted string for a frame time value to a number of seconds, given a specified frame rate. For
example, if the formatted frame time value is 0:00:12 (the exact string format is determined by a project
setting), and the frame rate is 24 fps, the time would be 0.5 seconds (12/24). If the frame rate is 30 fps, the time
would be 0.4 seconds (12/30).
If the time is a duration, the frames are counted from 0. Otherwise, the frames are counted from the projects
starting frame (see Project displayStartFrame attribute on page 106).
Parameters
for m at ted Tim e

The frame time value, a string specifying a number of frames in the projects current time display format.

fps

The frames-per-second, a floating-point value.

16

After Effects Scripting Guide

JavaScript Reference

17

i s D u r a ti o n

Optional. When true, the time is a duration (measured from frame 0). When false (the default), the time is
measured from the projects starting frame.

Returns

Floating-point value, the number of seconds.

timeToCurrentFormat() global function


t i m eToCur ren t For m at (t im e , f p s , is D ura t i on )
Description

Converts a numeric time value (a number of seconds) to a frame time value; that is, a formatted string that
shows which frame corresponds to that time, at the specified rate. For example, if the time is 0.5 seconds, and
the frame rate is 24 fps, the frame would be 0:00:12 (when the project is set to Display Timecode). If the frame
rate is 30 fps, the frame would be 0:00:15. The format of the timecode string is determined by a project setting.
If the time is a duration, the frames are counted from 0. Otherwise, the frames are counted from the projects
starting frame (see Project displayStartFrame attribute on page 106).
Parameters
time

The number of seconds, a floating-point value.

fps

The frames-per-second, a floating-point value.

i s D u r a ti o n

Optional. When true, the time is a duration (measured from frame 0). When false (the default), the time is
measured from the projects starting frame.

Returns

String in the projects current time display format.

write() global function


w r ite( te x t )
Description

Writes output to the Info panel, with no line break added.


Parameters
tex t

The string to display. Truncated if too long for the Info panel.

Returns

Nothing.
Example
w r ite ( " T h i s text ap p e a r s i n In fo p a n e l ") ;
w r ite ( " w it h m o re o n s a m e l i n e . " ) ;

17

After Effects Scripting Guide

JavaScript Reference

18

writeLn() global function


w r ite L n ( t e x t)
Description

Writes output to the Info panel and adds a line break at the end.
Parameters
tex t

The string to display.

Returns

Nothing.
Example
w r ite l n ( " T h is tex t a pp e ars on f i r s t l i n e " ) ;
w r ite l n ( " T h is tex t a pp e ars on s e con d l i n e " );

18

After Effects Scripting Guide

JavaScript Reference

19

Application object
a pp
Description

Provides access to objects and application settings within the After Effects application. The single global object
is always available by its name, a pp .
Attributes of the Application object provide access to specific objects within After Effects. Methods of the
Application object can create a project, open an existing project, control Watch Folder mode, purge memory,
and quit the After Effects application. When the After Effects application quits, it closes the open project,
prompting the user to save or discard changes as necessary, and creates a project file as necessary.
Attributes
Attribute

Reference

Description

proj ec t

Application project attribute on


page 27 and Project object on
page 104

The current After Effects project.

language

Application language attribute on


page 25

The language in which the application is running.

vers i on

Application version attribute on


page 30

The version number of the After Effects application.

s e r i a l Nu m b e r

Application serialNumber attribute on The serial number of the After Effects installation.
page 29

re g i s tere d Na m e

Application registeredName attribute


on page 28

The user name to which the After Effects installation is


registered.

re g i s tere d Com p any

Application registeredCompany
attribute on page 28

The company to which the After Effects installation is


registered.

b u i l dNa m e

Application buildName attribute on


page 21

The name of this build of the application.

b u i l dNu m b e r

Application buildNumber attribute on The number of this build of the application.


page 22

i s Prof e s si o n a l Ver si o n

Application isProfessionalVersion
attribute on page 24

When true, the installation is the Professional Edition.

i s Wa tch Fo l der

Application isWatchFolder attribute


on page 25

When true, the local application is running in Watch


Folder mode.

i s Ren d e r E n g i n e

Application isRenderEngine attribute


on page 24

When true, the local After Effects application is installed


as a render engine.

s e tt i n g s

Application settings attribute on


page 30 and RQItemCollection object
on page 156

Application settings that can be set via scripting.

o n E r ror

Application onError attribute on


page 26

A callback function that is called when an error occurs


in the application.

e x i t Cod e

Application exitCode attribute on


page 24

A numeric status code used when executing a script


externally (that is, from a command line or AppleScript).
0 if no error occurred. A positive number indicates an
error that occurred while running the script.

e xi t Af ter L a u n ch A n d Eva l

Application exitAfterLaunchAndEval
attribute on page 23

When true, the application remains open after running


a script from the command line on Windows.

19

After Effects Scripting Guide

JavaScript Reference

20

Attribute

Reference

Description

s avePro je c t On Cr as h

Application saveProjectOnCrash
attribute on page 28

When true, the project is saved if the application closes


unexpectedly.

Methods
Method

Reference

Description

newPro jec t ()

Application newProject() method on


page 25

Creates a new project in After Effects.

open()

Application open() method on page 26

Opens a project or an Open Project dialog box.

qui t ()

Application quit() method on page 28

Quits the application.

w atch Fo l der ( )

Application watchFolder() method on


page 30

Starts Watch Folder mode; does not return


until Watch Folder mode is turned off.

p au se Wa tchFol de r ()

Application pauseWatchFolder() method


on page 27

Pauses a current watch-folder process.

endWatch Folder()

Application endWatchFolder() method on Ends a current watch-folder process.


page 23

p u r g e ()

Application purge() method on page 27

Purges a targeted type of cached information


(replicates Purge options in the Edit menu).

b eg i nUndoGroup()

Application beginUndoGroup() method


on page 21

Groups the actions that follow it into a single


undoable step.

endUndoGroup()

Application endUndoGroup() method on


page 22

Ends an undo group; needed only when a


script contains more than one undo group.

b eg i nSup pres sD i al o g s( )

Application beginSuppressDialogs()
method on page 21

Begins suppression of dialogs in the user interface.

e n d Su p p re s s D i a l o g s( )

Application endSuppressDialogs()
method on page 22

Ends suppression of dialogs in the user interface.

s e tMemor yUsa geLi mi ts ()

Application setMemoryUsageLimits()
method on page 29

Sets memory usage limits as in the Memory &


Cache preferences area.

s e tS ave Preferen ces O n Qu it ( )

Application setSavePreferencesOnQuit()
method on page 30

Sets whether preferences are saved when the


application is quit.

a c t iva te( )

Application activate() method on page 20 Brings the After Effects main window to the
front of the screen.

s ch e dul e Tas k( )

Application scheduleTask() method on


page 29

Schedules a JavaScript script for delayed execution.

c a n ce l Tas k( )

Application cancelTask() method on


page 22

Cancels a scheduled task.

Application activate() method


a pp. ac t iv ate ()
Description

Opens the application main window if it is minimized or iconified, and brings it to the front of the desktop.
Parameters

None.

20

After Effects Scripting Guide

JavaScript Reference

21

Returns

Nothing.

Application beginSuppressDialogs() method


a pp. b e g i n Su pp re s s D ia l o g s ()
Description

Begins suppression of script error dialog boxes in the user interface. Use en dSuppres s D ia l og s () to resume the
display of error dialogs. See Application endSuppressDialogs() method on page 22.
Parameters

None.
Returns

Nothing.

Application beginUndoGroup() method


a p p. b e g i n Un d o Grou p( u n d oSt r in g )
Description

Marks the beginning of an undo group, which allows a script to logically group all of its actions as a single
undoable action (for use with the Edit > Undo/Redo menu items). Use the endUndoGrou p() method to mark
the end of the group. (See Application endUndoGroup() method on page 22.)
b eg i nUndoGroup() and endUn doGrou p() pairs can be nested. Groups within groups become part of the
larger group, and will undo correctly. In this case, the names of inner groups are ignored.
Parameters
u n d o S t r in g

The text that will appear for the Undo command in the Edit menu (that is, Undo < un do St r i n g > )

Returns

Nothing.

Application buildName attribute


a pp. bu il d Nam e
Description

The name of the build of After Effects being run, used internally by Adobe for testing and troubleshooting.
Type

String; read-only.

21

After Effects Scripting Guide

JavaScript Reference

22

Application buildNumber attribute


a pp. bu il d Num b er
Description

The number of the build of After Effects being run, used internally by Adobe for testing and troubleshooting.
Type

Integer; read-only.

Application cancelTask() method


a pp. c an cel Ta sk ( t a s k I D)
Description

Removes the specified task from the queue of tasks scheduled for delayed execution.
Parameters
t as kI D

An integer that identifies the task, as returned by ap p.s ch e du l e Tas k () .

Returns

Nothing.

Application endSuppressDialogs() method


a pp. e n dSu pp re ss D ia l o g s ( ale r t )
Description

Ends the suppression of script error dialog boxes in the user interface. Error dialogs are displayed by default;
call this method only if b eg i nSu ppres sD i al o g s( ) has previously been called. See Application beginSuppressDialogs() method on page 21.
Parameters
a l er t

Boolean; when true, errors that have occurred following the call to b e g i nSup pres sD i al o g s( ) are displayed in a
dialog box.

Returns

Nothing.

Application endUndoGroup() method


a pp. en dUn doGrou p( )
Description

Marks the end of an undo group begun with the app.be g i nUndoGro up() method. You can use this method
to place an end to an undo group in the middle of a script, should you wish to use more than one undo group
for a single script.
If you are using only a single undo group for a given script, you do not need to use this method; in its absence
at the end of a script, the system will close the undo group automatically.

22

After Effects Scripting Guide

JavaScript Reference

23

Calling this method without having set a b e g i n Un d o Grou p ( ) method yields an error.
Parameters

None.
Returns

Nothing.

Application endWatchFolder() method


a pp. en dWa tchFol der( )
Description

Ends Watch Folder mode.


Parameters

None
Returns

Nothing.
See also

Application watchFolder() method on page 30


Application pauseWatchFolder() method on page 27
Application isWatchFolder attribute on page 25

Application exitAfterLaunchAndEval attribute


a pp. exitAfter L aun chAnd Ev al
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 causes the application to run a script
(from a file or from a string, respectively).
If this attribute is set to true, After Effects will exit after the script is run; if it is false, the application will remain
open.
This attribute only has an effect when After Effects is run from the Windows command line. It has no effect
in Mac OS.
Type

Boolean; read/write.

23

After Effects Scripting Guide

JavaScript Reference

24

Application exitCode attribute


a pp. ex i tCo de
Description

A numeric status code used when executing a script externally (that is, from a command line or AppleScript).
In Windows, the value is returned on the command line when After Effects was launched on the commands

line (using the af ter f x or af tger fx m command), and a script was specified with the r or s option.
in Mac OS, the value is returned as the Applescript D oS c r i p t result for each script.

In both Mac OS and Windows, the value is set to 0 (E X I T _ S UC C E S S ) at the beginning of each script evaluation. In the event of an error while the script is running, the script can set this to a positive integer that
indicates what error occured.
Type

Integer; read/write.
Example
a pp. ex i tCo de = 2 ; / / on qui t, i f v a lue is 2, a n er ror ha s o ccu r re d

Application isProfessionalVersion attribute


a pp. is Profes s i on a l Vers i on
Description

True if the locally installed After Effects application is the Professional Edition, false if it is the Standard
Edition.
Type

Boolean; read-only.
Example
v ar P B = a p p.i s Pro f e s s i o n a lVer s i o n ;
a l er t( "It i s " + P B + " tha t you are r unn ing the Prof es si onal Ed i t i on .") ;

Application isRenderEngine attribute


a p p. is Ren d er E n g in e
Description

True if an installation of After Effects is a Render Engine-only installation.


Type

Boolean; read-only.

24

After Effects Scripting Guide

JavaScript Reference

25

Application isWatchFolder attribute


a pp. is WatchFol der
Description

True if the Watch Folder dialog box is currently displayed and the application is currently watching a folder
for rendering.
Type

Boolean; read-only.

Application language attribute


a pp. l an g u ag e
Description

The language After Effects is running.


Type

A L a n g u ag e enumerated value; read-only. One of:


L a n g u a ge . E N G L I S H
L a n g u a ge . F R E N C H
L a n g u a ge . G E R M AN
L a n g u a ge . I TAL I A N
L a n g u a ge . JA PA N E S E
L a n g u a ge . S PAN I S H
Example
v ar l a n g = a pp. l a n g u ag e ;
if (lang == Language.ENGLISH)
a l er t( " Af te r E ff e c ts i s r u n n i n g i n E n g l i sh . " ) ;
e l s e if ( l a n g = = L a n g u a g e . F R E N C H )
a l er t ( " Af te r E ff e c ts i s r u n n i n g i n Fren ch. " ) ;
e l se
a l er t ( " Af te r E ff e c ts i s n o t r u n n in g in E n g l is h o r Fre n ch . " ) ;

Application newProject() method


a pp. n ew Proje c t( )
Description

Creates a new project in After Effects, replicating the File > New > New Project menu command.
If the current project has been edited, the user is prompted to save it. If the user cancels out of the Save dialog
box, the new project is not created and the method returns null. Use a pp.pro je c t .c lo se (C l os eO p t i o n s. D O_ N OT _ S AVE _ C H A N G E S ) to close the current project before opening a new one. See Project
close() method on page 105.
Parameters

None.

25

After Effects Scripting Guide

JavaScript Reference

26

Returns

A new Project object, or null if no new project is created.


Example
a pp. pro je c t .cl o se( C l os eO p t i on s. D O _ N OT _ S AV E _ C H AN G E S );
a pp. n ew Proje c t( );

Application onError attribute


a pp. on E r ror
Description

The name of a callback function that is called when an error occurs. By creating a function and assigning it to
this attribute, you can respond to errors systematically; for example, you can close and restart the application,
noting the error in a log file if it occurred during rendering. See RenderQueue render() method on page 148.
The callback function is passed the error string and a severity string. It should not return any value.
Type

A function name string, or null if no function is assigned; read/write.


Example
f u n c t io n e r r ( e r r St r i n g ) {
a l er t( er rS t r in g );
}
a pp. on E r ror = er r ;

Application open() method


a pp. op en ()
a pp. op en (f i l e)
Description

Opens a project.
Parameters
file

Optional. An ExtendScript File object for the project file to open. If not supplied, the method prompts the
user to select a project file.

Returns

A new Project object for the specified project, or null if the user cancels the Open dialog box.
Example
v ar my _file = new File (". ./my_folder/my_test .a ep");
i f (my _ fi l e . ex i st s) {
n e w _ p ro j e c t = a p p.o p e n ( my _ f i l e ) ;
i f (n e w _ proj e c t) {
a l er t( new _ proje c t.f i le.n ame) ;
}

26

After Effects Scripting Guide

JavaScript Reference

27

Application pauseWatchFolder() method


a pp. pa useWatchFo lder( p au s e)
Description

Pauses or resumes the search of the target watch folder for items to render.
Parameters
p au se

True to pause, false to resume.

Returns

Nothing.
See also

Application isWatchFolder attribute on page 25


Application watchFolder() method on page 30
Application endWatchFolder() method on page 23

Application project attribute


a pp. pro je c t
Description

The project that is currently loaded. See Project object on page 104.
Type

Project object; read-only.

Application purge() method


a pp. pu rg e( tar ge t )
Description

Purges unused data of the specified types from memory. Replicates the Purge options in the Edit menu.
Parameters
t arg e t

The type of elements to purge from memory; a Pur g eTa rg et enumerated value, one of:

Pur g e Ta r ge t . A L L _ C AC HE S : Purges all data that After Effects has cached to physical memory.
Purg e Tar ge t .UN D O _ C AC H E S : Purges all data saved in the undo cache.
Purg e Tar ge t .S NAP S HOT _ C AC H E S : Purges all data cached as comp/layer snapshots.
Pur g e Ta r ge t . I M AG E _ C AC H E S : Purges all saved image data.
Returns

Nothing.

27

After Effects Scripting Guide

JavaScript Reference

28

Application quit() method


a pp. qui t( )
Description

Quits the After Effects application.


Parameters

None.
Returns

Nothing.

Application registeredCompany attribute


a pp. re g i stere dCom p any
Description

The name (if any) that the user of the application entered as the registered company at the time of installation.
Type

String; read-only.
Example
v ar comp any = ap p.re g is tered Comp any ;
a l er t ( Yo ur com p a ny n a m e i s + com p a ny + . ) ;

Application registeredName attribute


a pp. re g i stere dNam e
Description

The user name, if any, that the user of the application entered for the registered name at the time of installation.
Type

String; read-only.
Example
v ar userNam e = a pp.reg i stere d Na me;
con f i r m ( Are you + u s e r Na m e + ? ) ;

Application saveProjectOnCrash attribute


a pp. saveProj ec tO nCr a sh
Description

When true (the default), After Effects attempts to display a dialog box that allows you to save the current
project if an error causes the application to quit unexpectedly. Set to false to suppress this dialog box and quit
without saving.

28

After Effects Scripting Guide

JavaScript Reference

29

Type

Boolean; read/write.

Application scheduleTask() method


a pp. sch ed ul eTa sk ( st r in g To Ex e cut e, de lay, re p e at )
Description

Schedules the specified JavaScript for delayed execution.


Parameters
s t r i n g ToE xe c ute

A string containing JavaScript to be executed.

de l ay

A number of milliseconds to wait before executing the JavaScript. A floating-point value.

rep e at

When true, execute the script repeatedly, with the specified delay between each execution. When false
the script is executed only once.

Returns

Integer, a unique identifier for this task, which can be used to cancel it with ap p.ca nce l Ta sk () .

Application serialNumber attribute


a pp. ser i al Num b er
Description

The alphanumeric string that is the serial number of the installed version of After Effects.
Type

String; read-only.
Example
v ar s er i a l = a pp. ser i al Num b er ;
a l er t ( " T h i s cop y is s e r i a l nu m b e r " + s er i a l ) ;

Application setMemoryUsageLimits() method


a pp. se t Mem o r y Us ag eL im i t s( im a geC a c he Pe rc e n t a ge, m ax imu m Me m o r y Pe rce n t age )
Description

Sets memory usage limits as in the Memory & Cache preferences area. For both values, if installed RAM is less
than a given amount (n gigabytes), the value is a percentage of the installed RAM, and is otherwise a
percentage of n. The value of n is: 2 Gb for Win32, 4 Gb for Win64, 3.5 Gb for Mac OS.
Parameters
i m a ge Ca chePercen ta g e

Floating-point value, the percentage of memory assigned to image cache.

m a x im u m Me m o r y Pe rcen t a ge

Floating-point value, the maximum usable percentage of memory.

29

After Effects Scripting Guide

JavaScript Reference

30

Returns

Nothing.

Application setSavePreferencesOnQuit() method


a pp. se t S avePref eren ces On Q ui t (d oS av e)
Description

Set or clears the flag that determines whether preferences are saved when the application is closed.
Parameters
doS ave

When true, preferences saved on quit, when false they are not.

Returns

Nothing.

Application settings attribute


a pp. se t ti n g s
Description

The currently loaded settings. See RQItemCollection object on page 156.


Type

Settings object; read-only.

Application version attribute


a pp. versi on
Description

An alphanumeric string indicating which version of After Effects is running.


Type

String; read-only.
Example
v ar ver = a p p. vers i o n ;
a l er t( " T h i s m a chi n e is r un n in g versi o n " + ver + " o f Af ter E f fe c t s . " ) ;

Application watchFolder() method


a pp. wa tchFol der( f o l d e r_ o b j e c t _t o _ w a t c h)
Description

Starts a Watch Folder (network rendering) process pointed at a specified folder.

30

After Effects Scripting Guide

JavaScript Reference

31

Parameters
fo l de r _ o b j e c t _ to _ wa tch

The ExtendScript Folder object for the folder to watch.

Returns

Nothing.
Example
v ar t heFolder = new Folder(c: /too l);
a pp. wa tchFolder(theFolder);
See also

Application endWatchFolder() method on page 23


Application pauseWatchFolder() method on page 27
Application isWatchFolder attribute on page 25

31

After Effects Scripting Guide

JavaScript Reference

32

AVItem object
a pp. pro je c t .i tem ( 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 a subclass of Item. All methods and attributes of Item, in addition to those listed below, are

available when working with AVItem. See Item object on page 74.
AVItem is the base class for both CompItem and FootageItem, so AVItem attributes and methods are also

available when working with CompItem and FootageItem objects. See CompItem object on page 50 and
FootageItem object on page 62.
Attributes
Attribute

Reference

Description

name

AVItem name attribute on page 35

The name of the object as shown in the Project panel.

w i dt h

AVItem width attribute on page 38

The width of the item.

h eig h t

AVItem height attribute on page 34

The height of the item.

p i xel As p e c t

AVItem pixelAspect attribute on page 35

The pixel aspect ratio of the item.

f r a m eRa te

AVItem frameRate attribute on page 34

The frame rate of the item.

f r a m eD ur a t i on

AVItem frameDuration attribute on page 33 The frame duration for the item.

du r at i on

AVItem duration attribute on page 33

The total duration of the item.

u s e Prox y

AVItem useProxy attribute on page 38

When true, a proxy source is used for this item.

prox y S ou rce

AVItem proxySource attribute on page 35

The FootageItem object used as proxy for the item.

time

AVItem time attribute on page 38

Current time of the item.

u s e dIn

AVItem usedIn attribute on page 38

The CompItem objects that use this item.

h as Vi de o

AVItem hasVideo attribute on page 34

When true, the item has a video component.

h as Au di o

AVItem hasAudio attribute on page 34

When true, the item has an audio component.

fo o t ag e M is s in g

AVItem footageMissing attribute on


page 33

When true, the item cannot be found or is a placeholder.

Methods
Method

Reference

Description

s e tProxy ( )

AVItem setProxy() method on page 36

Sets a proxy for the item.

s e tProxyWi thS e quence( )

AVItem setProxyWithSequence() method on


page 37

Sets a sequence as a proxy for theitem.

s e tProxyWi thS o lid ( )

AVItem setProxyWithSolid() method on


page 37

Sets a solid as a proxy for the item.

s e tProxyWi thP l a ceh older( )

AVItem setProxyWithPlaceholder() method on Sets a placeholder as a proxy for the item.


page 36

s e tProxy ToNon e ( )

AVItem setProxyToNone() method on page 36 Removes the proxy for the item.

32

After Effects Scripting Guide

JavaScript Reference

33

AVItem duration attribute


a pp. pro je c t .i tem ( in d e x) .d u r a ti o n
Description

Returns the duration, in seconds, of the item. Still footage items have a duration of 0.
In a CompItem, the value is linked to the d u r a ti o n of the composition, and is read/write.
In a FootageItem, the value is linked to the dur at i on of the m a i n S o u rce object, and is read-only.
Type

Floating-point value in the range [0.0..10800.0]; read/write for a CompItem; otherwise, read-only.

AVItem footageMissing attribute


a pp. pro je c t .i tem ( in d e x) .fo o t ag e M is s i n g
Description

When true, the AVItem is a placeholder, or represents footage with a source file that cannot be found. In this
case, the path of the missing source file is in the m i s s in g Fo o ta g e Pat h attribute of the footage items source-file
object. See FootageItem mainSource attribute on page 63 and FileSource missingFootagePath attribute on
page 58.
Type

Boolean; read-only.

AVItem frameDuration attribute


a pp. pro je c t .i tem ( in d e x) .f r a m e D u r at i on
Description

Returns the length of a frame for this AVItem, in seconds. This is the reciprocal of f r a m eRa te . When set, the
reciprocal is automatically set as a new f r am e R a te value.
This attribute returns the reciprocal of the f r am e R a te , which may not be identical to a value you set, if that
value is not evenly divisible into 1.0 (for example, 0.3). Due to numerical limitations, (1 / ( 1 / 0.3) ) is close
to, but not exactly, 0.3.
If the AVItem is a FootageItem, this value is linked to the m a in S o u rce , and is read-only. To change it, set the
con f o r m Fr a m e R a te of the m a i n S o u rce object. This sets both the f r a m e R ate and f r a m e D u r at i o n of the
FootageItem.
Type

Floating-point value in the range [1/99 .. 1.0 ]; read-only for a FootageItem, otherwise read/write.

33

After Effects Scripting Guide

JavaScript Reference

34

AVItem frameRate attribute


a pp. pro je c t .i tem ( in d e x) .f r a m eRa te
Description

The frame rate of the AVItem, in frames-per-second. This is the reciprocal of the f r am e D u r a t ion . When set,
the reciprocal is automatically set as a new f r am e D u r a t ion value.
In a CompItem, the value is linked to the f r a m eRa te of the composition, and is read/write.
In a FootageItem, the value is linked to the f r a m e R ate of the m a i n S o u rce object, and is read-only. To change

it, set the confor mFr ame Rate of the m a i n S o u rce object. This sets both the fr ameR ate and fr ame D ur a ti on
of the FootageItem.
Type

Floating-point value in the range [1.0..99.0]; read-only for a FootageItem, otherwise read/write.

AVItem hasAudio attribute


a pp. pro je c t .i tem ( in d e x) .h as Au di o
Description

When true , the AVItem has an audio component.


In a CompItem, the value is linked to the composition.
In a FootageItem, the value is linked to the m a i n S o u rce object.
Type

Boolean; read-only.

AVItem hasVideo attribute


a pp. pro je c t .i tem ( in d e x) .h as Vi de o
Description

When true , the AVItem has an video component.


In a CompItem, the value is linked to the composition.
In a FootageItem, the value is linked to the m a i n S o u rce object.
Type

Boolean; read-only.

AVItem height attribute


a pp. pro je c t .i tem ( in d e x) .h ei g h t
Description

The height of the item in pixels.


In a CompItem, the value is linked to the composition, and is read/write.

34

After Effects Scripting Guide

JavaScript Reference

35

In a FootageItem, the value is linked to the m a i n S o u rce object, and is read/write only if the m a i n S o u rce

object is a SolidSource. Otherwise, it is read-only.


Type

Integer in the range [1...30000]; read/write, except as noted.

AVItem name attribute


a pp. pro je c t .i tem ( in d e x) .n a m e
Description

The name of the item, as shown in the Project panel.


In a FootageItem, the value is linked to the m a i n S o u rce object. If the m ai n S ource object is a FileSource, this

value controls the display name in the Project panel, but does not affect the file name.
Type

String; read/write.

AVItem pixelAspect attribute


a pp. pro je c t .i tem ( in d e x) .p i xel As p e c t
Description

The pixel aspect ratio of the item.


In a CompItem, the value is linked to the composition.
In a FootageItem, the value is linked to the m a i n S o u rce object.

Certain p ixel As p e c t values are specially known to After Effects, and are stored and retrieved with perfect
accuracy. These are the set { 1, 0 .9, 1.2, 1.0 7, 1 .42, 2, 0 .95 , 1. 9 } . Other values may show slight rounding
errors when you set or get them; that is, the value you retrieve after setting may be slightly different from the
value you supplied.
Type

Floating-point value, in the range [0.01..100.0]; read/write.

AVItem proxySource attribute


a pp. pro je c t .i tem ( in d e x) .p roxy S o u rce
Description

The FootageSource being used as a proxy. The attribute is read-only; to change it, call any of the AVItem
methods that change the proxy source: se t Prox y ( ) , s e tProxyWi thS e quence( ) , se t Prox y Wi t hS o l i d () , or
s e t Proxy Wi thP l a ce h o l der ( ) .
Type

FootageSource object; read-only.

35

After Effects Scripting Guide

JavaScript Reference

36

AVItem setProxy() method


a pp. pro je c t .i tem ( in d e x) . s e tProxy ( file )
Description

Sets a file as the proxy of this AVItem. Loads the specified file into a new FileSource object, sets this as the value
of the prox y S ource attribute, and sets u se Prox y to true. It does not preserve the interpretation parameters,
instead using the user preferences. If the file has an unlabeled alpha channel, and the user preference says to
ask the user what to do, the method estimates the alpha interpretation, rather than asking the user.
This differs from setting a FootageItem's main source, but both actions are performed as in the user interface.
Parameters
file

An ExtendScript File object for the file to be used as a proxy.

Returns

None.

AVItem setProxyToNone() method


a pp. pro je c t .i tem ( in d e x) . s e tProxy To No n e ()
Description

Removes the proxy from this AVItem, sets the value of p roxy S o u rce to null, and sets the value of u se Prox y to
f al s e .
Parameters

None.
Returns

Nothing.

AVItem setProxyWithPlaceholder() method


a pp. pro je c t .i tem ( in d e x) .s e tProxy Wi th Pl a ceh ol der( n am e , w id t h , he ig h t , f ram e R at e, durat ion )
Description

Creates a PlaceholderSource object with specified values, sets this as the value of the prox y S ource attribute,
and sets u s e Prox y to true. It does not preserve the interpretation parameters, instead using the user preferences.
NOTE: There is no direct way to set a placeholder as a proxy in the user interface; this behavior occurs when a proxy
has been set and then moved or deleted.
Parameters
name

A string containing the name of the new object.

w i dt h, heig ht

The pixel dimensions of the placeholder, an integer in the range [4..30000].

f r a m eRa te

The frames-per-second, an integer in the range [1..99].

36

After Effects Scripting Guide

JavaScript Reference

37

The total length in seconds, up to 3 hours. An integer in the range [0.0..10800.0].

du r at i on
Returns

Nothing.

AVItem setProxyWithSequence() method


a pp. pro je c t .i tem ( in d e x) .se tProxyWith S equence( file, forc eAlphabe t ical )
Description

Sets a sequence of files as the proxy of this AVItem, with the option of forcing alphabetical order. Loads the
specified file sequence into a new FileSource object, sets this as the value of the prox y S ource attribute, and sets
u s e Prox y to true. It does not preserve the interpretation parameters, instead using the user preferences. If any
file has an unlabeled alpha channel, and the user preference says to ask the user what to do, the method
estimates the alpha interpretation, rather than asking the user.
Parameters
file

An ExtendScript File object for the first file in the sequence.

force Alp ha b e t ic a l

When true, use the Force alphabetical order option.

Returns

Nothing.

AVItem setProxyWithSolid() method


a pp. pro je c t .i tem ( in d e x) .s e tProxyWith S olid ( c ol or, n am e , w id t h, he i g h t , p ix e lAsp ec t)
Description

Creates a SolidSource object with specified values, sets this as the value of the prox y S ource attribute, and sets
u s e Prox y to true. It does not preserve the interpretation parameters, instead using the user preferences.
NOTE: There is no way, using the user interface, to set a solid as a proxy; this feature is available only through
scripting.
Parameters
co lor

The color of the solid, an array of 3 floating-point values, [R, G, B], in the range [0.0..1.0].

name

A string containing the name of the new object.

w i dt h, heig ht

The pixel dimensions of the placeholder, an integer in the range [1...30000].

p i xel As p e c t

The pixel aspect of the solid, a floating-point value in the range [0.01... 100.0].

Returns

Nothing.

37

After Effects Scripting Guide

JavaScript Reference

38

AVItem time attribute


a pp. pro je c t .i tem ( in d e x) .t i m e
Description

The current time of the item when it is being previewed directly from the Project panel. This value is a number
of seconds. Use the global method t i m eTo Cur ren t Fo r m at to convert it to a string value that expresses the time
in terms of frames; see timeToCurrentFormat() global function on page 17.
It is an error to set this value for a FootageItem whose m a i n S o u rce is still (ite m .m ai n S ource .i s St i l l is true).
Type

Floating-point value; read/write.

AVItem usedIn attribute


a pp. pro je c t .i tem ( in d e x) .u se dIn
Description

All the compositions that use this AVItem.


Note: Upon retrieval, the array value is copied, so it is not automatically updated. If you get this value, then add
this item into another composition, you must retrieve the value again to get an array that includes the new item.
Type

Array of CompItem objects; read-only.

AVItem useProxy attribute


a pp. pro je c t .i tem ( in d e x) .u seProx y
Description

When true, a proxy is used for the item. It is set to true by all the S e t Prox y methods, and to false by the
S e tProx y ToNon e( ) method.
Type

Boolean; read/write.

AVItem width attribute


a pp. pro je c t .i tem ( in d e x) .w i d th
Description

The width of the item, in pixels.


In a CompItem, the value is linked to the composition, and is read/write.
In a FootageItem, the value is linked to the m a i n S o u rce object, and is read/write only if the m a i n S o u rce

object is a SolidSource. Otherwise, it is read-only.


Type

Integer in the range [1...30000]; read/write, except as noted.

38

After Effects Scripting Guide

JavaScript Reference

39

AVLayer object
a pp. pro j e c t .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).
AVLayer is a subclass of Layer. All methods and attributes of Layer, in addition to those listed below, are

available when working with AVLayer. See Layer object on page 81.
AVLayer is a base class for TextLayer, so AVLayer attributes and methods are available when working with

TextLayer objects. See TextLayer object on page 166.


AE Properties

Different types of layers have different AE properties. AVLayer has the following properties and property
groups:
Ma r ker
Tim e Remap
Mot i on Tr a ckers
Ma sk s
Effects
Tr an s for m
Anchor Point
Pos i t i on
S c al e
Orientation
X Rot at i on
Y Rot at i o n
Rot at i o n
O p a ci t y
Ma ter i al O p t i on s
C as ts S h a dow s
L i g ht Tr a n s m i ss i on
Acce p ts S h a dows
Acce p ts L i g h ts
Ambi ent
D i ff us e
S p e c u l ar
Shininess
Met al
Aud i o
Aud i o Le ve l s
Example

If the first item in the project is a CompItem, and the first layer of that CompItem is an AVLayer, the following
sets the layer qua l it y, s ta r t Ti m e , and i n Poi n t .
v ar f i r s t L aye r = a p p. p ro je c t .i te m ( 1 ) . l ayer (1 ) ;
first L ayer.qu alit y = L ayerQ ualit y.B EST;
f i r s t L aye r. s t a r t Ti m e = 1 ;
f i r s t L aye r. i n Po i n t = 2 ;

39

After Effects Scripting Guide

JavaScript Reference

40

Attributes
Attribute

Reference

Description

s o u rce

AVLayer source attribute on page 46

The source item for this layer.

i s Na m e Fro m S o u rce

AVLayer isNameFromSource attribute


on page 45

When true, the layer has no expressly set name,


but contains a named source.

h eig h t

AVLayer height attribute on page 44

The height of the layer.

w i dt h

AVLayer width attribute on page 47

The width of the layer.

a ud io E n ab l ed

AVLayer audioEnabled attribute on


page 42

When true, the layer's audio is enabled.

mo tionBlu r

AVLayer motionBlur attribute on


page 45

When true, the layer's motion blur is enabled.

e f fe c t sAc t ive

AVLayer effectsActive attribute on


page 43

When true, the layer's effects are active.

adju st mentLayer

AVLayer adjustmentLayer attribute on


page 41

When true, this is an adjustment layer.

g u id e L ayer

AVLayer guideLayer attribute on


page 44

When true, this is a guide layer.

t hree DL ayer

AVLayer threeDLayer attribute on


page 46

When true, this is a 3D layer.

can S et Col l ap se Tr ans for ma tion

AVLayer canSetCollapseTransformation When true, it is legal to change the value of


attribute on page 43
col l a ps e Tr a n sf or m a t i o n .

co l l ap s e Tr an s fo r m at i on

AVLayer collapseTransformation
attribute on page 43

When true, collapse transformation is on.

f r a m e Bl e n di n g

AVLayer frameBlending attribute on


page 44

When true, frame blending is enabled.

c a n S e t Ti m e Rem a p E n a bl e d

AVLayer canSetTimeRemapEnabled
attribute on page 43

t i m e Rem a p E n a bl e d .

t i m eRem ap E n ab l e d

AVLayer timeRemapEnabled attribute


on page 46

When true, time remapping is enabled on this


layer.

h as Au di o

AVLayer hasAudio attribute on


page 44

When true, the layer contains an audio component.

a ud io Ac t ive

AVLayer audioActive attribute on


page 41

When true, the layer's audio is active at the current time.

b l endi ngMo de

AVLayer blendingMode attribute on


page 42

The blending mode of the layer.

preser veTr a n spa rency

AVLayer preserveTransparency
attribute on page 45

When true, preserve transparency is enabled.

t r ackMat teTy p e

AVLayer trackMatteType attribute on


page 46

if layer has a track matte, specifies the way it is


applied.

i s Tr a ck Ma tte

AVLayer isTrackMatte attribute on


page 45

When true, this layer is being used as a track


matte for the layer below it.

h as Tr a ck Ma tte

AVLayer hasTrackMatte attribute on


page 44

When true, the layer above is being used as a


track matte on this layer.

qu a l i t y

AVLayer quality attribute on page 45

The layer quality setting.

When true, it is legal to change the value of

40

After Effects Scripting Guide

JavaScript Reference

41

Method
Method

Reference

Description

a udio Ac t iveAtTime()

AVLayer audioActiveAtTime() method


on page 41

Reports whether this layer's audio is active at a given time.

AVLayer adjustmentLayer attribute


a pp. pro je c t .i tem ( in d e x) .a d ju s t m e n t L ayer
Description

True if the layer is an adjustment layer.


Type

Boolean; read/write.

AVLayer audioActive attribute


a pp. pro je c t .i tem ( in d e x) .a ud io Ac t ive
Description

True if the layer's audio is active at the current time.


For this value to be true, aud i oEna ble d must be true, no other layer with audio may be soloing unless this layer
is soloed too, and the time must be between the in Poi n t and o utPoi n t of this layer.
Type

Boolean; read-only.

AVLayer audioActiveAtTime() method


a pp. pro je c t .i tem ( in d e x) .a ud io Ac t iveAtTi me( t im e )
Description

Returns true if this layer's audio will be active at the specified time.
For this method to return true, a ud io E n ab l ed must be true, no other layer with audio may be soloing unless
this layer is soloed too, and the time must be between the i n Poin t and outPoint of this layer.
Parameters
time

The time, in seconds. A floating-point value.

Returns

Boolean.

41

After Effects Scripting Guide

JavaScript Reference

42

AVLayer audioEnabled attribute


a pp. pro je c t .i tem ( in d e x) .a ud io E n ab l e d
Description

When true, the layer's audio is enabled. This value corresponds to the audo toggle switch in the Timeline
panel.
Type

Boolean; read/write.

AVLayer blendingMode attribute


a pp. pro je c t .i tem ( in d e x) .b l e n d in g Mode .
Description

The blending mode of the layer.


Type

A Bl en d i n g Mo de enumerated value; read/write. One of:


Bl e n d in g Mod e .AD D
Bl e n d in g Mod e .AL PH A _ A DD
Bl e n d in g Mod e .C L A S S I C _ C O LOR _ BUR N
Bl e n d in g Mod e .C L A S S I C _ C O LOR _ D O D G E
Bl e n d in g Mod e .C L A S S I C _ D I F F E R E N C E
Bl e n d in g Mod e .C O LOR
Bl e n d in g Mod e .C O LOR _ BUR N
Bl e n d in g Mod e .C O LOR _ D O D G E
Bl e n d in g Mod e .DA N C I N G _ DI S S OLV E
Bl e n d in g Mod e .DA R K E N
Bl e n d in g Mod e .D I F F E R E N C E
Bl e n d in g Mod e .D I S SO LVE
Bl e n d in g Mod e .E XC LUS I ON
Bl e n d in g Mod e .H A R D _ L I G HT
Bl e n d in g Mod e .H A R D _ M I X
Bl e n d in g Mod e .H UE
Bl e n d in g Mod e .L I G H T E N
Bl e n d in g Mod e .L I N E A R _ BU R N
Bl e n d in g Mod e .L I N E A R _ D O D G E
Bl e n d in g Mod e .L I N E A R _ L I G H T
Bl e n d in g Mod e .LU M I N E S C E N T _ PR E M U L
Bl e n d in g Mod e .LU M I N O S I T Y
Bl e n d in g Mod e .M ULT I PLY
Bl e n d in g Mod e .N O R M A L

42

After Effects Scripting Guide

JavaScript Reference

43

Bl e n d in g Mod e .OV E R L AY
Bl e n d in g Mod e .PI N _ L I G H T
Bl e n d in g Mod e .S AT U RAT I O N
Bl e n d in g Mod e .S C R E E N
Bl e n d in g Mod e .S I L H OU E T E _ AL PH A
Bl e n d in g Mod e .S I L H OU E T T E _ LUM A
Bl e n d in g Mod e .S O F T _ L I G HT
Bl e n d in g Mod e .S T E N C I L _ A L PHA
Bl e n d in g Mod e .S T E N C I L _ LUM A
B l e n d in g Mod e . V I V I D _ L I G H T

AVLayer canSetCollapseTransformation attribute


a pp. pro je c t .i tem ( in d e x) .ca nS et Col l ap se Tr ans for ma t ion
Description

True if it is legal to change the value of the co l l a ps eTr an sfor m at i on attribute on this layer.
Type

Boolean; read-only.

AVLayer canSetTimeRemapEnabled attribute


a pp. pro je c t .i tem ( in d e x) .c a n S e t Ti m e Rem a p E n a bl e d
Description

True if it is legal to change the value of the t i m eRem ap E n ab l e d attribute on this layer.
Type

Boolean; read-only.

AVLayer collapseTransformation attribute


a pp. pro je c t .i tem ( in d e x) .co l l a ps eTr an sfor m at i on
Description

True if collapse transformation is on for this layer.


Type

Boolean; read/write.

AVLayer effectsActive attribute


a pp. pro je c t .i tem ( in d e x) .e f fe c t sAc t ive
Description

True if the layer's effects are active, as indicated by the <f> icon next to it in the user interface.
Type

Boolean; read/write.

43

After Effects Scripting Guide

JavaScript Reference

44

AVLayer frameBlending attribute


a pp. pro je c t .i tem ( in d e x) .f r a m e Bl e n d in g
Description

True if frame blending is enabled for the layer.


Type

Boolean; read/write.

AVLayer guideLayer attribute


a pp. pro je c t .i tem ( in d e x) .g u id e L ayer
Description

True if the layer is a guide layer.


Type

Boolean; read/write.

AVLayer hasAudio attribute


a pp. pro je c t .i tem ( in d e x) .h as Au di o
Description

True if the layer contains an audio component, regardless of whether it is audio-enabled or soloed.
Type

Boolean; read-only.

AVLayer hasTrackMatte attribute


a pp. pro je c t .i tem ( in d e x) .h as Tr a ck Ma tte
Description

True if the layer in front of this layer is being used as a track matte on this layer. When true, this layer's t r a ck Ma tteTy p e value controls how the matte is applied.
Type

Boolean; read-only.

AVLayer height attribute


a pp. pro je c t .i tem ( in d e x) .h ei g h t
Description

The height of the layer in pixels.


Type

Floating-point; read-only.

44

After Effects Scripting Guide

JavaScript Reference

45

AVLayer isNameFromSource attribute


a pp. pro je c t .i tem ( in d e x) .i s Na m e Fro m S o u rce
Description

True if the layer has no expressly set name, but contains a named source. In this case, laye r. n am e has the same
value as l ay e r.s ource .nam e .
False if the layer has an expressly set name, or if the layer does not have a source.
Type

Boolean; read-only.

AVLayer isTrackMatte attribute


a pp. pro je c t .i tem ( in d e x) .i s Tr a ck Ma tte
Description

True if this layer is being used as a track matte for the layer behind it.
Type

Boolean; read-only.

AVLayer motionBlur attribute


a pp. pro je c t .i tem ( in d e x) .m o t io n B lu r
Description

True if motion blur is enabled for the layer.


Type

Boolean; read/write.

AVLayer preserveTransparency attribute


a pp. pro je c t .i tem ( in d e x) .p re s e r veTr a n s p a re n c y
Description

True if preserve transparency is enabled for the layer.


Type

Boolean; read/write.

AVLayer quality attribute


a pp. pro je c t .i tem ( in d e x) .qu ali t y
Description

The quality with which this layer is displayed.

45

After Effects Scripting Guide

JavaScript Reference

46

Type

A L ayer Q u a l it y enumerated value; read/write. One of:


LayerQu alit y.B EST
L ayer Q u al i t y. D RA F T
L ayer Q u al i t y. W I R E F RA M E

AVLayer source attribute


a pp. pro je c t .i tem ( in d e x) .s o u rce
Description

The source AVItem for this layer. The value is null in a Text layer.
Type

AVItem object; read-only.

AVLayer threeDLayer attribute


a pp. pro je c t .i tem ( in d e x) .t hree DL ayer
Description

True if this is a 3D layer.


Type

Boolean; read/write.

AVLayer timeRemapEnabled attribute


a pp. pro je c t .i tem ( in d e x) .t i m eRem ap E n ab l e d
Description

True if time remapping is enabled for this layer.


Type

Boolean; read/write.

AVLayer trackMatteType attribute


a pp. pro je c t .i tem ( in d e x) .t r a ckMat teTy p e
Description

If this layer has a track matte, specifies the way the track matte is applied.

46

After Effects Scripting Guide

JavaScript Reference

47

Type

A Tr a ck Ma tte Ty p e enumerated value; read/write. One of:


Tr a ck Mat teTy p e. AL PH A
Tr a ck Mat teTy p e. AL PH A_ I N VE RT E D
Tr a ck Mat teTy p e. LUM A
Tr a ck Ma t teTy p e . LU M A _ I N V E RT E D
Tr a ck Mat teTy p e. N O_ T RAC K _ MAT T E

AVLayer width attribute


a pp. pro je c t .i tem ( in d e x) .w i d th
Description

The width of the layer in pixels.


Type

Floating-point; read-only.

47

After Effects Scripting Guide

JavaScript Reference

48

CameraLayer object
a pp. pro je c t .i tem ( in d e x) .l ayer(i n de x )
Description

The CameraLayer object represents a camera layers within a composition. Create it using the LayerCollection
objects a d dC am er a method; see LayerCollection addCamera() method on page 91. It can be accessed in an
items layer collection either by index number or by a name string.
CameraLayer is a subclass of Layer. All methods and attributes of Layer are available when working with

CameraLayer. See Layer object on page 81.


AE Properties

CameraLayer defines no additional attributes, but has different AE properties than other layer types. It has the
following properties and property groups:
Ma r ker
Tr an s for m
Poi n t of In teres t
Pos i t i on
S c al e
Orientation
X Rot at i on
Y Rot at i o n
Rot at i o n
O p a ci t y
C a m e r a O p t i on s
Zoom
D ep th of F i e ld
Foc u s D i st an ce
Blu r Le ve l

48

After Effects Scripting Guide

JavaScript Reference

49

Collection object
Like an array, a collection associates a set of objects or values as a logical group and provides access to them
by index. However, most collection objects are read-only. You do not assign objects to them yourselftheir
contents update automatically as objects are created or deleted.
The index numbering of a collection starts with 1, not 0.
Objects
Object

Reference

Description

ItemCol l ec t i on

ItemCollection object on page 77 All of the items (imported files, folders, solids, and so on) found in
the Project panel.

L ayer Co l l e c t i on

LayerCollection object on
page 90

All of the layers in a composition.

O MCol l ec t i on

OMCollection object on page 99

All of the Output Module items in the project.

RQ Item Col le c t ion

RenderQueueItem object on
page 150

All of the render-queue items in the project.

Attributes
length

The number of objects in the collection.

Methods
[]

Retrieves an object in the collection by its index number. The first object is at index 1.

49

After Effects Scripting Guide

JavaScript Reference

50

CompItem object
a pp. pro je c t .i tem ( i n d e x)
a pp. pro je c t .i tem s [ inde x ]
Description

The CompItem object represents a composition, and allows you to manipulate and get information about it.
Access the objects by position index number in a projects i te m collection.
CompItem is a subclass of AVItem, which is a subclass of Item. All methods and attributes of AVItem and

Item, in addition to those listed below, are available when working with CompItem. See AVItem object on
page 32 and Item object on page 74.
Example

Given that the first item in the project is a CompItem, the following code displays two alerts. The first shows
the number of layers in the CompItem, and the second shows the name of the last layer in the CompItem.
v ar f i r s t Co m p = a p p. p ro je c t .i te m ( 1 ) ;
a l er t ( " nu m b e r o f l ayer s i s " + f i r s t Co m p.num L aye r s ) ;
a l er t ( " n a m e o f l a s t l ayer i s " + f i r s t Co m p. l ayer ( f i r s t Com p.n u m L ayers ) . n a m e ) ;
Attributes
Attribute

Reference

f r a m eD ur a t i on

CompItem frameDuration attribute on The duration of a single frame.


page 53

wor k Area St ar t

CompItem workAreaStart attribute on The work area start time.


page 57

wor k Area D ur a ti on

CompItem workAreaDuration
attribute on page 56

The work area duration.

nu m L ayers

CompItem numLayers attribute on


page 54

The number of layers in the composition.

h id eS hy L ayers

CompItem hideShyLayers attribute on When true, shy layers are visible in the Timeline panel.
page 53

mo tionBlu r

CompItem motionBlur attribute on


page 54

When true, motion blur is enabled for this composition.

d r a ft 3 d

CompItem draft3d attribute on


page 52

When true, Draft 3D mode is enabled for the Composition panel.

f r a m e Bl e n di n g

CompItem frameBlending attribute on When true, time filtering is enabled for this composipage 52
tion.

preser veNeste d Fr a m eRa te

CompItem preserveNestedFrameRate
attribute on page 54

When true, the frame rate of nested compositions is


preserved.

preser veNeste d Resolut i on CompItem preserveNestedResolution

When true, the resolution of nested compositions is


preserved.

attribute on page 55

Description

b g Co lor

CompItem bgColor attribute on


page 51

The background color of the composition.

a c t iveC am er a

CompItem activeCamera attribute on


page 51

The current active camera layer.

d i sp l ay S ta r t Ti m e

CompItem displayStartTime attribute


on page 52

Changes the display of the start time in the Timeline


panel.

50

After Effects Scripting Guide

JavaScript Reference

51

Attribute

Reference

Description

res o lut i o n Fa c to r

CompItem resolutionFactor attribute


on page 55

The factor by which the x and y resolution of the Composition panel is downsampled.

s hu t ter A n g l e

CompItem shutterAngle attribute on


page 56

The camera shutter angle.

s hu t ter P h a se

CompItem shutterPhase attribute on


page 56

The camera shutter phase.

l ayer s

CompItem layers attribute on page 54 The layers of the composition.


LayerCollection object on page 90

s e l e c te d L ayer s

CompItem selectedLayers attribute on The selected layers of the composition.


page 56

s e l e c t e d Pro p e r t i e s

CompItem selectedProperties
attribute on page 56

The selected properties of the composition.

renderer

CompItem renderer attribute on


page 55

The rendering plugin module to be used to render


this composition.

renderers

CompItem renderers attribute on


page 55

The set of available rendering plugin modules.

Methods
Method

Reference

Description

du pl i c ate( )

CompItem duplicate() method on page 52

Creates and returns a duplicate of this composition.

l ayer ()

CompItem layer() method on page 53

Gets a layer from this composition.

CompItem activeCamera attribute


a pp. pro je c t .i tem ( in d e x) .a c t iveC am er a
Description

The active camera, which is the front-most camera layer that is enabled. The value is null if the composition
contains no enabled camera layers.
Type

CameraLayer object; read-only.

CompItem bgColor attribute


a pp. pro je c t .i tem ( in d e x) .b g Co l or
Description

The background color of the composition. The three array values specify the red, green, and blue components
of the color.
Type

An array containing three floating-point values, [R, G, B], in the range [0.0..1.0]; read/write.

51

After Effects Scripting Guide

JavaScript Reference

52

CompItem displayStartTime attribute


a pp. pro je c t .i tem ( in d e x) .d i sp l ay S ta r t Ti m e
Description

The time set as the beginning of the composition, in seconds. This is the equivalent of the Start Timecode or
Start Frame setting in the Composition Settings dialog box.
Type

Floating-point value in the range [0.0...86339.0] (1 second less than 25 hours); read/write.

CompItem draft3d attribute


a pp. pro je c t .i tem ( in d e x) .d r a ft 3 d
Description

When true, Draft 3D mode is enabled for the Composition panel. This corresponds to the value of the Draft
3D button in the Composition panel.
Type

Boolean; read/write.

CompItem duplicate() method


a pp. pro je c t .i tem ( in d e x) .d u p li c a te ( )
Description

Creates and returns a duplicate of this composition, which contains the same layers as the original.
Parameters

None.
Returns

CompItem object.

CompItem frameBlending attribute


a pp. pro je c t .i tem ( in d e x) .f r a m e Bl e n d in g
Description

When true, frame blending is enabled for this Composition. Corresponds to the value of the Frame Blending
button in the Composition panel.
Type

Boolean; if true, frame blending is enabled; read/write.

52

After Effects Scripting Guide

JavaScript Reference

53

CompItem frameDuration attribute


a pp. pro je c t .i tem ( in d e x) .f r a meD ur at i on
Description

The duration of a frame, in seconds. This is the inverse of the f r am e R a te value (frames-per-second).
Type

Floating-point; read/write.

CompItem hideShyLayers attribute


a pp. pro je c t .i tem ( in d e x) .h id eS hy L ayers
Description

When true, only layers with s hy set to false are shown in the Timeline panel. When false, all layers are visible,
including those whose shy value is true. Corresponds to the value of the Hide All Shy Layers button in the
Composition panel.
Type

Boolean; read/write.

CompItem layer() method


a pp. pro je c t .i tem ( in d e x) .l ayer (i n de x )
a pp. pro je c t .i tem ( in d e x) .l ayer (o t he rLaye r, re l In de x )
a pp. pro je c t .i tem ( in d e x) .l ayer (n a m e)
Description

Returns a Layer object, which can be specified by name, an index position in this layer, or an index position
relative to another layer.
Parameters
i n dex

The index number of the desired layer in this composition. An integer in the range [1...numLayers], where n u m Laye r s is the number of layers in the composition.

or
otherL ayer

A Layer object in this composition. The re lIn d ex value is added to the index value of this
layer to find the position of the desired layer.

rel In dex

The position of the desired layer, relative to o ther L ayer . An integer in the range [1oth erL ayer. in d ex . . . numLayerso ther L ayer.index ], where n u m Laye r s is the number of
layers in the composition.
This value is added to the otherL ayer value to derive the absolute index of the layer to
return.

or
name

The string containing the name of the desired layer.

53

After Effects Scripting Guide

JavaScript Reference

54

Returns

Layer object.

CompItem layers attribute


a pp. pro je c t .i tem ( in d e x) .l ayers
Description

A LayerCollection object that contains all the Layer objects for layers in this composition. See LayerCollection
object on page 90.
Type

LayerCollection object; read-only.

CompItem motionBlur attribute


a pp. pro je c t .i tem ( in d e x) .m o t io n B lu r
Description

When true, motion blur is enabled for the composition. Corresponds to the value of the Motion Blur button
in the Composition panel.
Type

Boolean; read/write.

CompItem numLayers attribute


a pp. pro je c t .i tem ( in d e x) .nu m L ayers
Description

The number of layers in the composition.


Type

Integer; read-only.

CompItem preserveNestedFrameRate attribute


a pp. pro je c t .i tem ( in d e x) .preser veNe ste d Fr a m eR ate
Description

When true, the frame rate of nested compositions is preserved in the current composition. Corresponds to the
value of the Preserve frame rate when nested or in render queue option in the Advanced tab of the Composition Settings dialog box.
Type

Boolean; read/write.

54

After Effects Scripting Guide

JavaScript Reference

55

CompItem preserveNestedResolution attribute


a pp. pro je c t .i tem ( in d e x) .preser veNe ste d Resolut i on
Description

When true, the resolution of nested compositions is preserved in the current composition. Corresponds to the
value of the Preserve resolution when nested option in the Advanced tab of the Composition Settings dialog
box.
Type

Boolean; read/write.

CompItem renderer attribute


a pp. pro je c t .i tem ( in d e x) .renderer
Description

The current rendering plugin module to be used to render this composition, as set in the Advanced tab of the
Composition > Composition Settings dialog box. Allowed values are the members of c o m p It e m . ren d erers .
Type

String; read/write.

CompItem renderers attribute


a pp. pro je c t .i tem ( in d e x) .renderers
Description

The available rendering plugin modules. Member strings reflect installed modules, as seen in the Advanced
tab of the Composition > Composition Settings dialog box.
Type

Array of strings; read-only.

CompItem resolutionFactor attribute


a pp. pro je c t .i tem ( in d e x) .res o lut i o n Fa c to r
Description

The x and y downsample resolution factors for rendering the composition.


The two values in the array specify how many pixels to skip when sampling; the first number controls
horizontal sampling, the second controls vertical sampling. Full resolution is [1,1], half resolution is [2,2], and
quarter resolution is [4,4]. The default is [1,1].
Type

Array of two integers in the range [1..99]; read/write.

55

After Effects Scripting Guide

JavaScript Reference

56

CompItem selectedLayers attribute


a pp. pro je c t .i tem ( in d e x) .s e l e c te d L ayer s
Description

All of the selected layers in this composition. This is a 0-based array (the first object is at index 0).
Type

Array of Layer objects; read-only.

CompItem selectedProperties attribute


a pp. pro je c t .i tem ( in d e x) .s e l e c t e d Pro p e r t i e s
Description

All of the selected properties (Property and PropertyGroup objects) in this composition. The first property is
at index position 0.
Type

Array of Property and PropertyGroup objects; read-only.

CompItem shutterAngle attribute


a pp. pro je c t .i tem ( in d e x) .s hu t ter A n g l e
Description

The shutter angle setting for the composition. This corresponds to the Shutter Angle setting in the Advanced
tab of the Composition Settings dialog box.
Type

Integer in the range [0...720]; read/write.

CompItem shutterPhase attribute


a pp. pro je c t .i tem ( in d e x) .s hu t ter P h a se
Description

The shutter phase setting for the composition. This corresponds to the Shutter Phase setting in the Advanced
tab of the Composition Settings dialog box.
Type

Integer in the range [360...360]; read/write.

CompItem workAreaDuration attribute


a pp. pro je c t .i tem ( in d e x) .wor k Area D ur a t ion
Description

The duration of the work area in seconds. This is the difference of the start-point and end-point times of the
Composition work area.

56

After Effects Scripting Guide

JavaScript Reference

57

Type

Floating-point; read/write.

CompItem workAreaStart attribute


a pp. pro je c t .i tem ( in d e x) .wor k Area St ar t
Description

The time when the Composition work area begins, in seconds.


Type

Floating-point; read/write.

57

After Effects Scripting Guide

JavaScript Reference

58

FileSource object
a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce
a pp. pro je c t .i tem ( in d e x) .p roxySo urce
Description

The FileSource object describes footage that comes from a file.


FileSource is a subclass of FootageSource. All methods and attributes of FootageSource, in addition to those

listed below, are available when working with FileSource. See FootageSource object on page 65.
Attributes
Attribute

Reference

Description

f i le

FileSource file attribute on page 58

The file that defines this asset.

m i s s i n g Fo ot a g e Pat h

FileSource missingFootagePath attribute The file that contains footage missing from this asset.
on page 58

Methods
Method

Reference

Description

rel o a d ()

FileSource reload() method on page 59

Reloads the asset from the file, if it is a m a in S o u rce of


a FootageItem.

FileSource file attribute


a pp. pro je c t .i tem ( i n d e x) .m a i n S o u rce .f il e
a pp. pro je c t .i tem ( i n d e x) .p roxy S o u rce . fi l e
Description

The ExtendScript File object for the file that defines this asset. To change the value:
If this FileSource is a prox y S ource of an AVItem, call s e t Prox y ( ) or se tProx y Wi th S equ ence( ) .
If this FileSource is a m a i n S o u rce of a FootageItem, call rep l ace( ) or repla ceWith S equence() .
Type

File object; read-only.

FileSource missingFootagePath attribute


a pp. pro je c t .i tem ( i n d e x) . m a i n S o u rce . f il e .m i s s i n g Fo o t a g e Pat h
a pp. pro je c t .i tem ( i n d e x) .p roxy S o u rce . fi l e .m is s in g Fo o t ag e Pa th
Description

The path and filename of footage that is missing from this asset. See also AVItem footageMissing attribute
on page 33.
Type

String; read-only.

58

After Effects Scripting Guide

JavaScript Reference

59

FileSource reload() method


a pp. pro je c t .i tem ( i n d e x) . m a i n S o u rce . f il e .m a i n S o u rce. re l o ad ( )
Description

Reloads the asset from the file. This method can be called only on a m a i n S o u rce , not a p roxy S o u rce .
Parameters

None.
Returns

Nothing.

59

After Effects Scripting Guide

JavaScript Reference

60

FolderItem object
a pp. pro je c t .FolderItem
Description

The FolderItem object corresponds to a folder in your Project panel. It can contain various types of items
(footage, compositions, solids) as well as other folders.
Example

Given that the second item in the project is a FolderItem, the following code puts up an alert for each top-level
item in the folder, showing that items name.
v ar secondItem = app.proj ec t. item(2 );
if ( !(secondItem inst anceof Fo lderItem) ) {
a l er t( "problem: se cond item is no t a folder");
} else {
for ( i = 1 ; i <= s econd Item.nu m Item s; i + + ) {
a l er t ( " i tem nu m b e r " + i + " w i t h i n t h e f o l d e r i s n a m e d "
+ se cond Item .item( i) .n ame) ;
}
}
Attributes
Attribute

Reference

Description

i te m s

FolderItem items attribute on page 61

The contents of this folder.

nu m Item s

FolderItem numItems attribute on page 61

The number of items contained in the folder.

Method

Reference

Description

i te m ( )

FolderItem item() method on page 60

Gets an item from the folder.

Methods

FolderItem item() method


a pp. pro je c t .i tem ( i n d e x) .i te m
Description

Returns the top-level item in this folder at the specified index position. Note that top-level here means toplevel within the folder, not necessarily within the project.
Parameters
i n dex

An integer, the position index of the item to retrieve. The first item is at index 1.

Returns

Item object.

60

After Effects Scripting Guide

JavaScript Reference

61

FolderItem items attribute


a pp. pro je c t .i tem ( i n d e x) .i te m s
Description

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

ItemCollection object; read only.

FolderItem numItems attribute


a pp. pro je c t .i tem ( i n d e x) . nu m It e m s
Description

The number of items contained in the i te m s collection (fold e r Ite m .item s. l en gth ).
If the folder contains another folder, only the FolderItem for that folder is counted, not any subitems
contained in it.
Type

Integer; read only.

61

After Effects Scripting Guide

JavaScript Reference

62

FootageItem object
a pp. pro je c t .i tem ( i n d e x)
a pp. pro je c t .i tem s [ inde x ]
Description

The FootageItem object represents a footage item imported into a project, which appears in the Project panel.
These are accessed by position index number in a projects i tem collection.
FootageItem is a subclass of AVItem, which is a subclass of Item. All methods and attributes of AVItem and

Item, in addition to those listed below, are available when working with FootageItem. See AVItem object
on page 32 and Item object on page 74.
Attributes
Attribute

Reference

Description

f i le

FootageItem file attribute on page 62

The footage source file.

m a i n S o u rce

FootageItem mainSource attribute on page 63

All settings related to the footage item.

Methods
Method

Reference

Description

rep l ace( )

FootageItem replace() method on


page 63

Replaces a footage file with another footage file.

replaceWit hP laceho lder( )

FootageItem replaceWithPlaceholder() Replaces a footage file with a placeholder object.


method on page 63

replaceWit hSe quence()

FootageItem replaceWithSequence()
method on page 64

Replaces a footage file with an image sequence.

rep l a ce Wi t h S o l i d ()

FootageItem replaceWithSolid()
method on page 64

Replaces a footage file with a solid.

FootageItem file attribute


a pp. pro je c t .i tem ( i n d e x) .f i l e
Description

The ExtendScript File object for the footage's source file.


If the FootageItem's m a i n S o u rce is a FileSource, this is the same as Fo ot a geIte m . m a i n S o u rce .f il e . Otherwise
it is null.
Type

File object; read only.

62

After Effects Scripting Guide

JavaScript Reference

63

FootageItem mainSource attribute


a pp. pro je c t .i tem ( in d e x) .m a i n S o u rce
Description

The footage source, an object that contains all of the settings related to that footage item, including those that
are normally accessed through the Interpret Footage dialog box. The attribute is read-only. To change its value,
call one of the FootageItem replace methods.
See the FootageSource object on page 65, and its three types:
SolidSource object on page 162
FileSource object on page 58
PlaceholderSource object on page 103

If this is a FileSource object, and the f o o t a g e M i s s i n g value is true, the path to the missing footage file is in the
F i l e S o u rce.m is s in g Fo o t ag e Pa th attribute. See AVItem footageMissing attribute on page 33 and FileSource

missingFootagePath attribute on page 58.


Type

FootageSource object; read-only.

FootageItem replace() method


a pp. pro je c t .i tem ( in d e x) .rep lace( file )
Description

Changes the source of this FootageItem to the specified file. In addition to loading the file, the method creates
a new FileSource object for the file and sets m a i n S o u rce to that object. In the new source object, it sets the
n a m e , w i d th , heig ht , f r a m eD ur a t i on , and du r at i on attributes (see AVItem object on page 32) based on the
contents of the file.
The method preserves interpretation parameters from the previous m a in S o u rce object. If the specified file has
an unlabeled alpha channeI, the method estimates the alpha interpretation.
Parameters
file

An ExtendScript File object for the file to be used as the footage main source.

FootageItem replaceWithPlaceholder() method


a pp. pro je c t .i tem ( in d e x) .replaceWit hPla ceho l der( n am e , w id t h, he i g ht, fra m eR a te , d ura t i on )
Description

Changes the source of this FootageItem to the specified placeholder. Creates a new PlaceholderSource object,
sets its values from the parameters, and sets m a in S o u rce to that object.
Parameters
name

A string containing the name of the placeholder.

w i dt h

The width of the placeholder in pixels, an integer in the range [4..30000].

h eig h t

The height of the placeholder in pixels, an integer in the range [4..30000].

63

After Effects Scripting Guide

JavaScript Reference

64

f r a m eRa te

The frame rate of the placeholder, a floating-point value in the range [1.0..99.0]

du r at i on

The duration of the placeholder in seconds, a floating-point value in the range [0.0..10800.0].

FootageItem replaceWithSequence() method


a pp. pro je c t .i tem ( in d e x) .replaceWit hSe quence( f i l e , fo rce Al p h a b e t i c a l )
Description

Changes the source of this FootageItem to the specified image sequence. In addition to loading the file, the
method creates a new FileSource object for the file and sets m a i n S o u rce to that object. In the new source
object, it sets the n am e , w id t h , h ei g h t , fr ameD u r at ion , and dur a t i on attributes (see AVItem object on
page 32) based on the contents of the file.
The method preserves interpretation parameters from the previous m a in S o u rce object. If the specified file has
an unlabeled alpha channeI, the method estimates the alpha interpretation.
Parameters
file

An ExtendScript File object for the first file in the sequence to be used as the footage main source.

force Alp ha b e t ic a l

When true, use the Force alphabetical order option.

FootageItem replaceWithSolid() method


a pp. pro je c t .i tem ( in d e x) . re p l a ceWit h S o l i d ( colo r, n am e , w idt h, h e ig ht, pi xe l As p e c t)
Description

Changes the source of this FootageItem to the specified solid. Creates a new SolidSource object, sets its values
from the parameters, and sets m a i n S o u rce to that object.
Parameters
co lor

The color of the solid, an array of three floating-point values, [R, G, B], in the range [0.0..1.0].

name

A string containing the name of the solid.

w i dt h

The width of the solid in pixels, an integer in the range [4..30000].

h eig h t

The height of the solid in pixels, an integer in the range [4..30000].

p i xel As p e c t

The pixel aspect ratio of the solid, a floating-point value in the range [0.01..100.0].

64

After Effects Scripting Guide

JavaScript Reference

65

FootageSource object
a pp. pro je c t .i tem ( in d e x) .m a i n S o u rce
a pp. pro je c t .i tem ( in d e x) .p roxySo urce
Description

The FootageSource object holds information describing the source of some footage. It is used as the
m a i n S o u rce of a FootageItem, or the prox y S ou rce of a CompItem or FootageItem. See FootageItem object
on page 62 and CompItem object on page 50.
FootageSource is the base class for SolidSource, so FootageSource attributes and methods are available

when working with SolidSource objects. See SolidSource object on page 162.
Attributes
Attribute

Reference

Description

h as Al p ha

FootageSource hasAlpha attribute on When true, a footage clip or proxy includes an


page 68
alpha channel.

a l pha Mod e

FootageSource alphaMode attribute


on page 66

premu l Col or

FootageSource premulColor attribute The color to be premultiplied.


on page 69

i nver t A l pha

FootageSource invertAlpha attribute


on page 68

When true, an alpha channel in a footage clip or


proxy should be inverted.

i s St i l l

FootageSource isStill attribute on


page 68

When true, footage is a still image.

f i e l d S e p a r a t i on Ty p e

FootageSource fieldSeparationType
attribute on page 67

The field separation type.

h ig hQ ua l it y F ie l dS epa r a ti on

FootageSource highQualityFieldSeparation attribute on page 68

How the fields are to be separated in non-still footage.

rem ovePu l l dow n

FootageSource removePulldown
attribute on page 69

The pulldown type for the footage.

l o op

FootageSource loop attribute on


page 69

How many times an image sequence is set to loop.

n a t iveFr a m e R a te

FootageSource nativeFrameRate
attribute on page 69

The native frame rate of the footage.

d i sp l ay Fr am e R ate

FootageSource displayFrameRate
attribute on page 66

The effective frame rate as displayed and rendered


in compositions by After Effects.

con f or m Fr a m e R a te

FootageSource conformFrameRate
attribute on page 66

The rate to which footage should conform.

The mode of an alpha channel.

Methods
Method

Reference

Description

gu essAlph aMo de()

FootageSource guessAlphaMode()
method on page 67

Estimates the alp haMo de setting.

g u e ss Pu l l dow n ()

FootageSource guessPulldown()
method on page 67

Estimates the p u l ldow n Ty p e setting.

65

After Effects Scripting Guide

JavaScript Reference

66

FootageSource alphaMode attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .alp haMo de
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. alph aMo de
Description

The alphaMode attribute of footageSource defines how the alpha information in the footage is to be interpreted. If hasAlpha is false, this attribute has no relevant meaning.
Type

An Alpha Mode enumerated value; (read/write). One of:


Alph aMo de. IGNOR E
Alph aMo de. STRAI GH T
Alph aMo de. PR EMU LTIPLIED

FootageSource conformFrameRate attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .con for m Fr am eRa te
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. confor mFr ameR ate
Description

A frame rate to use instead of the n a t ive Fr a m e R a te value. If set to 0, the n a t iveFr a m e R a te is used instead.
It is an error to set this value if Fo o t a g e S o urce . i s S t i l l is true. It is an error to set this value to 0 if rem ove Pul l dow n is not set to Pu l l dow n P h a se . O F F. If this is 0 when you set rem ovePul ld ow n to a value other than
Pul l dow n Ph a s e . O F F, then this is automatically set to the value of n a t iveFr a m e Ra te .
Type

Floating-point value in the range [0.0 .. 99.0]; read/write.

FootageSource displayFrameRate attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .d is p l ay Fr a m e R ate
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. di s pl ay Fr ame Ra te
Description

The effective frame rate as displayed and rendered in compositions by After Effects.
If rem ove Pul l dow n is Pu l l dow n P h a s e . O F F, then this is the same as the con fo r m Fr a m e R ate (if non-zero) or
the n a t iveFr a m e R a te (if con f o r m Fr a m e R ate is 0). If rem ovePu l l dow n is not Pu l l dow n P h a se . O F F, this is
con f o r m Fr a m e R a te * 0.8, the effective frame rate after removing 1 of every 5 frames.
Type

Floating-point value in the range [0.0 .. 99.0]; read-only.

66

After Effects Scripting Guide

JavaScript Reference

67

FootageSource fieldSeparationType attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .f ie l d S epa r a t ion Ty p e
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. fie ld S ep ar at ionTy p e
Description

How the fields are to be separated in non-still footage.


It is an error to set this attribute if i s S t il l is true. It is an error to set this value to F i e l d S e p a r a t i on Ty p e .O FF if
rem ovePu l l dow n is not Pu l l dow n P h a se . O F F.
Type

A F ie l dS epa r a ti on Ty p e enumerated value; read/write. One of:


F i e l d S e p a r a t i o n Ty p e . N O N E
F i e l d S e p a r a t i o n Ty p e . U PPE R _ F I E L D _ F I R S T
F i e l d S e p a r a t i o n Ty p e . LOW E R _ F I E L D _ F I R S T

FootageSource guessAlphaMode() method


a pp. pro je c t .i tem ( in d e x) .m a i n S ource .g ue ss Al pha Mod e( )
a pp. pro je c t .i tem ( in d e x) .proxySo urce. g uessAlphaMo de ()
Description

Sets a lp ha Mode , premu l Col or, and inver tAl ph a to the best estimates for this footage source. If h as Al p ha is
false, no change is made.
Parameters

None.
Returns

Nothing.

FootageSource guessPulldown() method


a pp. pro je c t .i tem ( in d e x) .m a i n S ource .g ue ss Pu l l dow n ( m e t ho d )
a pp. pro je c t .i tem ( in d e x) . p rox y S o u rc e . g u e s s Pu l l d ow n (m e t h o d )
Description

Sets f i e l d S e p a r a t i o n Ty p e and rem ove Pul l dow n to the best estimates for this footage source. If i s S t il l is true,
no change is made.
Parameters
method

The method to use for estimation. A Pul l dow n Met ho d enumerated value, one of:

Pul l d ow n Met h o d. PU L L D OW N _ 3 _ 2
Pul l dow n Met ho d. ADVANCE _24P
Returns

Nothing.

67

After Effects Scripting Guide

JavaScript Reference

68

FootageSource hasAlpha attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .ha sAlph a
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. hasAlpha
Description

When true, the footage has an alpha component. In this case, the attributes a lp ha Mode , i nver t A lp h a , and
premu l Col or have valid values. When false, those attributes have no relevant meaning for the footage.
Type

Boolean; read-only.

FootageSource highQualityFieldSeparation attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .h i g hQ u a l i t y F i e l dS e p a r a t i o n
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. h i g h Qu a l i t y F i e l d S e p a r a t i on
Description

When true, After Effects uses special algorithms to determine how to perform high-quality field separation.
It is an error to set this attribute if i sS t i l l is true, or if f i e l d S e p a r a t i o n Ty p e is F i e l d S e p a r a t i o n Ty p e .O F F.
Type

Boolean; read/write.

FootageSource invertAlpha attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .i nver t Al p h a
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. inver tAl ph a
Description

When true, an alpha channel in a footage clip or proxy should be inverted.


This attribute is valid only if an alpha is present. If ha sAlpha is false, or if alp haMo de is A l p h a Mo de .I G N O R E ,
this attribute is ignored.
Type

Boolean; read/write.

FootageSource isStill attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .i sS t i l l
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. is S t il l
Description

When true the footage is still; when false, it has a time-based component.
Examples of still footage are JPEG files, solids, and placeholders with duration of 0. Examples of non-still
footage are movie files, sound files, sequences, and placeholders of non-zero duration.
Type

Boolean; read-only.

68

After Effects Scripting Guide

JavaScript Reference

69

FootageSource loop attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .l o o p
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. lo op
Description

The number of times that the footage is to be played consecutively when used in a composition.
It is an error to set this attribute if i sS t i l l is true.
Type

Integer in the range [1.. 9999]; default is 1; read/write.

FootageSource nativeFrameRate attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .nat iveFr ame Rate
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. n a t iveFr a m e R a te
Description

The native frame rate of the footage.


Type

Floating-point; read/write.

FootageSource premulColor attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .premul Co l or
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. premul Col or
Description

The color to be premultiplied. This attribute is valid only if the a l pha Mod e is a l pha Mo de .P R E M ULT I P L I E D .
Type

Array of four floating-point values [ R , G , B, A ] , in the range [0.0..1.0]; read/write.

FootageSource removePulldown attribute


a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce .rem ove Pu l l dow n
a pp. pro je c t .i tem ( in d e x) .p roxySo urce. rem ovePul l dow n
Description

How the pulldowns are to be removed when field separation is used.


It is an error to set this attribute if i sS t i l l is true. It is an error to attempt to set this to a value other than
Pul l dow n Ph a s e . O F F in the case where f i e l d S e p a r a t i o n Ty p e is F i e l d S e p a r a t i o n Ty p e .O F F.
Type

A Pul l dow n P has e enumerated value; read/write. One of:


Pul l dow n Ph a s e . Re m ove Pu l l dow n . O F F
Pul l dow n Ph a s e . Re m ove Pu l l dow n . WS S W W
Pul l dow n Ph a s e . Re m ove Pu l l dow n . S S W W W

69

After Effects Scripting Guide

JavaScript Reference

70

Pul l dow n Ph a s e . Re m ove Pu l l dow n . S W W WS


Pul l dow n Ph a s e . Re m ove Pu l l dow n . W W WSS
Pul l dow n Ph a s e . Re m ove Pu l l dow n . W WS S W
Pul l dow n Ph a s e . Re m ove Pu l l dow n . WS S W W _ 2 4 P_ A DVA N C E
Pul l d ow n Ph a s e . Re m ove Pu l l d ow n . S S W W W _ 2 4P _ A DVAN C E
Pul l dow n Ph a s e . Re m ove Pu l l dow n . S W W WS _ 2 4 P_ A DVA N C E
Pul l dow n Ph a s e . Re m ove Pu l l dow n . W W WSS _ 2 4 P_ A DVA N C E
Pul l dow n Ph a s e . Re m ove Pu l l dow n . W WS S W _ 2 4 P_ A DVA N C E

70

After Effects Scripting Guide

JavaScript Reference

71

ImportOptions object
n e w Im p o r t O p t i on s ( ) ;
n e w Im p o r t O p t i on s ( file ) ;
Description

The ImportOptions object encapsulates the options used to import a file with the Proj ec t. i m p or t F il e
methods. See Project importFile() method on page 107.
The constructor takes an optional parameter, an ExtendScript File object for the file. If it is not supplied, you
must explicitly set the value of the f i l e attribute before using the object with the i m p o r tF i l e method. For
example:
n e w Im p o r t O p t i on s ( ) . f i l e = n e w F i l e ( "my f i le . p s d " ) ;
Attributes
Attributes

Reference

Description

i m p o r tAs

ImportOptions importAs attribute on


page 72

The type of file to be imported.

s e qu e n ce

ImportOptions sequence attribute on


page 73

When true, import a sequence of files, rather than an individual file.

force Alp ha b e ti c a l

ImportOptions forceAlphabetical
attribute on page 72

When true, the Force alphabetical order option is set.

f i le

ImportOptions file attribute on


page 72

The file to import, or the first file of the sequence to import.

Methods
Method

Reference

Description

c a n Im p or t As ( )

ImportOptions canImportAs() method Restricts input to a particular file type.


on page 71

ImportOptions canImportAs() method


imp or t O p t i ons . c a n Im p or t As( t y p e)
Description

Reports whether the file can be imported as the source of a particular object type. If this method returns true,
you can set the given type as the value of the i m p o r tAs attribute. See ImportOptions importAs attribute on
page 72.
Parameters
type

The type of file that can be imported. An Im p or tAs Ty p e

enumerated value; one of:

Im p o r t AsTy p e . C OM P
Im p o r t AsTy p e . F O OTAG E
Im p o r t AsTy p e . C OM P_ C ROP PE D_ L AY E R S
Im p o r t AsTy p e . PRO J E C T

71

After Effects Scripting Guide

JavaScript Reference

72

Returns

Boolean.
Example
v ar i o = n e w Im p o r t O p ti o n s ( F i l e ( c :\ \ my F i l e . ps d )) ;
i f io. c an Im p or t As ( Im p or tAs Ty p e.C O MP ) ;
i o.i m p o r tAs = Im p o r tAs Ty p e.C O M P;

ImportOptions file attribute


imp or t O p t i ons . f i l e
Description

The file to be imported. If a file is set in the constructor, you can access it through this attribute.
Type

ExtendScript File object; read/write.

ImportOptions forceAlphabetical attribute


imp or t O p t i ons .f orce Al pha b e t ic a l
Description

When true, has the same effect as setting the Force alphabetical order option in the File > Import > File
dialog box.
Type

Boolean; read/write.

ImportOptions importAs attribute


imp or t O p t i ons .imp or tAs
Description

The type of object for which the imported file is to be the source. Before setting, use can Im p or tAs to check
that a given file can be imported as the source of the given object type. See ImportOptions canImportAs()
method on page 71.
Type

An Im p o r t AsTy p e enumerated value; read/write. One of:


Im p o r tAs Ty p e .C O M P _ C RO PPE D _ L AYE R S
Im p o r tAs Ty p e .F O OTAG E
Im p o r tAs Ty p e .C O M P
Im p o r tAs Ty p e .P ROJ E C T

72

After Effects Scripting Guide

JavaScript Reference

73

ImportOptions sequence attribute


imp or t O p t i ons .s e quence
Description

When true, a sequence is imported; otherwise, an individual file is imported.


Type

Boolean; read/write.

73

After Effects Scripting Guide

JavaScript Reference

74

Item object
a pp. pro je c t .i tem ( i n dex )
a pp. pro je c t .i te m s [ in d ex ]
Description

The Item object represents an item that can appear in the Project panel.
The first item is at index 1.
Item is the base class for AVItem and for FolderItem, which are in turn the base classes for various other

item types, so Item attributes and methods are available when working with all of these item types. See
AVItem object on page 32 and FolderItem object on page 60.
Attributes
Attributes

Reference

Description

name

Item name attribute on page 75

The name of the object as shown in the Project panel.

com m e n t

Item comment attribute on page 75

A descriptive string.

id

Item id attribute on page 75

A unique identifier for this item.

p aren tFol de r

Item parentFolder attribute on page 75

The parent folder of this item.

s e l e c te d

Item selected attribute on page 76

When true, this item is currently selected.

t y p e Na m e

Item typeName attribute on page 76

The type of item.

Method

Reference

Description

rem ove( )

Item remove() method on page 76

Deletes the item from the project.

Methods

Example

This example gets the second item from the project and checks that it is a folder. It then removes from the
folder any top-level item that is not currently selected. It also checks to make sure that, for each item in the
folder, the parent is properly set to the correct folder.
v ar my Folder = a pp.proje c t.item (2);
i f (my Fo ld e r. t y p e Nam e ! = " Fo l d e r " ) {
a l er t( " e r ro r : s e con d i te m i s n o t a fo ld e r " );
}
e l se {
v ar nu mInFolder = my Fo lder.numItems;
/ / A lw ay s r u n l o o p s b a ck wa rds w h en del e t i n g th i n g s:
f o r ( i = n u m In Fo l d e r ; i > = 1 ; i- - ) {
v ar c ur Item = my Fol d er. item (i ) ;
i f ( c ur Item .p aren tFol der != myFol der ) {
a l er t( " er ro r w i thi n A E : t he p aren t Fol d er is n o t s et cor re c t ly " ) ;
}
e l se {
i f ( ! c u rIte m . s e l e c t e d & & c u r Item . t y p eNam e = = " Fo ot a g e " ) {
/ / A h a ! an u n s e l e c te d so li d .
c u r Item . rem ove ( ) ;

74

After Effects Scripting Guide

JavaScript Reference

75

}
}
}
}

Item comment attribute


a pp. pro je c t .i tem ( in d e x) .com m en t
Description

A string that holds a comment, up to 15,999 bytes in length after any encoding conversion. The comment is
for the user's purpose only; it has no effect on the item's appearance or behavior.
Type

String; read/write.

Item id attribute
a pp. pro je c t .i tem ( in d e x) .i d
Description

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

Integer; read-only.

Item name attribute


a pp. pro je c t .i te m ( i n dex ) .n a m e
Description

The name of the item as displayed in the Project panel.


Type

String; read/write.

Item parentFolder attribute


a pp. pro je c t .i tem ( in d e x) .p aren t Fol d er
Description

The FolderItem object for the folder that contains this item. If this item is at the top level of the project, this
is the project's root folder (a p p.p ro je c t .ro o t Fol d e r ). You can use the ItemCollections ad d Fo l d e r method to
add a new folder, and set this value to put items in the new folder. See ItemCollection addFolder() method
on page 77.

75

After Effects Scripting Guide

JavaScript Reference

76

Type

FolderItem object; read/write.


Example

This script creates a new FolderItem in the Project panel and moves compositions into it.
/ / c re a t e a n e w Fol d e r Ite m i n p ro j e c t , w i t h n a m e co m p s
v ar compFolder = app.proj ec t. items. a ddFo l der(com ps );
/ / m ove a l l com p o s i t i o n s i n t o n e w f o l d e r by s e t t in g
/ / com p Ite ms p a ren t Fol d e r to com p s f o l d e r
for ( v a r i = 1 ; i <= a p p.p ro j e c t . num Item s ; i + +) {
i f (a pp. pro j e c t . i tem ( i ) i n s ta n ce o f C om pIte m )
a pp. pro je c t .i tem( i ). pa rent Fol der = compFol d er ;
}

Item remove() method


a pp. pro je c t .i tem ( in d e x) .remove()
Description

Deletes this item from the project and from the Project panel. If the item is a FolderItem, all the items
contained in the folder are also removed from the project. No files or folders are removed from disk.
Parameters

None.
Returns

Nothing.

Item selected attribute


a pp. pro je c t .i tem ( in d e x) .s e l e c te d
Description

When true, this item is selected. Multiple items can be selected at the same time. Set to true to select the item
programmatically, or to false to deselect it.
Type

Boolean; read/write.

Item typeName attribute


a pp. pro je c t .i tem ( in d e x) .t y p eNam e
Description

A user-readable name for the item type; for example, Folder, Footage, or Composition.
Type

String; read-only.

76

After Effects Scripting Guide

JavaScript Reference

77

ItemCollection object
a pp. pro je c t .i tem s
Description

The ItemCollection object represents a collection of items. The ItemCollection belonging to a Project object
contains all the Item objects for items in the project. The ItemCollection belonging to a FolderItem object
contains all the Item objects for items in that folder.
ItemCollection is a subclass of Collection. All methods and attributes of Collection, in addition to those

listed below, are available when working with ItemCollection. See Collection object on page 49.
Methods
Method

Reference

Description

a d dCom p ( )

ItemCollection addComp() method on


page 77

Creates a new CompItem object and adds it to the collection.

a d dFol der( )

ItemCollection addFolder() method on


page 77

Creates a new FolderItemobject and adds it to the collection.

ItemCollection addComp() method


a pp. pro j e c t . i te m Co l l e c t i o n.a d dCom p ( n am e , w id t h, he i g ht, pi xe l As p e c t, du ra t io n , fram e R ate )
Description

Creates a new composition. Creates and returns a new CompItem object and adds it to this collection.
If the ItemCollection belongs to the project or the root folder, then the new items p aren tFol de r is the root
folder. If the ItemCollection belongs to any other folder, the new items pa ren tFol der is that Fol d erItem .
Parameters
name

A string containing the name of the composition.

w i dt h

The width of the composition in pixels, an integer in the range [4..30000].

h eig h t

The height of the composition in pixels, an integer in the range [4..30000].

p i xel As p e c t

The pixel aspect ratio of the composition, a floating-point value in the range [0.01..100.0].

du r at i on

The duration of the composition in seconds, a floating-point value in the range [0.0..10800.0].

f r a m eRa te

The frame rate of the composition, a floating-point value in the range [1.0..99.0]

Returns

CompItem object.

ItemCollection addFolder() method


a pp. pro j e c t . i te m Co l l e c t i o n.a d dFol der( n a m e )
Description

Creates a new folder. Creates and returns a new FolderItem object and adds it to this collection.

77

After Effects Scripting Guide

JavaScript Reference

78

If the ItemCollection belongs to the project or the root folder, then the new folders pa ren tFol der is the root
folder. If the ItemCollection belongs to any other folder, the new folders p a ren t Fol d e r is that FolderItem .
To put items in the folder, set the item objects p aren tFol de r attribute; see Item parentFolder attribute on
page 75.
Parameters
name

A string containing the name of the folder.

Returns

FolderItem object.
Example

This script creates a new FolderItem in the Project panel and moves compositions into it.
/ / c re a t e a n e w Fol d e r Ite m i n p ro j e c t , w i t h n a m e co m p s
v ar compFolder = app.proj ec t. items. a ddFo l der(com ps );
/ / m ove a l l com p o s i t i o n s i n t o n e w f o l d e r by s e t t in g
/ / com p Ite ms p a ren t Fol d e r to com p s f o l d e r
for ( v a r i = 1 ; i <= a p p.p ro j e c t . num Item s ; i + +) {
i f (a pp. pro j e c t . i tem ( i ) i n s ta n ce o f C om pIte m )
a pp. pro je c t .i tem( i ). pa rent Fol der = compFol d er ;
}

78

After Effects Scripting Guide

JavaScript Reference

79

KeyframeEase object
my Ke y = n ew Ke y f r am e E as e( s p e e d, i n f l u e n c e );
Description

The KeyframeEase object encapsulates the keyframe ease settings of a layers AE property. There are two types
of ease, temporal and spatial, which are determined by the speed and influence settings. Both types are set
using the propertys s e t Te m p o r al E as e AtKe y method. See Property setTemporalEaseAtKey() method on
page 131.
The constructor creates a KeyframeEase object. Both parameters are required.
s p e e d : A floating-point value. Sets the sp ee d attribute.
i n f lu en ce : A floating-point value in the range [0.1..100.0]. Sets the in f lu en ce attribute.

Example

This example assumes that the Position, a spatial property, has more than two keyframes.
v ar e a s e In = n e w Ke y fr am e E as e ( 0 .5 , 5 0 ) ;
v ar e a s e Out = n e w Ke y fr am e E as e ( 0 .7 5 , 8 5 ) ;
v ar my Pos i t i o n Pro p e r t y = a p p. p ro je c t . i te m ( 1) .l ayer (1 ).p rop er t y (" Po si t i on " )
my Pos i t i o n Pro p e r t y. se tTem p o r a l E as e At Ke y ( 2 , [ e a se In ], [ e a se Ou t ] ) ;

This example sets the Scale, a temporal property with two dimensions. For 2D and 3D properties you must
set an e as eIn and and easeO ut value for each dimension:
v ar e a s e In = n e w Ke y fr am e E as e ( 0 .5 , 5 0 ) ;
v ar e a s e Out = n e w Ke y fr am e E as e ( 0 .7 5 , 8 5 ) ;
v ar my S c a l e Prop e r t y = a p p. p ro je c t .i te m ( 1 ) . l ayer (1 ) . p rop e r t y ( " S c a l e " )
my Sca l eProp er t y.se tTempor alEa s eAt Ke y (2, [ea se In, ea seIn , easeIn ], [ea seO ut, ea seO ut , ea se Out ]);
Attributes
Attribute

Reference

Description

speed

KeyframeEase speed attribute on page 80

The speed setting for a keyframe.

i n f lu e n ce

KeyframeEase influence attribute on page 79

The influence setting for a keyframe.

KeyframeEase influence attribute


my Ke y. in flu en ce
Description

The influence value of the keyframe, as shown in the Keyframe Velocity dialog box.
Type

Floating-point value in the range [0.1..100.0]; read/write.

79

After Effects Scripting Guide

JavaScript Reference

80

KeyframeEase speed attribute


my Ke y. sp ee d
Description

The speed value of the keyframe. The units depend on the type of keyframe, and are displayed in the Keyframe
Velocity dialog box.
Type

Floating-point value; read/write.

80

After Effects Scripting Guide

JavaScript Reference

81

Layer object
a pp. pro je c t .i tem ( in d e x) .l ayer(i n de x )
Description

The Layer object provides access to layers within compositions. It can be accessed from an items layer
collection either by index number or by a name string.
Layer is the base class for CameraLayer, TextLayer, LightLayer, and AVLayer, so Layer attributes and

methods are available when working with all layer types. See AVLayer object on page 39,
CameraLayer object on page 48, LightLayer object on page 94, and TextLayer object on page 166.
Layers contain AE properties, in addition to their JavaScript attributes and methods. For examples of how to
access properties in layers, see PropertyBase object on page 135.
Example

If the first item in the project is a CompItem, this example disables the first layer in that composition and
renames it. This might, for example, turn an icon off in the composition.
v ar f i r s t L aye r = a p p. p ro je c t .i te m ( 1 ) . l ayer (1 ) ;
f i r st L aye r.en a bl e d = f al s e ;
first L ayer.na m e = "D isa ble d Layer";
Attributes
Attribute

Reference

Description

i n dex

Layer index attribute on page 85

The index position of the layer.

name

Layer name attribute on page 87

The name of the layer.

p aren t

Layer parent attribute on page 87

The parent of this layer.

time

Layer time attribute on page 89

The current time of the layer.

s ta r t Ti m e

Layer startTime attribute on page 89

The start time of the layer.

s t retch

Layer stretch attribute on page 89

The time stretch percentage of the layer.

i n Poi n t

Layer inPoint attribute on page 85

The in point of the layer.

o u t Po i n t

Layer outPoint attribute on page 87

The out point of the layer.

e n a bl e d

Layer enabled attribute on page 84

When true, the layer is enabled.

solo

Layer solo attribute on page 89

When true, the layer is soloed.

s hy

Layer shy attribute on page 88

When true, the layer is shy.

l o cke d

Layer locked attribute on page 85

When true, the layer is locked.

h as Vi de o

Layer hasVideo attribute on page 84

When true, the layer contains a video component.

a c t ive

Layer active attribute on page 82

When true, the layer is active at the current time.

nu l l L aye r

Layer nullLayer attribute on page 87

When true, this is a null layer.

s e l e c t e d Pro p e r t i e s

Layer selectedProperties attribute on page 88

All selected AE properties in the layer.

com m e n t

Layer comment attribute on page 83

A descriptive comment for the layer.

con t a i n i n g Com p

Layer containingComp attribute on page 83

The composition that contains this layer.

81

After Effects Scripting Guide

JavaScript Reference

82

Attribute

Reference

Description

i s Na m e S e t

Layer isNameSet attribute on page 85

When true, the layers name has been explicitly set.

Methods
Method

Reference

Description

rem ove( )

Layer remove() method on page 88

Deletes the layer from the composition.

m oveToB e g i n n i n g ( )

Layer moveToBeginning() method on


page 86

Moves the layer to the top of the composition (makes it the


first layer).

m oveToE n d ( )

Layer moveToEnd() method on


page 86

Moves the layer to the bottom of the composition (makes it


the last layer).

moveAfter()

Layer moveAfter() method on page 85 Moves the layer below another layer.

m oveB e f ore( )

Layer moveBefore() method on


page 86

Moves the layer above another layer.

du pl i c ate( )

Layer duplicate() method on page 84

Duplicates the layer.

copy ToCom p ( )

Layer copyToComp() method on


page 84

Copies the layer to the top (beginning) of another composition.

a c t iveAtTim e()

Layer activeAtTime() method on


page 82

Reportes whether this layer will be active at a specified


time.

s e tPare n t Wi th Ju m p ( )

Layer setParentWithJump() method


on page 88

Sets a new parent for this layer.

a pp ly Pre se ts ( )

Layer applyPreset() method on


page 83

Applies a named collection of animation settings to the


layer.

Layer active attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). ac t ive
Description

When true, the layer's video is active at the current time.


For this to be true, the layer must be enabled, no other layer may be soloing unless this layer is soloed too, and
the time must be between the i n Poi n t and o u t Po i n t values of this layer.
This value is never true in an audio layer; there is a separate au dioAct ive attribute in the AVLayer object.
Type

Boolean; read-only.

Layer activeAtTime() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). ac t ive At Ti m e( t i m e)
Description

Returns true if this layer will be active at the specified time. To return true, the layer must be enabled, no other
layer may be soloing unless this layer is soloed too, and the time must be between the in Poi n t and o utPoi n t
values of this layer.

82

After Effects Scripting Guide

JavaScript Reference

83

Parameters
time

The time in seconds, a floating-point value.

Returns

Boolean.

Layer applyPreset() method


a pp app.proj ec t. item (i n de x ). l ayer( in d e x) .a pp lyPres e t( pre s e t Na m e );
Description

Applies the specified collection of animation settings (an animation preset) to the layer. Predefined animation
preset files are installed in the Presets folder, and users can create new animation presets through the user
interface.
Parameters
pres e tNam e

An ExtendScript File object for the file containing the animation preset.

Returns

Nothing.

Layer comment attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). co m m e n t
Description

A descriptive comment for the layer.


Type

String; read/write.

Layer containingComp attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). con ta in in g Com p
Description

The composition that contains this layer.


Type

CompItem object; read-only.

83

After Effects Scripting Guide

JavaScript Reference

84

Layer copyToComp() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). copy To Com p( intoComp)
Description

Copies the layer into the specified composition. The original layer remains unchanged. Creates a new Layer
object with the same values as this one, and prepends the new object to the l ayer s collection in the target
CompItem. Retrieve the copy using i n t o Com p.layer( 1) .
Copying in a layer changes the index positions of previously existing layers in the target composition. This is
the same as copying and pasting a layer through the user interface.
Parameters
i n toC om p

The target composition, and CompItem object.

Returns

Nothing.

Layer duplicate() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). dup l i c ate ()
Description

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

None.
Returns

Layer object.

Layer enabled attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). en ab l ed
Description

When true, the layer is enabled; otherwise false. This corresponds to the video switch state of the layer in the
Timeline panel.
Type

Boolean; read/write.

Layer hasVideo attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). has Vi deo
Description

When true, the layer has a video switch (the eyeball icon) in the Timeline panel; otherwise false.

84

After Effects Scripting Guide

JavaScript Reference

85

Type

Boolean; read-only.

Layer index attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). in dex
Description

The index position of the layer.


Type

Integer in the range [1..n u m L ayers ]; read-only.

Layer inPoint attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). in Poi n t
Description

The in point of the layer, expressed in composition time (seconds).


Type

Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.

Layer isNameSet attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). is Nam e S et
Description

True if the value of the n a m e attribute has been set explicitly, rather than automatically from the source.
Type

Boolean; read-only.

Layer locked attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). l ocked
Description

When true, the layer is locked; otherwise false. This correponds to the lock toggle in the Layer panel.
Type

Boolean; read/write.

Layer moveAfter() method


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). moveAf ter( laye r)
Description

Moves this layer to a position immediately after (below) the specified layer.

85

After Effects Scripting Guide

JavaScript Reference

86

Parameters
l ayer

The target layer, a layer object in the same composition.

Returns

Nothing.

Layer moveBefore() method


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). moveB efore( l ay e r)
Description

Moves this layer to a position immediately before (above) the specified layer.
Parameters
l ayer

The target layer, a layer object in the same composition.

Returns

Nothing.

Layer moveToBeginning() method


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). moveTo Be g i nning()
Description

Moves this layer to the topmost position of the layer stack (the first layer).
Parameters

None.
Returns

Nothing.

Layer moveToEnd() method


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). moveTo End ()
Description

Moves this layer to the bottom position of the layer stack (the last layer).
Parameters

None.
Returns

Nothing.

86

After Effects Scripting Guide

JavaScript Reference

87

Layer name attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). name
Description

The name of the layer. By default, this is the same as the Source name (which cannot be changed in the Layer
panel), but you can set it to be different.
Type

String; read/write.

Layer nullLayer attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). nul l Layer
Description

When true, the layer was created as a null object; otherwise false.
Type

Boolean; read-only.

Layer outPoint attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). outPoint
Description

The out point of the layer, expressed in composition time (seconds).


Type

Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.

Layer parent attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). pa rent
Description

The parent of this layer; can be null.


Offset values are calculated to counterbalance any transforms above this layer in the hierarchy, so that when
you set the parent there is no apparent jump in the layer's transform. For example, if the new parent has a
rotation of 30 degrees, the child layer is assigned a rotation of -30 degrees.
To set the parent without changing the child layer's transform values, use the s e tPa re n t Wi t h Ju m p method.
Type

Layer object or null; read/write.

87

After Effects Scripting Guide

JavaScript Reference

88

Layer remove() method


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). remove ()
Description

Deletes the specified layer from the composition.


Parameters

None.
Returns

Nothing.

Layer selectedProperties attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). se l ec te d Prop er t ie s
Description

An array containing all of the currently selected Property and PropertyGroup objects in the layer.
Type

Array of PropertyBase objects; read-only.

Layer setParentWithJump() method


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). se t ParentWit hJu m p( n e w Pa re nt )
Description

Sets the parent of this layer to the specified layer, without changing the transform values of the child layer.
There may be an apparent jump in the rotation, translation, or scale of the child layer, as this layers transform
values are combined with those of its ancestors.
If you do not want the child layer to jump, set the p aren t attribute directly. In this case, an offset is calculated
and set in the child layer's transform fields, to prevent the jump from occurring.
Parameters
n e w Pa re n t

A layer object in the same composition.

Returns

Nothing.

Layer shy attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). shy
Description

When true, the layer is shy, meaning that it is hidden in the Layer panel if the compositions Hide all shy
layers option is toggled on.

88

After Effects Scripting Guide

JavaScript Reference

89

Type

Boolean; read/write.

Layer solo attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). so lo
Description

When true, the layer is soloed, otherwise false.


Type

Boolean; read/write.

Layer startTime attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). st ar tTi m e
Description

The start time of the layer, expressed in composition time (seconds).


Type

Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.

Layer stretch attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). st re tch
Description

The layers time stretch, expressed as a percentage. A value of 100 means no stretch. Values between 0 and 1
are set to 1, and values between -1 and 0 (not including 0) are set to -1.
Type

Floating-point value in the range [-9900.0..9900.0]; read/write.

Layer time attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). t im e
Description

The current time of the layer, expressed in composition time (seconds).


Type

Floating-point value; read-only.

89

After Effects Scripting Guide

JavaScript Reference

90

LayerCollection object
a pp. pro je c t .i tem ( i n d e x) .l ayers
Description

The LayerCollection object represents a set of layers. The LayerCollection belonging to a CompItem object
contains all the layer objects for layers in the composition. The methods of the collection object allow you to
manipulate the layer list.
LayerCollection is a subclass of Collection. All methods and attributes of Collection, in addition to those

listed below, are available when working with LayerCollection. See Collection object on page 49.

Example

Given that the first item in the project is a CompItem and the second item is an AVItem, this example shows
the number of layers in the CompItem's layer collection, adds a new layer based on an AVItem in the project,
then displays the new number of layers.
v ar f i r s t Co m p = a p p. p ro je c t .i te m ( 1 ) ;
v ar l ayer Co l l e c t ion = fi r s t Co m p.l ayer s;
a l er t ( " nu m b e r o f l ayer s b efore i s " + l ayer Co l l e c t i o n . l e n g t h ) ;
v ar a n AVItem = a pp.proje c t.i tem (2 );
l ayer Co l l e c t ion . a d d (a n AVIte m ) ;
a l er t ( " nu m b e r o f l ayer s a f ter i s " + l ayer C o l l e c t i o n . l e n g t h ) ;
Methods
Method

Reference

Description

a d d( )

LayerCollection add() method on


page 91

Creates a new AVLayer and adds it to this collection.

a d dNul l ( )

LayerCollection addNull() method on


page 92

Creates a new, null layer and adds it to this collection.

a d dS o li d ( )

LayerCollection addSolid() method on Creates a new layer, a FootageItem with a SolidSource, and adds it
page 92
to this collection.

a d dTex t( )

LayerCollection addText() method on


page 93

Creates a new text layer and adds it to this collection.

a d dCamer a( )

LayerCollection addCamera() method


on page 91

Creates a new camera layer and adds it to this collection.

a d dL i g ht ()

LayerCollection addLight() method on Creates a new light layer and adds it to this collection.
page 91

by Na m e( )

LayerCollection byName() method on


page 93

Retrieves the layer object with a specified name.

pre co m p o s e ( )

LayerCollection precompose()
method on page 93

Collects specified layers into a new composition.

90

After Effects Scripting Guide

JavaScript Reference

91

LayerCollection add() method


a pp. pro je c t .i tem ( i n d e x) .l ayers .a d d (ite m , du ra t io n )
Description

Creates a new AVLayer object containing the specified item, and adds it to this collection.
This method generates an exception if the item cannot be added as a layer to this CompItem.
Parameters
i te m

The AVItem object for the item to be added.

du r at i on

Optional, the length of a still layer in seconds, a floating-point value. Used only if the item contains a piece of
still footage. Has no effect on movies, sequences or audio.
If supplied, sets the du r a ti on value of the new layer. Otherwise, the d u r a t io n value is set according to user
preferences. By default, this is the same as the duration of the containing CompItem. To set another preferred
value, choose Edit > Preferences > Import (Windows) or After Effects > Preferences > Import (Mac OS), and specify options under Still Footage.

Returns

AVLayer object.

LayerCollection addCamera() method


a pp. pro je c t .i tem ( i n d e x) .layers .a d d Cam er a( n a m e , c e nt e r Po i n t)
Description

Creates a new camera layer and adds the CameraLayer object to this collection.
Parameters
name

A string containing the name of the new layer.

cen terPoi n t

The center of the new camera, a floating-point array [x, y]. This is used to set the initial x and y values of the
new cameras Point of Interest property. The z value is set to 0.

Returns

CameraLayer object.

LayerCollection addLight() method


a pp. pro je c t .i tem ( i n d e x) .l ayers .a d d L ig h t ( n a m e , c e n t e r Po i n t )
Description

Creates a new light layer and adds the LightLayer object to this collection.
Parameters
name

A string containing the name of the new layer.

cen terPoi n t

The center of the new light , a floating-point array [x, y].

91

After Effects Scripting Guide

JavaScript Reference

92

Returns

LightLayer object.

LayerCollection addNull() method


a pp. pro je c t .i tem ( i n d e x) . l ayers . a d d Nu l l ( durat io n )
Description

Creates a new null layer and adds the AVLayer object to this collection. Ths is the same as choosing
Layer > New > Null Object.
Parameters
du r at i on

Optional, the length of a still layer in seconds, a floating-point value.


If supplied, sets the d u r a ti o n value of the new layer. Otherwise, the dur a t i on value is set according to user
preferences. By default, this is the same as the duration of the containing CompItem. To set another preferred
value, choose Edit > Preferences > Import (Windows) or After Effects > Preferences > Import (Mac OS), and specify
options under Still Footage.

Returns

AVLayer object.

LayerCollection addSolid() method


a pp. pro je c t .i tem ( i n d e x) .l ayers .a d d S o l id ( c ol or, n am e , w id t h, he ig h t , p ix e lAs p ec t, durat i on)
Description

Creates a new SolidSource object, with values set as specified; sets the new SolidSource as the m a i n S o u rce
value of a new FootageItem object, and adds the FootageItem to the project. Creates a new AVLayer object,
sets the new FootageItem as its s o u rce , and adds the layer to this collection.
Parameters
co lor

The color of the solid, an array of four floating-point values, [R, G, B, A], in the range [0.0..1.0].

name

A string containing the name of the solid.

w i dt h

The width of the solid in pixels, an integer in the range [4..30000].

h eig h t

The height of the solid in pixels, an integer in the range [4..30000].

p i xel As p e c t

The pixel aspect ratio of the solid, a floating-point value in the range [0.01..100.0].

du r at i on

Optional, the length of a still layer in seconds, a floating-point value.


If supplied, sets the dur at i on value of the new layer. Otherwise, the dur at i on value is set according to
user preferences. By default, this is the same as the duration of the containing CompItem. To set another
preferred value, choose Edit > Preferences > Import (Windows) or After Effects > Preferences > Import (Mac
OS), and specify options under Still Footage.

Returns

AVLayer object.

92

After Effects Scripting Guide

JavaScript Reference

93

LayerCollection addText() method


a pp. pro je c t .i tem ( i n d e x) .l ayers .a d d Tex t (s ou rc eTe x t )
Description

Creates a new text layer and adds the new TextLayer object to this collection.
Parameters
s o u rce Tex t

Optional; a string containing the source text of the new layer, or a TextDocument object containing the source text of the new layer. See TextDocument object on page 165.

Returns

TextLayer object.

LayerCollection byName() method


a pp. pro je c t .i tem ( i n d e x) .l ayers .by Nam e ( n a m e )
Description

Returns the first (topmost) layer found in this collection with the specified name, or null if no layer with the
given name is found.
Parameters
name

A string containing the name.

Returns

Layer object or null.

LayerCollection precompose() method


a pp. pro je c t .i tem ( i n d e x) .l ayers .p re com p o s e ( l ay e r In di c i es , n a m e , m ov e Al l At t r i bu te s )
Description

Creates a new CompItem object and moves the specified layers into its layer collection. It removes the
individual layers from this collection, and adds the new CompItem to this collection.
Parameters
l ayer In di ce s

The position indexes of the layers to be collected. An array of integers.

name

The name of the new CompItem object.

m oveAl l At t r i bute s

Optional. When true (the default), retains all attributes in the new composition.
This is the same as selecting the Move all attributes into the new composition
option in the Pre-compose dialog box.
You can only set this to false if there is just one index in the l ayer In d i ce s array.
This is the same as selecting the Leave all attributes in option in the Pre-compose dialog box.

Returns

CompItem object.

93

After Effects Scripting Guide

JavaScript Reference

94

LightLayer object
a pp. pro je c t .i tem ( in d e x) .l ayer(i n de x )
Description

The LightLayer object represents a light layer within a composition. Create it using the LayerCollection
objects ad d L ig h t method; see LayerCollection addLight() method on page 91. It can be accessed in an
items layer collection either by index number or by a name string.
LightLayer is a subclass of Layer. All methods and attributes of Layer are available when working with Light-

Layer. See Layer object on page 81.


AE Properties

LightLayer defines no additional attributes, but has different AE properties than other layer types. It has the
following properties and property groups:
Ma r ker
Tr an s for m
Poi n t of In teres t
Pos i t i on
S c al e
Orientation
X Rot at i on
Y Rot at i o n
Rot at i o n
O p a ci t y
L i g ht O p t i o n s
In ten s i t y
Col or
Con e An g l e
Con e Fea th er
C as ts S h a dow s
S h a dow D a r k n e s s
S h a dow D i ff u s i on

94

After Effects Scripting Guide

JavaScript Reference

95

MarkerValue object
new Ma r kerVa lue( c om m e n t , c h ap te r, u r l, f ra m eTar ge t )
Description

The MarkerValue object represents of a layer marker, which associates a comment, and optionally a chapter
and Web-page link with a particular point in a layer. Create it with the constructor; all arguments are strings,
and all except com m e n t are optional. The values are set in the corresponding attributes of the returned
MarkerValue object.
To associate a marker with a layer, set the MarkerValue object in the Mar ker AE property of the layer:
laye rO bj ec t . prop e r t y (" Mar ker " ) .s e tVa lu e AtTi m e (t im e, m a r ke r Val u eO b j e ct );

For information on the usage of markers see Using markers in After Effects Help.
Attributes
Attribute

Reference

Description

com m e n t

MarkerValue comment attribute on


page 96

A comment on the associated layer.

cha p ter

MarkerValue chapter attribute on


page 95

A chapter link reference point for the associated layer.

ur l

MarkerValue url attribute on page 96

A URL for Web page to be associated with the layer.

f r a m eTa rg et

MarkerValue frameTarget attribute on


page 96

A specific frame target within the Web page specified by u rl .

Examples

To set a marker that says Fade Up at the 2 second mark:


v ar my Mar ker = ne w Ma r kerVa lue ("Fa de Up");
my Layer.prop er t y ("Ma r ker").set ValueAtTim e(2 , my Mar ker );

To get a comment value from a particular marker:


v ar comment O fFirstMa r ker = app.proj ec t. item(1 ). layer(1).prop er t y("Ma r ker").ke yVa lue (1 ). comment;
v ar com m e n t O f Ma r ke r AtTi m e 4 =
a p p. p ro je c t . i te m ( 1 ) . l ayer (1 ). proper t y("Ma r ker").v alu eAt Time (4. 0,T RU E ) .comment
v ar ma r kerProper t y = a pp. pro je c t .item(1).layer (1 ). proper t y("Mar ker");
v ar ma r kerVa lueAtTimeClosestToTi me 4 = m ar kerProper t y
.ke y Value(ma r kerProp er t y.n earestKe yIn dex (4.0 ));
v ar comment O fMa r kerClosestToTim e4 = ma r ker Valu e At Ti m e C lo s e s t ToTi m e 4 . com m e n t ;

MarkerValue chapter attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). proper t y ("Mar ker ") .ch apter
Description

A text chapter link for this marker. Chapter links initiate a jump to a chapter in a QuickTime movie or in other
formats that support chapter marks.
Type

String; read/write.

95

After Effects Scripting Guide

JavaScript Reference

96

MarkerValue comment attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). prop er t y ("Mar ker ") .com ment
Description

A text comment for this marker. This comment appears in the Timeline panel next to the layer marker.
Type

String; read/write.

MarkerValue frameTarget attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). prop er t y ("Mar ker ") .f r a meTarge t
Description

A text frame target for this marker. Together with the URL value, this targets a specific frame within a Web
page.
Type

String; read/write.

MarkerValue url attribute


a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). prop er t y ("Mar ker ") .u r l
Description

A URL for this marker. This URL is an automatic link to a Web page.
Type

String; read/write.

96

After Effects Scripting Guide

JavaScript Reference

97

MaskPropertyGroup object
a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). mas k
Description

The MaskPropertyGroup object encapsulates mask attributes in a layer.


MaskPropertyGroup is a subclass of PropertyGroup. All methods and attributes of PropertyBase and

PropertyGroup, in addition to those listed below, are available when working with MaskPropertyGroup.
See PropertyBase object on page 135 and PropertyGroup object on page 142.
Attributes
Attribute

Reference

Description

ma sk Mo de

MaskPropertyGroup maskMode attribute


on page 98

The mask mode.

i nver te d

MaskPropertyGroup inverted attribute on


page 97

When true, the mask is inverted.

rotoB ez i er

MaskPropertyGroup rotoBezier attribute


on page 98

When true, the shape of the mask is RotoBezier.

m a s k Mot i o n B lu r

MaskPropertyGroup maskMotionBlur
attribute on page 98

How motion blur is applied to this mask.

l o cke d

MaskPropertyGroup locked attribute on


page 98

When true, the mask is locked.

co lor

MaskPropertyGroup color attribute on


page 97

The color used to draw the mask outline in the user


interface.

MaskPropertyGroup color attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). mas k (ind e x) .color
Description

The color used to draw the mask outline as it appears in the user interface (Composition panel, Layer panel,
and Timeline panel).
Type

Array of three floating-point values, [R, G, B], in the range [0.0..1.0]; read/write.

MaskPropertyGroup inverted attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). mas k (ind e x) .inver ted
Description

When true, the mask is inverted; otherwise false.


Type

Boolean; read/write.

97

After Effects Scripting Guide

JavaScript Reference

98

MaskPropertyGroup locked attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). mas k (i n d e x ) .l o cke d
Description

When true, the mask is locked and cannot be edited in the user interface; otherwise, false.
Type

Boolean; read/write.

MaskPropertyGroup maskMode attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). mas k (i n d e x ) .m as kMo de
Description

The masking mode for this mask.


Type

A Mas kMo de enumerated value; read/write. One of:


Ma sk Mo de. N ONE
Ma sk Mo de. ADD
Ma sk Mo de. SU BTRAC T
Ma sk Mo de. I NTERS E CT
Ma sk Mo de. L IG HTE N
Ma sk Mo de. DA RK E N
Ma sk Mo de. DIF F E R E NCE

MaskPropertyGroup maskMotionBlur attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). mas k (i n d e x ) .m as kMo ti o n Blu r
Description

How motion blur is applied to this mask.


Type

A Mak Mot i on Blur enumerated value; read/write. One of:


Ma sk Mot i on Blur.S A ME _ AS _ L AYE R
Ma sk Mot i on Blur.O N
Ma sk Mot i on Blur.O F F

MaskPropertyGroup rotoBezier attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). m a s k ( i n d e x ) .rotoB ezier
Description

When true, the mask is a RotoBezier shape; otherwise, false.


Type

Boolean; read/write.

98

After Effects Scripting Guide

JavaScript Reference

99

OMCollection object
a pp. pro je c t .renderQ ueue. items. out p ut Mo dules
Description

The OMCollection contains all of the output modules in a render queue. The collection provides access to the
OutputModule objects, but does not provide any additional functionality. The first OutputModule object in
the collection is at index position 1. See OutputModule object on page 100
OMCollection is a subclass of Collection. All methods and attributes of Collection are available when

working with OMCollection. See Collection object on page 49.

99

After Effects Scripting Guide

JavaScript Reference

100

OutputModule object
a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s ( inde x )
Description

An OutputModule object of a RenderQueueItem generates a single file or sequence via a render operation,
and contains attributes and methods relating to the file to be rendered.
Attributes
Attribute

Reference

Description

f i le

OutputModule file attribute on


page 100

The path and name of the file to be rendered.

p o s t Ren de r Ac t i o n

OutputModule postRenderAction
attribute on page 101

An action to be taken after rendering.

name

OutputModule name attribute on


page 101

The user-interface name of the output module.

tem pl a tes

OutputModule templates attribute on All templates for the output module.


page 102

Methods
Method

Reference

Description

rem ove( )

OutputModule remove() method on


page 101

Removes this output module from the render-queue items list.

s aveAs Tem p l ate( )

OutputModule saveAsTemplate()
method on page 101

Saves a new output-module template.

a pp ly Te m p l ate ( )

OutputModule applyTemplate()
method on page 100

Applies an output-module template.

OutputModule applyTemplate() method


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s [ inde x ] .ap plyTemp l ate( t e m p l a te Na m e)
Description

Applies the specified existing output-module template.


Parameters
tem pl a teNam e

A string containing the name of the template to be applied.

Returns

Nothing.

OutputModule file attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s [ inde x ] .f il e
Description

The ExtendScript File object for the file this output module is set to render.

100

After Effects Scripting Guide

JavaScript Reference

101

Type

ExtendScript File object; read/write.

OutputModule name attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s [ inde x ] .nam e
Description

The name of the output module, as shown in the user interface.


Type

String; read-only.

OutputModule postRenderAction attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s [ inde x ] .p o s tRen de r Ac t i o n
Description

An action to be performed when the render operation is completed.


Type

A Pos tRen d er Ac t ion enumerated value (read/write); one of:


p o s t Ren de r Ac t i o n .N O N E
p o s t Ren de r Ac t i o n .I M PO RT
p o s t Ren de r Ac t i o n .I M PO RT _ A N D _ R E P L AC E _ US AG E
p o s t Ren de r Ac t i o n .S E T _ P ROXY

OutputModule remove() method


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s [ inde x ] .rem ove ()
Description

Removes this OutputModule object from the collection.


Parameters

None.
Returns

Nothing.

OutputModule saveAsTemplate() method


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s [ inde x ] .s aveAs Tem p l ate( n a m e)
Description

Saves this output module as a template and adds it to the templa tes array.

101

After Effects Scripting Guide

JavaScript Reference

102

Parameters
name

A string containing the name of the new template.

Returns

Nothing.

OutputModule templates attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s [ inde x ] .tem p l ates
Description

The names of all output-module templates availalbe in the local installation of After Effects.
Type

Array of strings; read-only.

102

After Effects Scripting Guide

JavaScript Reference

103

PlaceholderSource object
a pp. pro je c t .i tem ( i n d e x) .m a i n S o u rce
a pp. pro je c t .i tem ( i n d e x) .p roxy S o u rce
Description

The PlaceholderSource object describes the footage source of a placeholder.


PlaceholderSource is a subclass of FootageSource. All methods and attributes of FootageSource are available
when working with PlaceholderSource. See FootageSource object on page 65. PlaceholderSource does not
define any additional methods or attributes.

103

After Effects Scripting Guide

JavaScript Reference

104

Project object
a pp. pro je c t
Description

The project object represents an After Effects project. Attributes provide access to specific objects within the
project, such as imported files or footage and compositions, and also to project settings such as the timecode
base. Methods can import footage, create solids, compositions and folders, and save changes.
Attributes
Attribute

Reference

Description

f i le

Project file attribute on page 106

The file for the currently open project.

rootFo lder

Project rootFolder attribute on


page 109

The folder containing all the contents of the


project; the equivalent of the Project panel

i te m s

Project items attribute on page 108

All items in the project.

a c t iveItem

Project activeItem attribute on


page 105

The currently active item.

bitsPerChan n el

Project bitsPerChannel attribute on


page 105

The color depth of the current project.

t r an s p aren c y Gr i d T hu m bn ai l s Project transparencyGridThumbnails


attribute on page 112

When true, thumbnail views use the transparency checkerboard pattern.

t i m e cod eD i sp l ay Ty p e

Project timecodeDisplayType
attribute on page 111

The way the timecode is displayed.

t i m e cod e B as e Ty p e

Project timecodeBaseType attribute


on page 111

The timecode base project setting.

t i m e cod eN TS C D ro pFr am e

Project timecodeNTSCDropFrame
attribute on page 112

The drop-frame project setting.

t i m e cod eF i l m Ty p e

Project timecodeFilmType attribute


on page 111

The film type for the Feet + Frames project setting.

nu m Item s

Project numItems attribute on


page 108

The total number of items contained in the


project.

selection

Project selection attribute on


page 110

All items selected in the Project panel.

renderQ ueue

Project renderQueue attribute on


page 109

The projects render queue.

d i sp l ay S ta r t Fr a m e

Project displayStartFrame attribute on The frame at which to start numbering when dispage 106
playing the project.

linearBlending

Project linearBlending attribute on


page 108

When true, linear blending is used for the project.

Methods
Method

Reference

Description

i te m ( )

Project item() method on page 108

Retrieves an item from the project.

con s ol i d ate Fo ot ag e( )

Project consolidateFootage() method


on page 106

Consolidates all footage in the project.

104

After Effects Scripting Guide

JavaScript Reference

105

Method

Reference

Description

rem oveUnu se d Fo ota g e( )

Project removeUnusedFootage()
method on page 109

Removes unused footage from the project.

red uce Proje c t( )

Project reduceProject() method on


page 109

Reduces the project to a specified set of items.

cl o se( )

Project close() method on page 105

Closes the project with normal save options.

s ave( )

Project save() method on page 110

Saves the project.

s aveWi th Di a l o g ( )

Project saveWithDialog() method on


page 110

Displays a Save dialog box.

i m p o r tP l ace h o ld e r ( )

Project importFileWithDialog()
method on page 107

Imports a placeholder into the project.

i m p o r tF i l e ( )

Project importFile() method on


page 107

Imports a file into the project.

i m p o r tF i l e Wi t h D i a l o g ()

Project importFileWithDialog()
method on page 107

Displays an Import File dialog box.

s h ow Win dow( )

Project showWindow() method on


page 110

Shows or hides the Project panel.

Project activeItem attribute


a pp. pro je c t .a c t iveItem
Description

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

Item object or null; read-only.

Project bitsPerChannel attribute


a pp. pro je c t .b i ts PerC han n el
Description

The color depth of the current project, either 8, 16, or 32 bits.


Type

Integer (8, 16, or 32 only); read/write.

Project close() method


a pp. pro je c t .cl o se( c lo s e O p t i on s )
Description

Closes the project with the option of saving changes automatically, prompting the user to save changes or
closing without saving changes.

105

After Effects Scripting Guide

JavaScript Reference

106

Parameters
cl o seO pt i on s

Action to be performed on close. A C l o s e O p t ion s enumerated value, one of:

C l o s e O p t i o n s . D O _ N OT _ SAV E _ C H A N G E S : Close without saving.


C l o s e O p t i o n s . PRO M P T _ TO _ S AV E _ C H A N G E S : Prompt for whether to save
changes before close.

C l o s e O p t i o n s . SAV E _ C H A N G E S : Save automatically on close.

Returns

Boolean. True on success. False if the file has not been previously saved, the user is prompted, and the user
cancels the save.

Project consolidateFootage() method


a pp. pro je c t .con s ol i d ate Fo ot ag e( )
Description

Consolidates all footage in the project. Same as the File > Consolidate All Footage command.
Parameters

None.
Returns

Integer; the total number of footage items removed.

Project displayStartFrame attribute


a pp. pro je c t .d i sp l ay S ta r t Fr a m e
Description

The frame at which to start numbering when displaying the project with a t i me co deD i sp l ay Ty p e value of
Tim e co de Di s p l ay Ty p e .F R A M E S . (See Project timecodeDisplayType attribute on page 111.) This is the
same as setting Start numbering frames at: in the Project Settings > Display Style tab.
Type

Integer; read/write.

Project file attribute


a pp. pro je c t .f i le
Description

The ExtendScript File object for the file containing the project that is currently open.
Type

File object or null if project has not been saved; read-only.

106

After Effects Scripting Guide

JavaScript Reference

107

Project importFile() method


a pp. pro je c t .i m p or tF i l e( i m p o r t O p t io n s )
Description

Imports the file specified in the specified ImportOptions object, using the specified options. Same as the
File > Import File command. Creates and returns a new FootageItem object from the file, and adds it to the
projects i te m s array.
Parameters
i m p o r tO p t i o n s

An ImportOptions object specifying the file to import and the options for the operation. See
ImportOptions object on page 71.

Returns

FootageItem object.
Example
a pp. pro je c t .i m p or tF i l e( n ew Im p or tO p t i o n s ( F i l e ( sa m pl e .p sd ) )

Project importFileWithDialog() method


a pp. pro je c t .i m p o r tF i l eWi t hD i al o g ()
Description

Shows an Import File dialog box. Same as the File > Import > File command.
Returns

Array of Item objects created during import; or null if the user cancels the dialog.

Project importPlaceholder() method


a pp. pro je c t .i m p or tP l aceho ld er( na m e , w idt h , h e ig ht , f ra m eR a te , du ra t io n )
Description

Creates and returns a new PlaceholderItem object and adds it to the projects i te m s array. Same as the
File > Import > Placeholder command.
Parameters
name

A string containing the name of the placeholder.

w i dt h

The width of the placeholder in pixels, an integer in the range [4..30000].

h eig h t

The height of the placeholder in pixels, an integer in the range [4..30000].

f r a m eRa te

The frame rate of the placeholder, a floating-point value in the range [1.0..99.0]

du r at i on

The duration of the placeholder in seconds, a floating-point value in the range [0.0..10800.0].

Returns

PlaceholderItem object.

107

After Effects Scripting Guide

JavaScript Reference

108

Project item() method


a pp. pro je c t .i tem ( i n d e x)
Description

Retrieves an item at a specified index position.


Parameters
i n dex

The index position of the item, an integer. The first item is at index 1.

Returns

Item object.

Project items attribute


a pp. pro je c t .i tem s
Description

All of the items in the project.


Type

ItemCollection object; read-only.

Project linearBlending attribute


a pp. pro je c t .l i n ea rBl en di n g
Description

True if linear blending should be used for this project; othewise false.
Type

Boolean; read/write.

Project numItems attribute


a pp. pro je c t .nu m Item s
Description

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 e c t . num Item s ;
a l er t ( " T h e re a re " + n + " i te m s i n t h is p ro j e c t . " )

108

After Effects Scripting Guide

JavaScript Reference

109

Project reduceProject() method


a pp. pro je c t .red uce Proje c t( a r ray _ of _i t e m s )
Description

Removes all items from the project except those specified. Same as the File > Reduce Project command.
Parameters
a r r ay _ of _ i tem s

An array containing the Item objects that are to be kept.

Returns

Integer; the total number of items removed.


Example
v ar theItems = ne w Ar r ay();
t heItems[t he Item s.leng th] = app.proj ec t. item(1 );
t heItems[t he Item s.leng th] = app.proj ec t. item(3 );
a pp. pro je c t .red uce Proje c t( th eItems) ;

Project removeUnusedFootage() method


a pp. pro je c t .rem oveUnu se d Fo ota g e( )
Description

Removes unused footage from the project. Same as the File > Remove Unused Footage command.
Parameters

None.
Returns

Integer; the total number of FootageItem objects removed.

Project renderQueue attribute


a pp. pro je c t .renderQ ueue
Description

The render queue of the project.


Type

RenderQueue object; read-only.

Project rootFolder attribute


a pp. pro je c t.rootFo lder
Description

The root folder containing the contents of the project; this is a virtual folder that contains all items in the
Project panel, but not items contained inside other folders in the Project panel.

109

After Effects Scripting Guide

JavaScript Reference

110

Type

FolderItem object; read-only.

Project save() method


a pp. pro je c t .s ave( )
a pp. pro je c t .s ave( file )
Description

Saves the project. The same as the File > Save or File > SaveAs command. If the project has never previously
been saved and no file is specified, prompts the user for a location and file name. Pass a File object to save a
project to a new file without prompting.
Parameters
file

Optional. An ExtendScript File object for the file to save.

Returns

None.

Project saveWithDialog() method


a pp. pro je c t .s aveWi th Di a l og ( )
Description

Shows the Save dialog box. The user can name a file with a location and save the project, or click Cancel to exit
the dialog.
Parameters

None.
Returns

Boolean; true if the project was saved.

Project selection attribute


a pp. pro je c t .s el e c t i on
Description

All items selected in the Project panel, in the sort order shown in the Project panel.
Type

Array of Item objects; read-only.

Project showWindow() method


a pp. pro je c t .s how Win dow( d oSh ow )
Description

Shows or hides the Project panel.

110

After Effects Scripting Guide

JavaScript Reference

111

Parameters
doS h ow

When true, show the Project panel. When false, hide the Project panel.

Returns

Nothing.

Project timecodeBaseType attribute


a pp. pro je c t .t i m e cod e B as e Ty p e
Description

The Timecode Base option, as set in the Project Settings dialog box.
Type

A Ti m e cod e B as e Ty p e enumerated value; read/write. One of:


Tim eco de Ba s eTy p e.AU TO
Tim eco de Ba s eTy p e.F P S 24
Tim eco de Ba s eTy p e.F P S 25
Tim eco de Ba s eTy p e.F P S 30
Tim eco de Ba s eTy p e.F P S 48
Tim eco de Ba s eTy p e.F P S 50
Tim eco de Ba s eTy p e.F P S 60
Tim eco de Ba seTy p e.FPS100

Project timecodeDisplayType attribute


a pp. pro je c t .t i m e cod eD i sp l ay Ty p e
Description

The way in which timecode is set to display, as set in the Project Settings dialog box.
Type

A Ti m e cod eD i sp l ay Ty p e enumerated value; read/write. One of:


Tim e co de Di s p l ay Ty p e .T I M E C O DE
Tim e co de Di s p l ay Ty p e .F R A M E S
Tim e co de Di s p l ay Ty p e .F E E T _ A N D_ F R A M E S

Project timecodeFilmType attribute


a pp. pro je c t .t i m e cod eF i l m Ty p e
Description

The film type, as set in the Feet + Frames option in the Project Settings dialog box.
Type

A Ti m e cod eF i l m Ty p e enumerated value; read/write. One of:


Tim eco de F il m Ty p e .MM 16
Tim eco de F il m Ty p e .MM 35

111

After Effects Scripting Guide

JavaScript Reference

112

Project timecodeNTSCDropFrame attribute


a pp. pro je c t .t i m e cod eN TS C D ro pFr am e
Description

How timecode for 29.97 fps footage is displayed, as set in the Project Settings dialog box under NTSC.
Type

Boolean, true for the Drop Frame option, false for the Non-Drop Frame option; read/write.

Project transparencyGridThumbnails attribute


a pp. pro je c t .t r an s p aren c y Gr i d T hu m bn ai l s
Description

When true, thumbnail views use the transparency checkerboard pattern.


Type

Boolean; read/write.

112

After Effects Scripting Guide

JavaScript Reference

113

Property object
a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). prop e r t y Sp ec
Description

The Property object contains value, keyframe, and expression information about a particular AE property of
a layer. An AE property is an value, often animatable, of an effect, mask, or transform within an individual
layer. For examples of how to access properties, see PropertyBase object on page 135 and PropertyGroup
property() method on page 144..
PropertyGroup is a subclass of PropertyBase. All methods and attributes of PropertyBase, in addition to

those listed below, are available when working with PropertyGroup. See PropertyBase object on page 135.
NOTE: JavaScript objects commonly referred to as properties are called attributes in this guide, to avoid
confusion with the After Effects definition of property.
Attributes
Attribute

Reference

Description

prop er t y Va lue Ty p e

Property propertyValueType attribute


on page 126

Type of value stored in this property.

v alu e

Property value attribute on page 133

Current value of the property.

h as Mi n

Property hasMin attribute on


page 118

When true, there is a minimum permitted value.

h as Max

Property hasMax attribute on


page 118

When true, there is a maximum permitted value.

m i n Va lu e

Property minValue attribute on


page 125

The minimum permitted value.

m a x Va lu e

Property maxValue attribute on


page 125

The maximum permitted value.

i s Sp a t i a l

Property isSpatial attribute on


page 119

When true, the property defines a spatial value.

can Var yOverTime

Property canVaryOverTime attribute


on page 117

When true, the property can be keyframed.

i s Ti m e Va r y i n g

Property isTimeVarying attribute on


page 119

When true, the property has keyframes or an


expression enabled that can vary its values.

nu m Ke y s

Property numKeys attribute on


page 126

The number of keyframes on this property.

un it sTex t

Property unitsText attribute on


page 133

A text description of the units in which the value is


expressed.

e xp re ss i o n

Property expression attribute on


page 117

The expression string for this property.

can S et Ex pression

Property canSetExpression attribute


on page 117

When true, the expression can be set by a script.

e xp re ss i o n E n ab l e d

Property expressionEnabled attribute


on page 118

When true, the expression is used to generate values for the property.

e xp re ss i o n E r ror

Property expressionError attribute on


page 118

The error, if any, that occurred when the last expression was evaluated.

113

After Effects Scripting Guide

JavaScript Reference

114

Attribute

Reference

Description

ke y fr am e In ter p ol at i on Ty p e

Property keyframeInterpolationType
attribute on page 119

The type of interpolation used at a keyframe.

s e l e c te d Ke y s

Property selectedKeys attribute on


page 128

All selected keyframes of the property.

prop er t y Index

Property propertyIndex attribute on


page 126

The position index of this property.

Methods
Method

Reference

Description

v alu eAt Time()

Property valueAtTime() method on


page 134

Gets the value of the property evaluated at given time.

s e tVal u e ( )

Property setValue() method on page 132

Sets the static value of the property.

s e tVal u e AtTi m e ( )

Property setValueAtTime() method on


page 132

Creates a keyframe for the property.

s e tVal u e s At Ti m e s( )

Property setValuesAtTimes() method on


page 133

Creates a set of keyframes for the property.

s e tVal u e AtKe y( )

Property setValueAtKey() method on


page 132

Finds a keyframe and sets the value of


the property at that keyframe.

ne arestKe y In dex()

Property nearestKeyIndex() method on


page 126

Gets the keyframe nearest to a specified


time.

ke y Ti m e( )

Property keyTime() method on page 124

Gets the time at which a condition


occurs.

ke y Valu e( )

Property keyValue() method on page 125

Gets the value of a keyframe at the time


at which a condition occurs.

a d dKe y ()

Property addKey() method on page 117

Adds a new keyframe to the property at


a given time.

rem oveKe y ( )

Property removeKey() method on


page 127

Removes a keyframe from the property.

i s In ter p o l a t i o n Ty p e Va l i d ()

Property isInterpolationTypeValid()
method on page 119

When true, this property can be interpolated.

s e tIn te r p o l at i o n Ty p e AtKe y( )

Property setInterpolationTypeAtKey()
method on page 128

Sets the interpolation type for a key.

ke y In In te r p o l at i o n Ty p e ()

Property keyInInterpolationType() method Gets the 'in' interpolation type for a key.
on page 120

ke y Out In ter p ol at i on Ty p e( )

Property keyOutInterpolationType()
method on page 121

Gets the 'out' interpolation type for a


key.

s e tS pa t i alTa ngen ts At Ke y( )

Property setSpatialTangentsAtKey()
method on page 130

Sets the in and out tangent vectors


for a key.

ke y In Sp at i a lTan g en t ()

Property keyInSpatialTangent() method on Gets the in spatial tangent for a key.


page 120

ke y Out Sp a ti a l Tan g en t ()

Property keyOutSpatialTangent() method


on page 121

Gets the out spatial tangent for a key.

s e tTemp or alEa se AtKe y ()

Property setTemporalEaseAtKey() method


on page 131

Sets the in and out temporal ease for


a key.

114

After Effects Scripting Guide

JavaScript Reference

115

Method

Reference

Description

ke y In Te m p o r a l E a s e ( )

Property keyInTemporalEase() method on


page 121

Gets the in temporal ease for a key.

ke y Out Tem p or a l E as e( )

Property keyOutTemporalEase() method


on page 122

Gets the out temporal ease for a key.

se tTemp or alContinuou sAtKe y ()

Property setTemporalContinuousAtKey()
method on page 131

Sets whether a keyframe has temporal


continuity.

ke y Te m p o r a l Co n t i n u o u s ( )

Property keyTemporalContinuous()
method on page 124

Reports whether a keyframe has temporal continuity.

s e t Te m p or al Au to B e z i e r At Ke y( )

Property setTemporalAutoBezierAtKey()
method on page 130

Sets whether a keyframe has temporal


auto-Bezier.

ke y Te m p o r a l Au t o B e z i e r ( )

Property keyTemporalAutoBezier()
method on page 124

Reports whether a keyframe has temporal auto-Bezier.

s e tS pa t i al Con t i nu o u sAtKe y( )

Property setSpatialContinuousAtKey()
method on page 129

Sets whether a keyframe has spatial


continuity.

ke y Sp a ti a l Con t inu ous ( )

Property keySpatialContinuous() method


on page 123

Reports whether a keyframe has spatial


continuity.

s e tS pa t i al AutoB e z i e r AtKe y

Property setSpatialAutoBezierAtKey()
method on page 129

Sets whether a keyframe has spatial


auto-Bezier.

ke ySp a ti a l AutoB ezi er( )

Property keySpatialAutoBezier() method


on page 123

Reports whether a keyframe has spatial


auto-Bezier.

s e tRov i n g At Ke y ( )

Property setRovingAtKey() method on


page 128

Sets whether a keyframe is roving.

ke y Rov i n g ()

Property keyRoving() method on page 122 Reports whether a keyframe is roving.

s e tS e l ec te dAtKe y( )

Property setSelectedAtKey() method on


page 129

Sets whether a keyframe is selected.

ke y S el e c ted ( )

Property keySelected() method on


page 123

Reports whether a keyframe is selected.

Example: Get and set the value of opacity


v ar my Prop er t y = my L ayer. op a c it y ;
//opa cit y ha s proper t yVa lue Ty p e of O n eD, a n d is store d as a flo at
my Prop er t y. s e t Val u e ( 0 . 5 ) ;
// Va r i able my O p acit y is a f l oa t v alu e
v ar my O pa c i t y = my Prop er t y.v al ue;
Example: Get and set the value of a position
v ar my Prop er t y = my L ayer. p o s it i o n ;
/ / p o s i t i on h as p rop e r t y Va l u e Ty p e o f T h re e D _ S PAT I AL , a n d i s store d a s a n ar r ay of 3 f l o at s
my Prop er t y. s e t Val u e ( [ 1 0 . 0 , 3 0 . 0 , 0 . 0 ]) ;
/ / Va r i a b l e my Pos i t io n i s a n a r r ay o f 3 f l o at s
v ar my Pos i t i o n = my Pro p e r t y. va l u e ;
Example: Change the value of a mask shape to be open instead of closed
v ar my Mas k = my l ayer. m as k( 1) ;
v ar my Prop er t y = my Ma sk .m as kS ha p e;
my Sh ap e = my Prop er t y.v alu e;

115

After Effects Scripting Guide

JavaScript Reference

116

my Sh ap e.clo se d = false;
my Prop er t y. s e t Val u e ( myS h a p e );
Example: Get the value of a color at a particular time

A color is stored as an array of four floats, [r,g,b,opacity]. This sets the value of the red component of a light's
color at time 4 to be half of that at time 2:
v ar my Prop er t y = my L i g ht .col or ;
v ar co lor Valu e = my Prop er t y.v alu eAt Ti me (2 ,t r u e) ;
co lor Valu e[0 ] = 0. 5 * col orVa lue[ 0] ;
my Prop er t y.set ValueAtTime(4,co lor Valu e);
Example: Check that a scale calculated by an expression at time 3.5 is the expected value of [10,50]
v ar my Prop er t y = my L ayer. sc a l e;
// false va lue of preExpression mea n s e va lua te t he expre ssion
v ar s c aleVa lue = my Prop er t y.v alu eAt Ti me (3. 5,f als e) ;
i f ( s c a l e Va lue [0 ] = = 1 0 & & s c a l e Va l u e [ 1 ] = = 5 0 ) {
a l er t( " hur r ay " ) ;
e l se {
a l er t( " o op s " );
}
Example: Keyframe a rotation from 0 to 90 and back again

The animation is 10 seconds, and the middle keyframe is at the 5 second mark. Rotation properties are stored
as a OneD value.
my Prop er t y = my L ayer. rot at i o n ;
my Prop er t y.set ValueAtTime(0, 0 );
my Prop er t y.set ValueAtTime(5, 9 0);
my Prop er t y.set ValueAtTime(10, 0);
Example: Change the keyframe values for the first three keyframes of some source text
my Prop er t y = my Tex tL ayer. so u rceTex t;
i f ( my Prop er t y.nu m Ke y s < 3 ) {
a l er t("er ror, I thoug h t there were 3 ke y f r a mes");
}
my Prop er t y. s e t Val u e At Ke y( 1 , n e w Tex t D oc u m en t ( " ke y nu m b e r 1 " ) ;
my Prop er t y. s e t Val u e At Ke y( 2 , n e w Tex t D oc u m en t ( " ke y nu m b e r 2 " ) ;
my Prop er t y. s e t Val u e At Ke y( 3 , n e w Tex t D oc u m en t ( " ke y nu m b e r 3 " ) ;
Example: Set values using the convenience syntax for position, scale, color, or source text
// Th ese t wo are e quiva lent . T he secon d fills in a defau l t of 0.
my Layer.p o sit i on.s et Valu e( [ 2 0, 3 0, 0] ) ;
my Layer.po sit i on.set Valu e([ 2 0, 3 0 ]);
// Th ese t wo are e quiva lent . T he secon d fills in a defau l t of 100 .
my Layer.scale. se t Valu e([ 50 , 50 , 10 0]);
my Layer.s c ale. se t Valu e( [ 50 , 50 ]) ;
// Th ese t wo are e quiva lent . T he secon d fills in a defau l t of 1.0
my Lig h t.color. se t Valu e([ .8 , .3 , .1 , 1.0 ]) ;
my Lig h t.color. se t Valu e([ .8 , .3 , .1 ]) ;
// Th ese t wo are e quiva lent . T he secon d crea tes a TextD o cument

116

After Effects Scripting Guide

JavaScript Reference

117

my Tex t L ayer.s ourceText .s e tVa lue( n ew Tex tD o c um en t( " fo o" )) ;


my Tex t L ayer.s ourceText .s e tVa lue( " fo o" ) ;

Property addKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .a dd Ke y( t i m e)
Description

Adds a new keyframe or marker to the named property at the specified time and returns the index of the new
keyframe.
Parameters
time

The time, in seconds, at which to add the keyframe. A floating-point value. The beginning of the composition is 0.

Returns

Integer; the index of the new keyframe or marker.

Property canSetExpression attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec . c a n S e t Ex pres si o n
Description

When true, the named property is of a type whose expression can be set by a script. See also Property
expression attribute on page 117.
Type

Boolean; read-only.

Property canVaryOverTime attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .canVa r yO verTim e
Description

When true, the named property can vary over timethat is, keyframe values or expressions can be written to
this property.
Type

Boolean; read-only.

Property expression attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ex pres s io n
Description

The expression for the named property. Writeable only when c a n S e t Ex p re ss i on for the named property is
true. When you specify a value for this attribute, the string is evaluated.
If the string contains a valid expression, ex pres si onEna bl e d becomes true.

117

After Effects Scripting Guide

JavaScript Reference

118

If the string does not contain a valid expression, an error is generated, and e xp re ss i o n E n ab l e d becomes

false.
If you set the attribute to the empty string, e xp re ss i on E n ab l e d becomes false, but no error is generated.
Type

String; read/write if can S et Ex pression for the named property is true, otherwise read-only.

Property expressionEnabled attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ex pres s io n E n ab l e d
Description

When true, the named property uses its associated expression to generate a value. When false, the keyframe
information or static value of the property is used. This attribute can be set to true only if c anS e tEx pres si on
for the named property is true and ex pres si on contains a valid expression string.
Type

Boolean; read/write.

Property expressionError attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ex pres s ion E r ror
Description

Contains the error, if any, generated by evaluation of the string most recently set in e xp re ss i o n . If no
expression string has been specified, or if the last expression string evaluated without error, contains the
empty string ("").
Type

String; read-only.

Property hasMax attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ha sMa x
Description

When true, there is a maximum permitted value for the named property; otherwise false.
Type

Boolean; read-only.

Property hasMin attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ha sMin
Description

When true, there is a minimum permitted value for the named property; otherwise false.

118

After Effects Scripting Guide

JavaScript Reference

119

Type

Boolean; read-only.

Property isInterpolationTypeValid() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .i sIn te r p o l a t io n Ty p e Val i d( t y p e )
Description

Returns true if the named property can be interpolated using the specified keyframe interpolation type.
Parameters
type

A Ke y fr am eIn ter p o la t i on Ty p e enumerated value; one of:

Ke y fr am eIn ter p o l at i on Ty p e .L I N E A R
Ke y fr am e In t e r p o l a t i on Ty p e .B E Z I E R
Ke y fr am eIn ter p o l at i on Ty p e .H OL D
Returns

Boolean.

Property isSpatial attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .isSp at i al
Description

When true, the named property defines a spatial value. Examples are position and effect point controls.
Type

Boolean; read-only.

Property isTimeVarying attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .isTimeVa r y i ng
Description

When true, the named property is time varyingthat is, it has keyframes or an enabled expression. When this
attribute is true, the attribute ca n Var y O verTi m e must also be true.
Type

Boolean; read-only.

Property keyframeInterpolationType attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec . ke y f r a m e In te r p o l a t io n Ty p e
Description

The type of interpolation used at a keyframe.


Type

A Ke y f r am eIn ter p ol at i on Ty p e enumerated value; read/write. One of:

119

After Effects Scripting Guide

JavaScript Reference

120

Ke y fr am eIn ter p o la t i on Ty p e .L I N E A R
Ke y fr ameIn ter p o la t ion Ty p e .BE ZIER
Ke y fr am eIn ter p o la t i on Ty p e .H OL D

Property keyInInterpolationType() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y In In ter p ol a t ion Ty p e( ke y In d e x)
Description

Returns the 'in' interpolation type for the specified keyframe.


Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..nu m Ke y s ], as returned by the ad d Ke y or n ea re st Ke y -

In dex method.
Returns

A Ke y f r am eIn ter p ol at i on Ty p e enumerated value; one of:


Ke y fr am eIn ter p o la t i on Ty p e .L I N E A R
Ke y fr ameIn ter p o la t ion Ty p e .BE ZIER
Ke y fr am eIn ter p o la t i on Ty p e .H OL D

Property keyInSpatialTangent() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y In Sp at ialTa n gent( ke y In d e x)
Description

Returns the incoming spatial tangent for the specified keyframe, if the named property is spacial (that is, the
value type is TwoD _ S PAT I AL or T hree D_ S PAT I AL ).
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..nu m Ke y s ], as returned by the ad d Ke y or n ea re st Ke y -

In dex method.
Returns

Array of floating-point values:


If the property value type is proper t y Valu eTy p e.TwoD _SPAT I AL , the array contains 2 floating-point

values.
If the property value type is proper t y Valu eTy p e.T hree D_SPATIAL , the array contains 3 floating-point

values.
If the property value type is neither of these types, an exception is generated.

120

After Effects Scripting Guide

JavaScript Reference

121

Property keyInTemporalEase() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec . v ke y In Te m p or al E a se (ke yInd ex )
Description

Returns the incoming temporal ease for the specified keyframe.


Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Array of KeyframeEase objects:


If the property value type is proper t y Valu eTy p e.TwoD _SPAT I AL , the array contains 2 objects.
If the property value type is proper t y Valu eTy p e.T hree D_SPATIAL , the array contains 3 objects.
For any other value type, the array contains 1 object.

Property keyOutInterpolationType() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y O u tIn ter p o l a t i on Ty p e (k e y In d e x )
Description

Returns the outgoing interpolation type for the specified keyframe.


Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

A Ke y f r am eIn ter p ol at i on Ty p e enumerated value; one of:


Ke y fr am eIn ter p o la t i on Ty p e .L I N E A R
Ke y fr ameIn ter p o la t ion Ty p e .BE ZIER
Ke y fr am eIn ter p o la t i on Ty p e .H OL D

Property keyOutSpatialTangent() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y O utS p at i alTangent( ke y In d e x)
Description

Returns the outgoing spatial tangent for the specified keyframe.


Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.

121

After Effects Scripting Guide

JavaScript Reference

122

Returns

Array of floating-point values:


If the property value type is proper t y Valu eTy p e.TwoD _SPAT I AL , the array contains 2 floating-point

values.
If the property value type is proper t y Valu eTy p e.T hree D_SPATIAL , the array contains 3 floating-point

values.
If the property value type is neither of these types, an exception is generated.

Property keyOutTemporalEase() method


a pp.proj ec t .i t e m ( in d e x) .l aye r( in d e x) .prop e r t yS p e c .ke y Out Tempor a lEase( ke y In d e x)
Description

Returns the outgoing temporal ease for the specified keyframe.


Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Array of KeyframeEase objects:


If the property value type is proper t y Valu eTy p e.TwoD _SPAT I AL , the array contains 2 objects.
If the property value type is proper t y Valu eTy p e.T hree D_SPATIAL , the array contains 3 objects.
For any other value type, the array contains 1 object.

Property keyRoving() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y Rov i ng( ke y In d e x)
Description

Returns true if the specified keyframe is roving. The first and last keyframe in a property cannot rove; if you
try to set roving for one of these, the operation is ignored, and ke y Rov i n g ( ) continues to return false.
If the property value type is neither TwoD _ S PAT I AL nor T h re e D _ S PAT I A L , an exception is generated.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Boolean.

122

After Effects Scripting Guide

JavaScript Reference

123

Property keySelected() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y S e l ec te d (k e y In d e x )
Description

Returns true if the specified keyframe is selected.


Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Boolean.

Property keySpatialAutoBezier() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y S p at i al AutoB e z ier (k e y In d e x)
Description

Returns true if the specified keyframe has spatial auto-Bezier interpolation. (This type of interpolation affects
this keyframe only if ke y Sp at i a lC on t i nu ous (k e y In d e x ) is also true.)
If the property value type is neither TwoD _ S PAT I AL nor T h re e D _ S PAT I A L , an exception is generated.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Boolean.

Property keySpatialContinuous() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec . ke y S p a t i a l Co n t i nuo us (k e y In d e x )
Description

Returns true if the specified keyframe has spatial continuity.


If the property value type is neither TwoD _ S PAT I AL nor T h re e D _ S PAT I A L , an exception is generated.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Boolean.

123

After Effects Scripting Guide

JavaScript Reference

124

Property keyTemporalAutoBezier() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y Temp or alAutoB e zier (ke yInd ex )
Description

Returns true if the specified keyframe has temporal auto-Bezier interpolation.


Temporal auto-Bezier interpolation affects this keyframe only if ke y f r am e In ter p ol at i on Ty p e is Ke y f r am eIn ter p o l a t ion Ty p e .B E Z I E R for both ke y In In te r p o l a t i o n ( ke y In de x) and ke y Out In ter p ol at i on ( ke y In de x ) .
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Boolean.

Property keyTemporalContinuous() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y Tem p o r a l Con t i nu ou s (ke yInd ex )
Description

Returns true if the specified keyframe has temporal continuity.


Temporal continuity affects this keyframe only if ke y fr am eIn ter p o la t i on Ty p e is Ke y f r am eIn ter p ol at i o n Ty p e. B E Z I E R for both ke y In In t e r p o l a t i on (k e y In d e x) and ke y O utIn ter p ol a t ion ( ke y In d e x) .
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Boolean.

Property keyTime() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y Ti me( ke y In de x )
a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y Ti me( m a r ke rCo m m e nt)
Description

Finds the specified keyframe or marker 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
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or
n e a re s t Ke y In d ex method.

m a r ke r Com m e n t

The comment string attached to a marker (see MarkerValue comment attribute on page 96).

124

After Effects Scripting Guide

JavaScript Reference

125

Returns

Floating-point value.

Property keyValue() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y Va lue (ke yInd ex )
a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .ke y Va lue (m a r k e r Com m e n t )
Description

Finds the specified keyframe or marker and returns its current value.
If no keyframe or marker can be found that matches the argument, this method generates an exception, and
an error is displayed.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or
n e a re s t Ke y In d ex method.

m a r ke r Com m e n t

The comment string attached to a marker (see MarkerValue comment attribute on page 96).

Returns

Floating-point value.

Property maxValue attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .maxVa lue
Description

The maximum permitted value of the named property. If the h a s Ma x attribute is false, an exception occurs,
and an error is generated.
Type

Floating-point value; read-only.

Property minValue attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec . m i n Val u e
Description

The minimum permitted value of the named property. If the ha sMin attribute is false, an exception occurs,
and an error is generated.
Type

Floating-point value; read-only.

125

After Effects Scripting Guide

JavaScript Reference

126

Property nearestKeyIndex() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .nea re st Ke yIndex( t i m e)
Description

Returns the index of the keyframe nearest to the specified time.


Parameters
time

The time in seconds; a floating-point value. The beginning of the composition is 0.

Returns

Integer.

Property numKeys attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .numKe ys
Description

The number of keyframes in the named property. If the value is 0, the property is not being keyframed.
Type

Integer; read-only.

Property propertyIndex attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .prop er t yIndex
Description

The position index of the named property. The first property is at index position 1.
Type

Integer; read-only.

Property propertyValueType attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .prop e r t y Val u e Ty p e
Description

The type of value stored in the named property. The Proper t y ValueTy p e enumeration has one value for each
type of data that can be stored in or retrieved from a property. Each type of data is stored and retrieved in a
different kind of structure. All property objects store data according to one of these categories.
For example, a 3D spatial property (such as a layer's position) is stored as an array of three floating point
values. When setting a value for position, pass in such an array, as follows:
my l ayer. pro p e r t y (" p o si t i o n " ). se t Valu e ([ 1 0 ,2 0 ,0] ) ;

In contrast, a shape property (such as a layer's mask shape) is stored as a Shape object. When setting a value
for a shape, pass a Shape object, as follows:
v ar my Sh ap e = n ew S h ap e () ;

126

After Effects Scripting Guide

JavaScript Reference

127

my Sh ap e.ver t ices = [[0,0 ],[0, 100 ], [1 00,1 00],[10 0,0]];


v ar my Mas k = my l ayer. pro p e r t y (" A DB E Mas k Par a de " ). prop e r t y (1 );
my Mas k .prop er t y ( " A DB E Ma sk S h ap e " ) .s e t Val u e ( myS h ap e );
Type

A Prop er t y ValueTy p e enumerated value; read/write. One of:


E

Proper t y Valu eTy p e.NO _VA LUE

Stores no data.

Proper t y Valu eTy p e.T hree D_SPATIAL

Array of three floating-point positional values. For example, an Anchor


Point value might be [10.0, 20.2, 0.0]

Proper t y Valu eTy p e.T hree D

Array of three floating-point quantitative values. For example, a Scale


value might be [100.0, 20.2, 0.0]

Proper t y Valu eTy p e.TwoD _SPATI AL

Array of 2 floating-point positional values For example, an Anchor Point


value might be [5.1, 10.0]

Proper t y Valu eTy p e.TwoD

Array of 2 floating-point quantitative values. For example, a Scale value


might be [5.1, 100.0]

Proper t y Valu eTy p e.O n eD

A floating-point value.

Proper t y Valu eTy p e.CO LO R

Array of 4 floating-point values in the range [0.0..1.0]. For example, [0.8,


0.3, 0.1, 1.0]

Proper t y Valu eTy p e.CU STOM _VALU E

Unimplemented type; you cannot get or set values for properties with this
type.

Proper t y Valu eTy p e.M ARKER

MarkerValue object; see MarkerValue object on page 95.

Proper t y Valu eTy p e.LAY E R_IND E X

Integer; a value of 0 means no layer.

Proper t y Valu eTy p e.M ASK_INDEX

Integer; a value of 0 means no mask.

Proper t y Valu eTy p e.SH APE

Shape object; see Shape object on page 159.

Proper t y Valu eTy p e.TE XT _D O C UM ENT

TextDocument object; see TextDocument object on page 165.

Property removeKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .rem ove Ke y ( ke y In de x )
Description

Removes the specified keyframe from the named property. If no keyframe with the specified index exists,
generates an exception and displays an error.
When a keyframe is removed, the remaining index numbers change. To remove more than one keyframe, you
must start with the highest index number and work down to the lowest to ensure that the remaining indices
reference the same keyframe after each removal.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


Returns

Nothing.

127

After Effects Scripting Guide

JavaScript Reference

128

Property selectedKeys attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se l e c te d Ke y s
Description

The indices of all the selected keyframes in the named property. If no keyframes are selected, or if the property
has no keyframes, returns an empty array.
Type

Array of integers; read-only.

Property setInterpolationTypeAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t In ter p ol at i on Ty p eAt Ke y ( inTy p e, outTy p e )
Description

Sets the in and out interpolation types for the specified keyframe.
Parameters
i n Ty p e

The incoming interpolation type. A Ke y f r a m eIn ter p ol a ti on Ty p e enumerated value; one


of:

Ke y fr am eIn ter p o l at i on Ty p e .L I N E A R
Ke y fr am e In t e r p o l a t i on Ty p e .B E Z I E R
Ke y fr am eIn ter p o l at i on Ty p e .H OL D
o u t Ty p e

(Optional) The outgoing interpolation type. If not supplied, the out type is set to the i n Ty p e
value. A Ke y f r a m eIn ter p ol a t ion Ty p e enumerated value; one of:

Ke y fr am eIn ter p o l at i on Ty p e .L I N E A R
Ke y fr am e In t e r p o l a t i on Ty p e .B E Z I E R
Ke y fr am eIn ter p o l at i on Ty p e .H OL D
Returns

Nothing.

Property setRovingAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Rov i ngAt Ke y( ke y In de x , n e w Va l )
Description

Turns roving on or off for the specified keyframe. The first and last keyframe in a property cannot rove; if you
try to set roving for one of these, the operation is ignored, and ke y Rov i n g ( ) continues to return false.
If the property value type is neither TwoD _ S PAT I AL nor T h re e D _ S PAT I A L , an exception is generated.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke y s ], as returned by the a d dKe y or n eares tKe y In dex method.

newVal

True to turn roving on, false to turn roving off.

128

After Effects Scripting Guide

JavaScript Reference

129

Returns

Nothing.

Property setSelectedAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Sele cted At Ke y( ke y In de x , o n O f f )
Description

Selects or deselects the specified keyframe.


Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


o n O ff

True to select the keyframe, false to deselect it.

Returns

Nothing.

Property setSpatialAutoBezierAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Sp a t ia l AutoB ez i erAt Ke y ( ke y In dex , n ew Val )
Description

Turns spatial auto-Bezier interpolation on or off for the specified keyframe .


If the property value type is neither TwoD _ S PAT I AL nor T h re e D _ S PAT I A L , an exception is generated.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


newVal

True to turn spatial auto-Bezier on, false to turn it off.

Returns

Nothing.

Property setSpatialContinuousAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .s e t S p a t i a l Co n t i n u o u s At Ke y (ke y In de x, n e w Va l )
Description

Turns spatial continuity on or off for the specified keyframe.


If the property value type is neither TwoD _ S PAT I AL nor T h re e D _ S PAT I A L , an exception is generated.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


newVal

True to turn spatial continuity on, false to turn it off.

129

After Effects Scripting Guide

JavaScript Reference

130

Returns

Nothing.

Property setSpatialTangentsAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Sp a t ia lTangent sAtKe y (k e y In d e x , i n Tan g e n t ,
ou tTa n ge n t )
Description

Sets the incoming and outgoing tangent vectors for the specified keyframe.
If the property value type is neither TwoD _ S PAT I AL nor T h re e D _ S PAT I A L , an exception is generated.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


i n Ta n g e n t

The incoming tangent vector. An array of 2 or 3 floating-point values.

If the property value type is prop er t y Va lueTy p e .Two D_ S PATIAL , the array contains 2 values.
If the property value type is prop er t y Va lueTy p e .Th re eD _SPATIA L , the array contains 3 values.
o u t Ta n gen t

(Optional) The outgoing tangent vector. If not supplied, the out tangent is set to the i n Ta n g e n t value. An
array of 2 or 3 floating-point values.

If the property value type is prop er t y Va lueTy p e .Two D_ S PATIAL , the array contains 2 values.
If the property value type is prop er t y Va lueTy p e .Th re eD _SPATIA L , the array contains 3 values.
Returns

Nothing.

Property setTemporalAutoBezierAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Temp or a l AutoB ezierAt Ke y( ke y In de x, n e w Va l )
Description

Turns temporal auto-Bezier interpolation on or off for the specified keyframe. When this is turned on, it
affects this keyframe only if ke y S p a t i a l Con t i nu o u s (ke yInd ex) is also true.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


newVal

True to turn temporal auto-Bezier on, false to turn it off.

Returns

Nothing.

130

After Effects Scripting Guide

JavaScript Reference

131

Property setTemporalContinuousAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .s e t Tem p o r a l Con t i n u o u s At Ke y ( ke y In d e x , n e w Va l )
Description

Turns temporal continuity on or off for the specified keyframe.


When temporal continuity is turned on, it affects this keyframe only if the Ke y f r am eIn ter p ol at i on Ty p e is
Ke y fr ameIn ter p o la t ion Ty p e .BE ZIER for both ke y In In te r p o l a t io n ( ke y In d e x) and ke y O ut In ter p ol a t i o n ( ke y In de x ) .
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


newVal

True to turn temporal continuity on, false to turn it off.

Returns

Nothing.

Property setTemporalEaseAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Temp or a l Eas eAtKe y( ke y In d e x , i n Te m p o ra l E a s e ,
ou tTe m p o ra lE as e )
Description

Sets the incoming and outgoing temporal ease for the specified keyframe. See KeyframeEase object on
page 79.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..nu m Ke y s ], as returned by the a dd Ke y or
n ea re st Ke y In dex method.

i n Tem p or a l E a se

The incoming temporal ease. An array of 1, 2, or 3 KeyframeEase objects.

If the property value type is proper t yVa lue Ty p e.TwoD _SPATIA L , the array contains 2
objects.

If the property value type is proper t yVa lue Ty p e.T hreeD _SPATIAL , the array contains 3
objects.

For all other value types, the array contains 1 object.


o u t Te m p o r a l E a s e

(Optional) The outgoing temporal ease. If not supplied, the outgoing ease is set to the i n Tem p o r a l E as e value. An array of 1, 2, or 3 KeyframeEase objects.

If the property value type is proper t yVa lue Ty p e.TwoD _SPATIA L , the array contains 2
objects.

If the property value type is proper t yVa lue Ty p e.T hreeD _SPATIAL , the array contains 3
objects.

For all other value types, the array contains 1 object.


Returns

Nothing.

131

After Effects Scripting Guide

JavaScript Reference

132

Property setValue() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Valu e( n e w Va l u e )
Description

Sets the static value of a property that has no keyframes.


If the named property has keyframes, this method generates an exception and displayes an error. To set the
value of a property with keyframes, use Property setValueAtTime() method on page 132 or Property
setValueAtKey() method on page 132.
Parameters
n e w Va lu e

A value appropriate for the type of property being set; see Property propertyValueType attribute on page 126.

Returns

Nothing.

Property setValueAtKey() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Valu eAt Ke y ( ke y In d e x , n e w Va l u e )
Description

Finds the specified keyframe and sets its value.


If the named property has no keyframes, or no keyframe with the specified index, this method generates an
exception and displays an error.
Parameters
ke y In dex

The index for the keyframe. An integer in the range [0..num Ke ys ], as returned by the ad d Ke y or n ear-

estKe y In dex method.


n e w Va lu e

A value appropriate for the type of property being set; see Property propertyValueType attribute on
page 126.

Returns

Nothing.

Property setValueAtTime() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Valu eAt Ti m e (t im e , n e w Valu e)
Description

Sets the value of a keyframe at the specified time. Creates a new keyframe for the named property, if one does
not currently exist for the specified time, and sets its value.
Parameters
time

The time in seconds, a floating-point value. The beginning of the composition is 0.

n e w Va lu e

A value appropriate for the type of property being set; see Property propertyValueType
attribute on page 126.

132

After Effects Scripting Guide

JavaScript Reference

133

Returns

Nothing.

Property setValuesAtTimes() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se t Valu es At Ti mes ( t im e s , n e w Va l u es)
Description

Sets values for a set of keyframes at specified of times. Creates a new keyframe for the named property, if one
does not currently exist for a specified time, and sets its value.
Times and values are expressed as arrays; the arrays must be of the same length.
Parameters
t i m es

An array of times, in seconds. Each time is a floating-point value. The beginning of the composition is 0.

n e w Va lu e s

A array of values appropriate for the type of property being set; see Property propertyValueType attribute on page 126.

Returns

Nothing.

Property unitsText attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec . u n i t sTex t
Description

The text description of the units in which the value is expressed.


Type

String; read-only.

Property value attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .va lue
Description

The value of the named property at the current time.


If ex p re ss i on E n ab l e d is true, returns the evaluated expression value.
If there are keyframes, returns the keyframed value at the current time.
Otherwise, returns the static value.

The type of value returned depends on the property value type. See examples for Property object on
page 113.
Type

A value appropriate for the type of the property (see Property propertyValueType attribute on page 126);
read-only.

133

After Effects Scripting Guide

JavaScript Reference

134

Property valueAtTime() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .va lueAtTi me( t im e , p re E x pre s s i o n)
Description

The value of the named property as evaluated at the specified time.


Note that the type of value returned is not made explicit; it will be of a different type, depending on the
property evaluated.
Parameters
time

The time in seconds; a floating-point value. The beginning of the composition is 0.

pre E x pres si o n

If the property has an expression and this is true, return the value for the specified time without
applying the expression to it. When false, return the result of evaluating the expression for the
specified time.
Ignored if the property does not have an associated expression.

Returns

A value appropriate for the type of the property (see Property propertyValueType attribute on page 126).

134

After Effects Scripting Guide

JavaScript Reference

135

PropertyBase object
a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). prop e r t y Sp ec
Description

Properties are accessed by name through layers, using various kinds of expression syntax, as controlled by
application preferences. For example, the following are all ways of access properties in the Effects group:
v ar effe ct 1 = app.proj ec t. item(1 ). layer( 1 ) . e f fe c t ( " Ad d Gr a i n " ) ( " Vi e w i n g Mo d e " ) ;
v ar effe ct 1a ga in = a pp. pro je c t .item(1).layer (1 ). effec t.a ddGr ain.v ie w i ngMo de ;
v ar ef fe c t 1a g a in too = a pp. pro je c t .i tem ( 1) .l ayer (1 )( " Ef fe c t s") .a d dGr a i n .v i ew i ngMo de;
v ar ef fe c t 1a ga in too 2 = a pp.proje c t.i tem (1 ).l ayer( 1) ("Ef fe c t s " )( "Ad d Gr ai n")( "Vie w i ng Mo de ");

See also PropertyGroup property() method on page 144.


PropertyBase is the base class for both Property and PropertyGroup, so PropertyBase attributes and

methods are available when working with properties and property groups. See Property object on
page 113 and PropertyGroup object on page 142.
Reference invalidation

When something occurs that changes an object sufficiently for the reference to become invalid, script references to that object can generate errors. In simple cases this is straightforward. For example, if you delete an
object, a reference to the deleted object generates the warning "Object is Invalid":
v ar layer 1 = app.proj ec t. item(1 ). layer(1);
layer 1.remove();
a l er t ( l ayer 1. n a m e ) ; / / i nv a l i d ref e ren ce to d e l e te d o b j e c t

Similarly, if you reference an AE property in a deleted object, the warning occurs:


v ar layer 1 = app.proj ec t. item(1 ). layer(1);
v ar l ayer 1 p o s i t io n = l ayer 1 .t r an s for m . p o s it i o n ;
layer 1.remove();
a l er t( l ayer 1 p o s i t io n . v al u e ) ; / / i nv al i d re feren ce to p ro p e r t y in d e l e c te d o b j e c t

A less straightforward case is when a property is removed from a property group. In this case, After Effects
generates the "Object is Invalid" error when you subsequently reference that item or other items in the group,
because their index positions have changed. For example:
v ar effe ct 1 = app.proj ec t. item(1 ). layer(1).effe c t (1 );
v ar effe ct 2 = app.proj ec t. item(1 ). layer(1).effe c t (2 );
v ar ef fe ct 2p ar am = app.proj ec t. item(1 ). layer( 1) .ef fe c t (2 ). blend Wi t hO r ig in al;
effe ct 1.remove();
a l er t( e f fe c t 2 .n a m e ) ; / / i nv al i d re feren ce b e c au se g ro u p in dex p o s i t i on s h ave cha n g e d
Attributes
Attribute

Reference

Description

name

PropertyBase name attribute on


page 139

Name of the property.

matchNam e

PropertyBase matchName attribute


on page 138

A special name for the property used to build unique naming paths.

135

After Effects Scripting Guide

JavaScript Reference

136

Attribute

Reference

Description

prop er t y Index

PropertyBase propertyIndex attribute


on page 140

Index of this property within its parent group.

prop er t y D ep t h

PropertyBase propertyDepth attribute The number of levels of parent groups between this property and
on page 139
the containing layer.

prop er t y Ty p e

PropertyBase propertyType attribute


on page 140

p aren tPro p e r t y PropertyBase parentProperty

The property type.

The immediate parent group of this property.

attribute on page 139

i s Mod i fi e d

PropertyBase isModified attribute on


page 138

When true, the property has been changed since its creation.

c a n S e t E n a bl e d

PropertyBase canSetEnabled attribute When true, the user interface displays an eyeball icon for this propon page 137
erty.

e n a bl e d

PropertyBase enabled attribute on


page 138

When true, this property is enabled.

a c t ive

PropertyBase active attribute on


page 136

When true, this property is active.

e l id ed

PropertyBase elided attribute on


page 137

When true, this property is not displayed in the user interface.

i s E ff e c t

PropertyBase isEffect attribute on


page 138

When true, this property is an effect.

i s Mas k

PropertyBase isMask attribute on


page 138

When true, this property is a mask.

s e l e c te d

PropertyBase selected attribute on


page 141

When true, this property is selected.

Methods
Method

Reference

prop er t y Group () PropertyBase propertyGroup()

Description
Gets the parent group for this property.

method on page 140

rem ove( )

PropertyBase remove() method on


page 141

Removes this from the project.

m oveTo( )

PropertyBase moveTo() method on


page 139

Moves this property to a new position in its parent group.

du pl i c ate( )

PropertyBase duplicate() method on


page 137

Duplicates this property object.

PropertyBase active attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec . a c t ive
Description

When true, this property is active. For a layer, this corresponds to the setting of the eyeball icon. For an effect
and all properties, it is the same as the ena b le d attribute.
Type

Boolean; read/write if c a n S e t E n a b le d is true, read-only if c a n S e t E n a bl e d is false.

136

After Effects Scripting Guide

JavaScript Reference

137

PropertyBase canSetEnabled attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec . c a n S e t E n a b l e d
Description

When true, you can set the e n a bl e d attribute value. Generally, this is true if the user interface displays an
eyeball icon for this property; it is true for all layers.
Type

Boolean; read-only.

PropertyBase duplicate() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .dup licate ()
Description

If this property is a child of an indexed group, creates and returns a new PropertyBase object with the same
attribute values as this one.
If this property is not a child of an indexed group, the method generates an exception and displays an error.
An indexed group has the type Prop er t y Ty p e .I N D E XE D_ G RO UP ; see PropertyBase propertyType attribute
on page 140.
Parameters

None.
Returns

PropertyBase object.

PropertyBase elided attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .elide d
Description

When true, this property is 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 panel.
For example, for a text layer with two animators and no properties twirled down, you might see:
Tex t
Pa th O p t i on s
More O p t i on s
Anim ator 1
Anim ator 2

In this example, Animator 1 and Animator 2 are contained in a PropertyBase called Text Animators.
This parent group is not displayed in the user interface, and so the two child properties are not indented in
the Timeline panel.
Type

Boolean; read-only.

137

After Effects Scripting Guide

JavaScript Reference

138

PropertyBase enabled attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .enabled
Description

When true, this property is enabled. It corresponds to the setting of the eyeball icon, if there is one; otherwise,
the default is true.
Type

Boolean; read/write if c a n S e t E n a b le d is true, read-only if c a n S e t E n a bl e d is false.

PropertyBase isEffect attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .isEf fe c t
Description

When true, this property is an effect PropertyGroup.


Type

Boolean; read-only.

PropertyBase isMask attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .isMa s k
Description

When true, this property is a mask PropertyGroup.


Type

Boolean; read-only.

PropertyBase isModified attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .isMo d if ied
Description

When true, this property has been changed since its creation.
Type

Boolean; read-only.

PropertyBase matchName attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .matchName
Description

A special name for the property used to build unique naming paths. The match name is not displayed, but you
can refer to it in scripts. Every property has a unique match-name identifier. Match names are stable from
version to version regardless of the display name (the n am e attribute value) or any changes to the application.
Unlike the display name, it is not localized.

138

After Effects Scripting Guide

JavaScript Reference

139

An indexed group may not have a nam e value, but always has a m a tch Na m e value. (An indexed group has the
type Pro p e r t y Ty p e. I N D E X E D _ G RO U P ; see PropertyBase propertyType attribute on page 140.)
Type

String; read-only.

PropertyBase moveTo() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .moveTo(n e w In de x )
Description

Moves this property to a new position in its parent property group.


This method is valid only for children of indexed groups; if it is not, or if the index value is not valid, the
method generates an exception and displays an error. (An indexed group has the type Prop ert y Ty p e. I N DE XE D _ G ROU P ; see PropertyBase propertyType attribute on page 140.)
Parameters
n e w In d e x

The new index position at which to place this property in its group. An integer.

Returns

Nothing.

PropertyBase name attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .nam e
Description

The display name of the property. (Compare PropertyBase matchName attribute on page 138.)
It is an error to set the n a m e value if the property is not a child of an indexed group (that is, a property group
that has the type Pro p e r t y Ty p e. I N D E X E D _ G RO U P ; see PropertyBase propertyType attribute on page 140).
Type

String; read/write for a child of an indexed group; otherwise read-only.

PropertyBase parentProperty attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .p arentProp er t y
Description

The property group that is the immediate parent of this property, or null if this PropertyBase is a layer.
Type

PropertyGroup object or null; read-only.

PropertyBase propertyDepth attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .prop er t yD ep th

139

After Effects Scripting Guide

JavaScript Reference

140

Description

The number of levels of parent groups between this property and the containing layer. The value 0 for a layer.
Type

Integer; read-only.

PropertyBase propertyGroup() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .prop er t yGrou p( )
a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .prop er t yGrou p( c oun t Up )
Description

Gets the PropertyGroup object for an ancestor group of this property at a specified level of the parent-child
hierarchy.
Parameters
co un tUp

Optional. The number of levels to ascend within the parent-child hierarchy. An integer in the
range [1..prop er t y D ep th ]. Default is 1, w hich gets the immediate parent.

Returns

PropertyGroup object, or null if the count reaches the containing layer.

PropertyBase propertyIndex attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .prop er t yIndex
Description

The position index of this property within its parent group, if it is a child of an indexed group (a property
group that has the type Pro p e r t y Ty p e. I N D E X E D _ G RO U P ; see PropertyBase propertyType attribute on
page 140).
Type

Integer; read-only.

PropertyBase propertyType attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .prop er t yTy p e
Description

The type of this property.


Type

A Prop er t y Ty p e enumerated value; read/write. One of:


Prop er t y Ty p e .P ROPE RT Y

A single property such as position or zoom.

Prop er t y Ty p e .I N D E XE D_ G RO UP

A property group whose members have an editable name and an index. Effects
and masks are indexed groups. For example, the m a s k s property of a layer
refers to a variable number of individual masks by index number.

140

After Effects Scripting Guide

JavaScript Reference

141

Prop er t y Ty p e .NA ME D _ G ROU P

A property group in which the member names are not editable. Layers are
named groups.

PropertyBase remove() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .rem ove ()
Description

Removes this property from its parent group. If this is a property group, it removes the child properties as well.
This method is valid only for children of indexed groups; if it is not, or if the index value is not valid, the
method generates an exception and displays an error. (An indexed group has the type Prop ert y Ty p e. I N DE XE D _ G ROU P ; see PropertyBase propertyType attribute on page 140.)
This method can be called on a text animation property (that is, any animator that has been set to a text layer).
Parameters

None.
Returns

Nothing.

PropertyBase selected attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Sp ec .se l e c te d
Description

When true, this property is selected. Set to true to select the property, or to false to deselect it.
Sampling this attribute repeatedly for a large number of properties can slow down system performance. To
read the full set of selected properties of a composition or layer, use the se l e c te d Prop er t i es attribute of a
Comp or Layer object.
Type

Boolean; read/write for an effect or mask property group, otherwise read-only.

141

After Effects Scripting Guide

JavaScript Reference

142

PropertyGroup object
a pp. pro je c t .i tem ( i n d e x) .l ayer (i n de x ). prop e r t y Grou p Sp e c
Description

The PropertyGroup object represents a group of properties. It can contain Property objects and other
PropertyGroup objects. Property groups can be nested to provide a parent-child hierarchy, with a Layer object
at the top (root) down to a single Property object, such as the mask feather of the third mask. To traverse the
group hierarchy, use PropertyBase methods and attributes; see PropertyBase propertyGroup() method on
page 140.
For examples of how to access properties and property groups, see PropertyBase object on page 135.
PropertyGroup is a subclass of PropertyBase. All methods and attributes of PropertyBase, in addition to

those listed below, are available when working with PropertyGroup. See PropertyBase object on page 135.
PropertyGroup is a base class for MaskPropertyGroup. PropertyGroup attributes and methods are available

when working with mask groups. See MaskPropertyGroup object on page 97.
Attributes
Attribute

Reference

Description

nu m Prop er t i es

PropertyGroup numProperties attribute on page 143 The number of indexed properties in the group.

Methods
Method

Reference

Description

prop er t y ( )

PropertyGroup property() method on


page 144

Gets a member property or group.

c a n Ad dPro p e r t y ()

PropertyGroup canAddProperty() method


on page 143

Reports whether a property can be added to the group.

a d dProp er t y ()

PropertyGroup addProperty() method on


page 142

Adds a property to the group.

PropertyGroup addProperty() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Grou p Sp e c.a d dProp er t y (n a m e )
Description

Creates and returns a PropertyBase object with the specified name, and adds it to this group.
In general, you can only add properties to an indexed group (a property group that has the type
Prop er t y Ty p e .I N D E XE D_ G RO UP ; see PropertyBase propertyType attribute on page 140) The only
exception is a text animator property, which can be added to a named group (a property group that has the
type Prop er t y Ty p e.NA ME D _ G ROU P) .
If this method cannot create a property with the specified name, it generates an exception. To check that you
can add a particular property to this group, call c a n Ad dPro p e r t y before calling this method. (See PropertyGroup canAddProperty() method on page 143.)

142

After Effects Scripting Guide

JavaScript Reference

143

Parameters
name

The display name or match name of the property to add. (See PropertyBase matchName attribute on page 138).
The following names are supported:

Any match name for a property that can be added through 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 match name, such as ADBE Bulge, ADBE Glo2, APC Vegas.
Any effect by display name, such as Bulge, Glow, Vegas.
For text animators, ADBE Text Animator.
For selectors, Range Selector has the name ADBE Text Selector, Wiggly Selector has the name ADBE Text Wiggly
Selector, and Expression Selector has the name ADBE Text Expressible Selector.

Returns

PropertyBase object.

PropertyGroup canAddProperty() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Grou p Sp e c.ca n Ad dProp er t y(n a m e)
Description

Returns true if a property with the given name can be added to this property group. For example, you can only
add mask to a mask group. The only legal input arguments are mask or ADBE Mask Atom.
m a sk Gro u p. ca n Ad d Prop e r t y ( " m as k" ) ; / / re tu r n s t r u e
m a sk Gro u p. ca n Ad d Prop e r t y ( " A DB E Ma s k Ato m " ) ; / / re tu r n s t r u e
m a s k Gro u p. ca n Ad d Prop e r t y ( " bl e n d " ) ; / / re t u r n s fa l s e
Parameters
name

The display name or match name of the property to be checked. (See PropertyGroup addProperty() method on page 142).

Returns

Boolean.

PropertyGroup numProperties attribute


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Grou p Sp e c.nu m Prop er t i es
Description

The number of indexed properties in this group.


For layers, this method returns a value of 3, corresponding to the mask, effect, and motion tracker groups,
which are the indexed groups within the layer. However, layers also have many other properties available only
by name; see the PropertyGroup property() method on page 144.
Type

Integer; read-only.

143

After Effects Scripting Guide

JavaScript Reference

144

PropertyGroup property() method


a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Grou p Sp e c.p ro p e r t y( in d e x)
a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop e r t y Grou p Sp e c.p ro p e r t y( n am e )
Description

Finds and returns a child property of this group, as specified by either its index or name.
A name specification can use the same syntax that is available with expressions. The following are all allowed
and are equivalent:
my l ayer. p o s it i o n
my l ayer (" p o si t i o n " )
my l ayer. prop er t y ("p o si t i on")
my l ayer (1 )
my l ayer. prop er t y (1 )

Some properties of a layer, such as position and zoom, can be accessed only by name.
When using the name to find a property that is multiple levels down, you must make more than one call to
this method. For example, the following call searches two levels down, and returns the first mask in the mask
group:
my L ayer.p rop e r t y ( " A D BE Mas ks " ) .prop e r t y ( 1 )
Parameters
i n dex

The index for the child property, in this is an indexed group. An integer in the range [0..nu m Prop er -

t i es ].
name

The name of the child property. This can be:

Any match name


Any name in expression parenthesis style syntax, meaning the display name or the compact English
name

Any name in expression intercap style syntax


For supported property names, see the table below.

Returns

PropertyBase object or null if no child property with the specified string name is found.
Properties accessible by name
From any Layer

"ADBE Mask Parade", or Masks


"ADBE Effect Parade", or Effects
"ADBE MTrackers", or Motion Trackers

144

After Effects Scripting Guide

JavaScript Reference

145

From an AVLayer

"Anchor Point" or "anchorPoint"


"Position" or "position"
"Scale" or "scale"
"Rotation" or "rotation"
"Z Rotation" or "zRotation" or "Rotation Z" or "rotationZ"
"Opacity" or "opacity"
"Marker" or "marker"

From an AVLayer with a non-still source

"Time Remap" or "timeRemapEnabled"

From an AVLayer with an audio component

"Audio Levels" or "audioLevels"

From a camera layer

"Zoom" or "zoom"
"Depth of Field" or "depthOfField"
"Focus Distance" or "focusDistance"
"Aperture" or "aperture"
"Blur Level" or "blurLevel"

From a light layer

"Intensity" or "intensity"
"Color" or "color"
"Cone Angle" or "coneAngle"
"Cone Feather" or "coneFeather"
"Shadow Darkness" or "shadowDarkness"
"Shadow Diffusion" or "shadowDiffusion"
"Casts Shadows" or "castsShadows"

From a 3D layer

"Accepts Shadows" or "acceptsShadows"


"Accepts Lights" or "acceptsLights"
"Ambient" or "ambient"
"Diffuse" or "diffuse"
"Specular" or "specular"
"Shininess" or "shininess"
"Casts Shadows" or "castsShadows"
"Light Transmission" or "lightTransmission"
"Metal" or "metal"

From a camera, light or 3D layer

"X Rotation" or "xRotation" or "Rotation X" or "rotationX"


"Y Rotation" or "yRotation" or "Rotation Y" or "rotationY"
"Orientation" or "orientation"

From a text layer

"Source Text" or "sourceText" or "Text" or "text"

From a PropertyGroup "ADBE Mask Parade"

"ADBE Mask Atom"

From a PropertyGroup "ADBE Mask Atom"

"ADBE Mask Shape", or maskShape


"ADBE Mask Feather", or maskFeather
"ADBE Mask Opacity", or maskOpacity
"ADBE Mask Offset", or maskOffset

145

After Effects Scripting Guide

JavaScript Reference

146

Examples

1 If a layer named myLayer has a Box Blur effect, you can retrieve the effect in any of the following ways:
my L ayer.p rop e r t y ( E f fe c t s ) .prop e r t y ( B ox Blu r );
my L ayer.p rop e r t y ( E f fe c t s ) .prop e r t y ( b ox Blur ) ;
my L ayer.p rop e r t y ( E f fe c t s ) .prop e r t y ( A D BE B ox Bl u r ) ;

2 If a layer named myLayer has a mask named Mask 1 you can retrieve it as follows:
my L ayer.p rop e r t y ( Ma sk s ) .p rop e r t y ( Ma sk 1 ) ;

3 To get a Bulge Center value from a Bulge effect, you can use either of the following:
my L ayer.p rop e r t y ( E f fe c t s ) .prop e r t y ( Bu l g e ) .prop e r t y ( Bul g e Cen te r ) ;
my L ayer.p rop e r t y ( E f fe c t s ) .prop e r t y ( Bu l g e ) .prop e r t y ( b u l g e Ce n ter ) ;

146

After Effects Scripting Guide

JavaScript Reference

147

RenderQueue object
a pp. pro je c t .renderQ ueue
Description

The RenderQueue object represents the render automation process, the data and functionality that is available
through the Render Queue panel of a particular After Effects project. Attributes provide access to items in the
render queue and their render status. Methods can start, pause, and stop the rendering process.
The RenderQueueItem object provides access to the specific settings for an item to be rendered. See RenderQueueItem object on page 150.
Attributes
Attribute

Reference

Description

ren der in g

RenderQueue rendering attribute on page 149

When true, a render is in progress.

nu m Item s

RenderQueue numItems attribute on page 148

The total number of items in the render queue.

i te m s

RenderQueue items attribute on page 148

The collection of items in the render queue.

Methods
Method

Reference

Description

s h ow Win dow( )

RenderQueue showWindow() method Show or hides the Render Queue panel.


on page 149

ren der( )

RenderQueue render() method on


page 148

Starts the rendering process; does not return until render is


complete.

p au se Re n der in g ()

RenderQueue pauseRendering()
method on page 148

Pauses or restarts the rendering process.

s to pRen d e r i n g ( )

RenderQueue stopRendering()
method on page 149

Stops the rendering process.

i te m ( )

RenderQueue Item() method on


page 147

Gets a render-queue item from the collection.

RenderQueue Item() method


a pp. pro je c t .renderQ ueue. item( i n de x)
Description

Gets a specified item from the i te m s collection.


Parameters
i n dex

The position index of the item. An integer in the range [0..num Item s ].

Returns

RenderQueueItem object.

147

After Effects Scripting Guide

JavaScript Reference

148

RenderQueue items attribute


a pp. pro je c t .renderQ ueue. items
Description

A collection of all items in the render queue. See RenderQueueItem object on page 150.
Type

RQItemCollection object; read-only.

RenderQueue numItems attribute


a pp. pro je c t .renderQ ueue. numItems
Description

The total number of items in the render queue.


Type

Integer; read-only.

RenderQueue pauseRendering() method


a pp. pro je c t .renderQ ueue. pa useRender i ng( p a u s e)
Description

Pauses the current rendering process, or continues a paused rendering process. This is the same as clicking
Pause in the Render Queue panel during a render. You can call this method from an o n S t a t u sC h a n ge d or
o n E r ror callback . See RenderQueueItem onStatusChanged attribute on page 152 and Application onError
attribute on page 26.
Parameters
p au se

True to pause a current render process, false to continue a paused render.

Returns

Nothing.

RenderQueue render() method


a pp. pro je c t .renderQ ueue. render()
Description

Starts the rendering process. This is the same as clicking Render in the Render Queue panel. The method does
not return until the render process is complete. To pause or stop the rendering process, call pa useRender i ng()
or s top Ren de r i n g ( ) from an o n E r ror or o n S t a t u sC h a n g e d callback.
To respond to errors during the rendering process, define a callback function in a pp. on E r ror ; see Appli-

cation onError attribute on page 26.


To respond to changes in the status of a particular item while the render is progressing, define a callback

function in RenderQu eu eItem.onSta tusChange d in the associated RenderQueueItem object; see RenderQueueItem onStatusChanged attribute on page 152.

148

After Effects Scripting Guide

JavaScript Reference

149

Parameters

None.
Returns

Nothing.

RenderQueue rendering attribute


a pp. pro je c t .renderQ ueue. render ing
Description

When true, the rendering process is in progress or paused. When false, it is stopped.
Type

Boolean; read-only.

RenderQueue showWindow() method


a pp. pro je c t .renderQ ueue. sh ow Wi ndow ( do Sh ow)
Description

Shows or hides the Render Queue panel.


Parameters
doS h ow

When true, show the Render Queue panel. When false, hide it.

Returns

Nothing.

RenderQueue stopRendering() method


a pp. pro je c t .renderQ ueue. stop Render ing()
Description

Stops the rendering process. This is the same as clicking Stop in the Render Queue panel during a render. You
can call this method from an o n S t a t u sC h a n g e d or o n E r ror callback . See RenderQueueItem onStatusChanged attribute on page 152 and Application onError attribute on page 26.
Parameters

None.
Returns

Nothing.

149

After Effects Scripting Guide

JavaScript Reference

150

RenderQueueItem object
a pp. pro je c t .renderQ ueue. items( i n d e x)
Description

The RenderQueueItem object represents an individual item in the render queue. It provides access to the
specific settings for an item to be rendered.
Attributes
Attribute

Reference

Description

nu m Out p utMo du le s

RenderQueueItem numOutputModules
attribute on page 152

The total number of Output Modules assigned tothe


item.

ren der

RenderQueueItem render attribute on


page 153

When true, this item is rendered when the queue is


started.

s ta r t Ti m e

RenderQueueItem startTime attribute on


page 154

The time when rendering began for the item.

e l ap se d S e co n d s

RenderQueueItem elapsedSeconds
attribute on page 151

The time elapsed in the current rendering of this item.

t i m e S p an S t ar t

RenderQueueItem timeSpanStart
attribute on page 155

The start time in the composition to be rendered.

t i m eS p an D ur at i o n

RenderQueueItem timeSpanDuration
attribute on page 155

The duration of the composition to be rendered.

s ki p Fr a m e s

RenderQueueItem skipFrames attribute


on page 154

The number of frames to skip when rendering this item.

com p

RenderQueueItem comp attribute on


page 151

The composition to be rendered by this item.

outputMo du le s

RenderQueueItem outputModules
attribute on page 153

The collection of Output Modules for this item.

tem pl a tes

RenderQueueItem templates attribute on A set of Render Settings templates.


page 155

s ta tu s

RenderQueueItem status attribute on


page 154

The current rendering status of the item.

onStatusChanged

RenderQueueItem onStatusChanged
attribute on page 152

A callback function that is called during the rendering


process when the status of the item changes.

l o g Ty p e

RenderQueueItem logType attribute on


page 152

A log type for this item.

Methods
Method

Reference

Description

outputMo du le ()

RenderQueueItem outputModule() method on


page 153

Gets an Output Module for the item.

rem ove( )

RenderQueueItem remove() method on page 153

Removes the item from the render queue.

s aveAs Tem p l ate( )

RenderQueueItem saveAsTemplate() method on


page 154

Saves a new Render Settings template.

a pp ly Te m p l ate ( )

RenderQueueItem applyTemplate() method on


page 151

Applies a Render Settings template.

150

After Effects Scripting Guide

JavaScript Reference

151

Method

Reference

Description

du pl i c ate

RenderQueueItem duplicate() method on page 151

Duplicates this item.

RenderQueueItem applyTemplate() method


a pp. pro je c t .renderQ ueue. item .a pp ly Te m p l ate ( te m p la te Nam e )
Description

Applies a Render Settings template to the item. See also RenderQueueItem saveAsTemplate() method on
page 154 and RenderQueueItem templates attribute on page 155.
Parameters
tem pl a teNam e

A string containing the name of the template to apply.

Returns

Nothing.

RenderQueueItem comp attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). com p
Description

The composition that will be rendered by this render-queue item. To change the composition, you must delete
this render-queue item and create a new one.
Type

CompItem object; read-only.

RenderQueueItem duplicate() method


a pp. pro je c t .renderQ ueue. item (i n de x ). dup l i c ate ()
Description

Creates a duplicate of this item and adds it this render queue.


Parameters

None.
Returns

RenderQueueItem object.

RenderQueueItem elapsedSeconds attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). e l a ps e dS e co n d s
Description

The number of seconds spent rendering this item.

151

After Effects Scripting Guide

JavaScript Reference

152

Type

Integer, or null if item has not been rendered; read-only.

RenderQueueItem logType attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e. l o g Ty p e
Description

A log type for this item, indicating which events should be logged while this item is being rendered.
Type

A Log Ty p e enumerated value; (read/write). One of:


L o g Ty p e . E R RO R S _ O N LY
L o g Ty p e . E R RO R S _ A N D _ S E T T I N G S
L o g Ty p e . E R RO R S _ A N D _ PE R _ F RA ME _ I N F O

RenderQueueItem numOutputModules attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). numO ut put Mo dules
Description

The total number of Output Modules assigned to this item.


Type

Integer; read-only.

RenderQueueItem onStatusChanged attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). onSt at us Ch ange d
Description

The name of a callback function that is called whenever the value of the Ren derQ ueueItem.sta tu s attribute
changes. See RenderQueueItem status attribute on page 154.
You cannot make changes to render queue items or to the application while rendering is in progress or paused;
you can, however, use this callback to pause or stop the rendering process. See RenderQueue pauseRendering() method on page 148 and RenderQueue stopRendering() method on page 149.
See also Application onError attribute on page 26.
Type

A function name string, or null if no function is assigned.


Example
f u n c t io n my S ta tu s Ch an g e d( ) {
a l er t(a pp. pro je c t .renderQ ueue. item(1 ). st at us)
}
a pp. pro je c t .renderQ ueue. item(1 ). onSt at usCh anged = my St atu sCha n ge d();
a pp. pro je c t .renderQ ueue. item(1 ). render = false; //change s sta tus a n d shows dia l og

152

After Effects Scripting Guide

JavaScript Reference

153

RenderQueueItem outputModules attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e s
Description

The collection of Output Modules for the item.


Type

OMCollection object; read-only.

RenderQueueItem outputModule() method


a pp. pro je c t .renderQ ueue. item (i n de x ). o u t p ut Mo d u l e ( i n d e x)
Description

Gets an output module with the specified index position.


Parameters
i n dex

The position index of the ouptut module. An integer in the range [0..num Out putMo dule s ].

Returns

OutputModule object.

RenderQueueItem remove() method


a pp. pro je c t .renderQ ueue. item (i n de x ). rem ove ()
Description

Removes this item from the render queue.


Parameters

None.
Returns

Nothing.

RenderQueueItem render attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). ren d er
Description

When true, the item will be rendered when the render queue is started. When set to true, the Ren derQ ueueItem.st atu s is set to RQ Item St at us .QU E UE D . When set to false, st at us is set to RQ Item S ta tu s. U N QU E U E D .
Type

Boolean; read/write.

153

After Effects Scripting Guide

JavaScript Reference

154

RenderQueueItem saveAsTemplate() method


a pp. pro je c t .renderQ ueue. item (i n de x ). saveAs Temp l ate (n a m e)
Description

Saves the items current render settings as a new template with the specified name.
Parameters
name

A string containing the name of the new template.

Returns

Nothing.

RenderQueueItem skipFrames attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). sk i p Fr am es
Description

The number of frames to skip when rendering this item. Use this to do rendering tests that are faster than a
full render.
A value of 0 skip no frames, and results in regular rendering of all frames. A value of 1 skips every other frame.
This is equivalent to "rendering on twos." Higher values skip a larger number of frames.
The total length of time remains unchanged. For example, if skip has a value of 1, a sequence output would
have half the number of frames and in movie output, each frame would be double the duration.
Type

Integer in the range [0..99]. Read/write.

RenderQueueItem startTime attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). st ar tTi m e
Description

The day and time that this item started rendering.


Type

Date object, or null if the item has not started rendering; read-only.

RenderQueueItem status attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). st at us
Description

The current render status of the item.

154

After Effects Scripting Guide

JavaScript Reference

155

Type

An RQItem S t atu s enumerated value; read-only. One of:


RQ Ite m St a t u s . W I L L _ C ON T I N U E

Rendering process has been paused.

RQ Ite m S t a t u s . N E E D S _ O U T P U T

Item lacks a valid output path.

RQ Item St at us .U N QUE U E D

Item is listed in the Render Queue panel but composition is not ready to render.

RQ Item St at us .QU E UE D

Composition is ready to render.

RQ Item St at us .RE N D E RI N G

Composition is rendering

RQ Item St at us .U SER _ STO P PED

Rendering process was stopped by user or script.

RQ Item St at us .E RR _ STO P PE D

Rendering process was stopped due to an error.

RQ Item St at us .D ON E

Rendering process for the item is complete.

RenderQueueItem templates attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). tem p l ate s
Description

The names of all Render Settings templates available for the item. See also RenderQueueItem saveAsTemplate()
method on page 154.

Type

Array of strings; read-only.

RenderQueueItem timeSpanDuration attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). t im eS pa n D ur a t i on
Description

The duration in seconds of the composition to be rendered. The duration is determined by subtracting the
start time from the end time. Setting this value is the same as setting a custom end time in the Render Settings
dialog box.
Type

Floating-point value; read/write.

RenderQueueItem timeSpanStart attribute


a pp. pro je c t .renderQ ueue. item (i n de x ). t im eS pa n S ta r t
Description

The time in the composition, in seconds, at which rendering will begin. Setting this value is the same as setting
a custom start time in the Render Settings dialog box.
Type

Floating-point value; read/write.

155

After Effects Scripting Guide

JavaScript Reference

156

RQItemCollection object
a pp. pro je c t .renderQ ueue. items
Description

The RQItemCollection contains all of the render-queue items in a project, as shown in the Render Queue
panel of the project. The collection provides access to the RenderQueueItem objects, but does not provide any
additional functionality. The first RenderQueueItem object in the collection is at index position 1. See
RenderQueueItem object on page 150
RQCollection is a subclass of Collection. All methods and attributes of Collection are available when

working with RQCollection. See Collection object on page 49.

156

After Effects Scripting Guide

JavaScript Reference

157

Settings object
Description

The Settings object provides an easy way to manage settings for scripts. The settings are saved in the After
Effects preferences file and are persistent between application sessions. Settings are identified by section and
key within the file, and each key name is associated with a value. In the preferences file, section names are
enclosed in brackets and quotation marks, and key names are listing in quotation marks below the section
name. All values are strings.
You can create new settings with this object, as well as accessing existing settings.
Methods
Method

Reference

Description

s aveS e t t in g ()

Settings saveSetting() method on page 158

Saves a default value for a setting.

g e t S e tt i n g ( )

Settings getSetting() method on page 157

Retrieves a setting value.

h aveS e tt i n g ( )

Settings haveSetting() method on page 157

Reports whether a specified setting is assigned.

Settings getSetting() method


a pp.s e t t i ng s . g e t S e t t i n g ( s e c t i on Na m e , k e yNa m e)
Description

Retrieves a scripting preferences item value from the preferences file.


Parameters
s e c t i on Na m e

A string containing the name of a settings section

ke y Na m e

A string containing the key name of the setting item.

Returns

String.
Example

If you have saved a setting named with the key name Aligned Clone in the Eraser - Paint Settings section,
you can retrieve the value with this script:
v ar n = ap p.s e tt i n g s .get S e tt i n g( "Er a ser - Pa i n t S e tt i n g s ", "Ali g n e d Clone ") ;
a l er t ( " T h e s e t t i n g i s " + n ) ;

Settings haveSetting() method


a pp.s e t t i ng s .have S e tt i n g ( s e c t i o n Na m e , ke y Na m e)
Description

Returns true if the specified scripting preferences item exists and has a value.

157

After Effects Scripting Guide

JavaScript Reference

158

Parameters
s e c t i on Na m e

A string containing the name of a settings section

ke y Na m e

A string containing the key name of the setting item.

Returns

Boolean.

Settings saveSetting() method


a pp.s e t t i ng s .saveSe tt i ng( s ec t i on Nam e , ke y Na m e, va lue )
Description

Saves a default value for a scripting preferences item.


Parameters
s e c t i on Na m e

A string containing the name of a settings section

ke y Na m e

A string containing the key name of the setting item.

v alu e

A string containing the new value.

Returns

Nothing.

158

After Effects Scripting Guide

JavaScript Reference

159

Shape object
a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop er t y (i n de x ). prop e r t y ( " m as kS h a p e " ). v al u e
Description

The Shape object encapsulates information describing the outline shape of a Mask. It is the value of a
maskShape AE property. Use the constructor, new S h a p e ( ) , to create a new, empty Shape object, then set
the attributes individually to define the shape.
A shape has a set of anchor points, or vertices, and a pair of direction handles, or tangent vectors, for each
anchor point. A tangent vector (in a non-RotoBezier mask) determines the direction of the line that is drawn
to or from an anchor point. There is one incoming tangent vector and one outgoing tangent vector associated
with each vertex in the shape.
A tangent value is a pair of x,y coordinates specified relative to the associated vertex. For example, a tangent
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 its influence; for example, an incoming shape
segment stays closer to the vector for an i n Ta n g e n t of [-2,-2] than it does for an in Tan g en t of
[-1,-1], even though both of these come toward the vertex from the same direction.
If a shape is not closed, the i n Ta n g e n t for the first vertex and the o ut Ta n g en t for the final vertex are ignored.
If the shape is closed, these two vectors specify the dirction handles of the final connecting segment out of the
final vertex and back into the first vertex.
RotoBezier masks calculate their tangents automatically. (See MaskPropertyGroup rotoBezier attribute on
page 98.) If a shape is used in a RotoBezier mask, the tangent values are ignored. This means that, for
RotoBezier masks, you can construct a shape by setting only the ver t ices attribute and setting both i n Tan ge n t s
and o u t Ta n gen t s to null. When you access the new shape, its tangent values are filled with the automaticallycalculated tangent values.
Example: Create a square mask

A square is a closed shape with 4 vertices. The i n Tan g e n t s and o u t Ta n g e n t s for connected straight-line
segments are 0, the default, and do not need to be explicitly set.
v ar my Sh ap e = n ew S h ap e () ;
my Sh ap e .ver t ice s = [ [ 0 ,0 ], [ 0 , 1 ] , [ 1 ,1 ], [ 1 , 0 ] ];
my Sh ap e.cl o se d = t r ue;
Example: Create a U shaped mask

A "U" is an open shape with the same 4 vertices used in the square:
v ar my Sh ap e = n ew S h ap e () ;
my Sh ap e .ver t ice s = [ [ 0 ,0 ], [ 0 , 1 ] , [ 1 ,1 ], [ 1 , 0 ] ];
my Sh ap e.clo se d = false;
Example: Create an oval

An oval is a closed shape with 4 vertices and with i n Ta n g e n t and o u t Ta n g e n t values:


v ar my Sh ap e = n ew S h ap e () ;
my Sh ap e.ver t ices = [[300 ,50],[ 20 0,1 50],[300 ,25 0],[4 00, 150 ]];
my Sh ap e.inTa ngents = [[55. 23,0 ], [0 ,-55 .23],[-55 .23 ,0],[0,5 5.2 3]];
my Sh ap e.out Ta n gent s = [[-5 5.2 3,0 ],[0, 55. 23],[55. 23, 0],[0,-55 .23 ]];
my Sh ap e.cl o se d = t r ue;

159

After Effects Scripting Guide

JavaScript Reference

160

Attributes
Attribute

Reference

Description

cl o se d

Shape closed attribute on page 160

When true, the shape is a closed curve.

ver t ices

Shape vertices attribute on page 161

The anchor points of the shape.

i n Ta n g e n ts

Shape inTangents attribute on page 160

The tangent vectors coming into the shape vertices.

o u t Ta n gen t s

Shape outTangents attribute on page 160

The tangent vectors coming out of the shape vertices.

Shape closed attribute


.. .prop er t y( "mas k Sh ap e") .va lue .clos ed
Description

When true, the first and last vertices are connected to form a closed curve. When false, the closing segment is
not drawn.
Type

Boolean; read/write.

Shape inTangents attribute


.. .prop er t y( "mas k Sh ap e") .va lue .inTan gent s
Description

The incoming tangent vectors, or direction handles, associated with the vertices of the shape. Specify each
vector as an array of two floating-point values, and collect the vectors into an array the same length as the
ver t ices array.
Each tangent value defaults to [0,0]. When the mask shape is not RotoBezier, this results in a straight line
segment.
If the shape is in a RotoBezier mask, all tangent values are ignored and the tangents are automatically calculated.
Type

Array of floating-point pair arrays; read/write.

Shape outTangents attribute


.. .prop er t y( "mas k Sh ap e") .va lue .out Tangent s
Description

The outgoing tangent vectors, or direction handles, associated with the vertices of the shape. Specify each
vector as an array of two floating-point values, and collect the vectors into an array the same length as the
ver t ices array.
Each tangent value defaults to [0,0]. When the mask shape is not RotoBezier, this results in a straight line
segment.
If the shape is in a RotoBezier mask, all tangent values are ignored and the tangents are automatically calculated.

160

After Effects Scripting Guide

JavaScript Reference

161

Type

Array of floating-point pair arrays; read/write.

Shape vertices attribute


.. .prop er t y( "mas k Sh ap e") .va lue .ver t i ces
Description

The anchor points of the shape. Specify each point as an array of two floating-point values, and collect the
point pairs into an array for the complete set of points. For example:
my Sh ap e .ver t ice s = [ [ 0 ,0 ], [ 0 , 1 ] , [ 1 ,1 ], [ 1 , 0 ] ];
Type

Array of floating-point pair arrays; read/write.

161

After Effects Scripting Guide

JavaScript Reference

162

SolidSource object
a pp. pro je c t .i tem ( in d e x) . m a i n S o u rce
a pp. pro je c t .i tem ( in d e x) .p roxySo urce
Description

The SolidSource object represents a solid-color footage source.


SolidSource is a subclass of FootageSource. All methods and attributes of FootageSource, in addition to

those listed below, are available when working with SolidSource. See FootageSource object on page 65.
Attributes
Attribute

Reference

Description

co lor

SolidSource color attribute on page 162

The color of the solid.

SolidSource color attribute


s olid S ourc e. col or
Description

The color of the solid, expressed as red, green, and blue values.
Type

Array of three floating-point values, [R, G, B], in the range [0.0..1.0]; read/write.

162

After Effects Scripting Guide

JavaScript Reference

163

System object
s ys te m
Description

The System object provides access to attributes found on the users system, such as the user name and the
name and version of the operating system. It is available through the s ys te m global variable.
Example
a l er t ( "Your O S is " + system.osna m e + " r unning version " + system.o sversion );
con f i r m ( " Yo u a re : " + s ys te m . u s e r Na m e + " r un n i n g o n " + s y s t e m . m a ch i n e Na m e + " . " ) ;
Attributes
Attribute

Reference

Description

u s e r Nam e

System userName attribute on page 164

The current user name.

m a chi n e Na m e

System machineName attribute on page 163 The name of the host computer.

o s Nam e

System osName attribute on page 164

The name of the operating system.

o s Ver s i o n

System osVersion attribute on page 164

The version of the operating system.

Method

Reference

Description

c a l l Sy s te m ( )

System callSystem() method on page 163

Executes a commandon the systems command line.

Methods

System callSystem() method


s ys te m . c a l lSys te m ( c m d L i n e To Exe c u te ) ;
Description

Executes a system command, as if you had typed it on the operating systems command line. Returns whatever
the system outputs in response to the command, if anything.
Parameters
c m d L i n e To Exec u te

A string containing the command and its parameters.

Returns

The output from the command.

System machineName attribute


s ys te m . mach ineName
Description

The name of the computer on which After Effects is running.


Type

String; read-only.

163

After Effects Scripting Guide

JavaScript Reference

164

System osName attribute


s ys te m . osNa me
Description

The name of the operating system on which After Effects is running.


Type

String; read-only.

System osVersion attribute


s ys te m . osVersion
Description

The version of the current local operating system.


Type

String; read-only.

System userName attribute


s ys te m . u s er Na m e
Description

The name of the user currently logged on to the system.


Type

String; read-only.

164

After Effects Scripting Guide

JavaScript Reference

165

TextDocument object
n e w Tex t D o c u m e n t (d oc Te x t )
a pp. pro je c t .i tem ( in d e x) .layer(i n de x ). prop er t y ( "So urce Text").v alu e
Description

The TextDocument object stores a value for a TextLayer's Source Text property. Create it with the constructor,
passing the string to be encapsulated.
Examples

This sets a value of some source text and displays an alert showing the new value:
v ar my Tex t D o c u m en t = n e w Tex t D o c u m en t( " Ha p p y C a ke" ) ;
my Tex t L ayer.p ro p e r t y( " S o u rc e Tex t " ) . s e t Val u e ( my Tex t D o c u m e n t ) ;
a l er t( my Tex t L ayer.p rop er t y ( " S ou rce Tex t" ) .va lue );

This sets keyframe values for text that show different words over time:
v a r tex tPro p = myTex t L ayer.prop e r t y ( " S o u rce Text " ) ;
tex tPro p. se tVa lue At Ti m e ( 0 , n e w Tex t D o c u m e n t ( " Hap py " ) ) ;
tex tPro p. se tVa lue At Ti m e ( . 3 3 , n e w Tex tD o c u m e n t (" c a ke" ) );
tex tPro p. se tVa lue At Ti m e ( . 6 6 , n e w Tex tD o c u m e n t (" i s " )) ;
tex tPro p. se tVa lue At Ti m e ( 1 , n e w Tex t D o c u m e n t ( " yu m my! " )) ;
Attributes
Attribute

Reference

Description

tex t

TextDocument text attribute on page 165

The text layers Source Text value.

TextDocument text attribute


t e x t D o c u m e n t.text
Description

The text value for the text layers Source Text property.
Type

String; read/write.

165

After Effects Scripting Guide

JavaScript Reference

166

TextLayer object
a pp. pro je c t .i tem ( in d e x) .l ayer(i n de x )
Description

The TextLayer object represents a text layer within a composition. Create it using the LayerCollection objects
a d dTex t method; see LayerCollection addText() method on page 93. It can be accessed in an items layer
collection either by index number or by a name string.
TextLayer is a subclass of AVLayer, which is a subclass of Layer. All methods and attributes of AVLayer and

Layer are available when working with TextLayer. See Layer object on page 81 and AVLayer object on
page 39.
AE Properties

TextLayer defines no additional attributes, but has the following AE properties and property groups, in
addition to those inherited from AVLayer:
Tex t
S o u rce Tex t
Pa th O pt i on s
Pa th
Re verse Path
Per p en di c ul a r To Pa th
Force A l i g n m e n t
F i r s t Ma r g i n
L a s t Mar g i n
More O p t i on s
Anchor Point Grouping
Gro up in g Al i g n m e n t
F i l l & S t roke
In ter- C ha r a c ter Bl en d i n g
Anim ators
Unused Properties and Attributes

The Ti m e Rem a p and Mot i on Tr ac kers properties, inherited from AVLayer, are not applicable to text layers,
and their related AVLayer attributes are not used:
c a n S e t Ti m e Rem a p E n a bl e d
t i m eRem ap E n ab l e d
t r ackMat teTy p e
i s Tr a ck Ma tte
h as Tr a ck Ma tte

166

Examples

The following sample scripts are included on your CD. This section provides 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 scriptings more complex
features in action. It also shows some typical programming constructions from JavaScript that apply to
scripting.
For more examples from Adobe and from other After Effects users, visit Adobe Studio Exchange at
h t t p : / / s h a re . s t u d i o.a d o b e .com , and choose Script in the Adobe After Effects section.

Apply effect
This simple example 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. For a localized application, the effect
name, Fast Blur, and the names of its properties blurriness and repeatEdgePixels would need to be
localized.
This script does the following:
checks that at least one selected layer can have effects applied to it;
adds Fast Blur to any selected layer that can have it;
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 hi 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
f un c t i o n app l y Fa st BlurTo L ayer(t he _ layer) {
v ar ad de dIt = f al s e;
/ / Ca n o n l y a d d a n e f f e c t i f t he re ' s a n e f f e c t s g ro u p i n t he l ayer.
/ / S o m e l ayer s d on 't h ave o n e , l i ke c a m e r a a n d l i g h t l ayer s .
i f ( the _ l aye r ( " E f fec t s" ) ! = nul l) {
/ / A lw ay s b e s t t o che ck if i t ' s s a f e b ef o re a d d i n g :
i f ( the _ l aye r ( " E f fec t s" ) .c an Add Pro p e r t y (" Fas t Bl u r " ) ) {
// a dd a new Fast Blu r effec t to th e effec ts g rou p of th e layer
var the _ fx = th e_layer( "Ef fe c t s" ) .a d dPro p e r t y (" Fas t Bl u r " ) ;
// s e t t h e p a r am e ter v al u e s
the _ fx .b lu r r i n e s s .s e t Valu e ( 1 0 ) ;
the _ fx.rep eat E dgePixels.set Value(t r u e);
ad de dIt = t r u e;
}

167

After Effects Scripting Guide

Examples

168

}
/ / Re t u r n a b oo le an s ay i n g w h e t h e r t he e f f e c t w as a d d e d
re tur n a d de dIt;
}
/ / S t a r t a n u n d o g ro u p. By u si n g t hi s w i t h an en d Un do Group ( ), yo u
// a l l ow us ers to undo t he w ho le sc r i p t w i th one undo op er at i on.
a p p. b e g i n Un d o Grou p( " App ly Fas t Bl u r to S e l e c t i o n s ") ;
/ / If we d on 't f i n d a ny s e l e c te d l ayer s , p u t u p a n a l e r t a t t h e e n d .
v ar nu m L aye r s Ch an g e d = 0 ;
/ / G e t t he a c t ive com p
v ar a c t iveItem = app.proj ec t. ac t ive Item ;
i f ( a c t ive Item ! = nul l & & ( a c t ive Item i n s t a n ce of Com p Ite m ) ) {
v ar a c t iveCom p = ac t ive Item ;
/ / t r y to a pp ly t o e ve r y se l e c te d layer
v ar sele ctedLayers = ac t ive Comp. se l ec te dL ayers;
for ( v a r i = 0 ; i < s e le c te d L ayer s. l en g th ; i ++ ) {
v ar c u r L aye r = s e l e c te d L ayer s [i ] ;
/ / T h e m e t h o d ret u r n s t r u e i f it a dd s the eff ec t, fa l se oth er w i s e.
i f ( a p p ly Fas t B lu rTo L ayer ( c u r L aye r ) = = t r u e) {
nu m L ayers Ch an g e d+ +;
}
}
}
/ / Pr i n t a m e s s a g e i f n o l ayer s w e re a f f e c te d
if (nu m LayersCh ange d == 0 ) {
a l er t( " P l e as e s e le c t a n AV l ayer o r l ayer s a n d r u n s c r i p t ag ai n " ) ;
}
a pp. e n dUn do Grou p( ) ;
}

Replace text
This script shows the basics for a very useful operation, the automatic editing of text layers. The script looks
for selected text layers that contain the text string blue and changes this string to read monday. The word
can 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.
This script does the following:
sets a function that replaces all instances of blue with monday;
sets a function that applies the first function to a single layer, looking for all Source Text keyframes where

blue might appear, evaluating and reporting each time whether any text was changed;
sets a single undo group for all changes made by the script;
pops up a warning if no layers were changed, instructing the user how to properly apply the script.
{
/ / T h i s s c r i p t re p l a ce s t ex t i n a l l t h e s e l e c t e d tex t l ayer s .
/ / It f i n ds al l i n st an ces o f t h e word " bl u e " a n d ch an g e s t h e m to " m on d ay "
/ / T h i s f un c t i on t akes the St r in g a n d re pl a ce s f i rst Word w it h s econ d Word .
// It rep e at s, s o i t w i l l re pl a ce al l i n s ta n ce s of fi rs tWord i n t heS t r i n g .

168

After Effects Scripting Guide

Examples

169

// Re tu r n s the chan ge d st r i ng .
f un c t io n rep l aceTex tIn S t r i n g ( the S t r in g , f i rst Wo rd , s econ dWord) {
v ar n ew S t r i n g = t he St r i n g ;
w hi l e ( n e wS t r i n g .i n dex Of (f i r st Wo rd ) ! = - 1 ) {
n e w S t r i n g = n e wS t r i n g .rep la ce ( fi r s tWo rd ,s e con dWord) ;
}
re tur n n ewS t r i n g ;
}
/ / T h i s f u n c t i on a p p l i e s t h e cha n ge to o n e s i n g l e l ayer
f u n c t io n rep l a ce Tex t In L ayer ( t h e L aye r, f i r s t Word , s e con d Word ) {
v ar ch an g ed S om e th i n g = f al s e;
// Ge t t he sou rceText prop er t y, if there is one.
v ar s ource Tex t = t he L ayer.s ource Tex t ;
i f (s ource Text != nul l ) {
i f ( s o u rce Te xt . nu m Ke y s = = 0 ) {
/ / tex tVa lue i s a Tex tD o c u m e n t . Re t r i e ve t h e s t r i n g i n s id e
v ar o l d S t r i n g = s o u rceText .v alu e .tex t;
i f ( o l d S t r i n g . i n d ex O f ( f irs t Word ) ! = - 1 ) {
v ar n e w S t r i n g = rep l a ce Tex tIn S t r i n g ( o l d St r i n g , f i r st Word , s e con d Word ) ;
if (oldString != newString) {
sou rceTex t.s e tVa lue (n e wS t r i n g ) ;
ch an g e dS om e t hi n g = t r ue ;
}
}
} else {
/ / D o i t f o r e a ch ke y fr am e :
for ( v a r ke y In dex = 1 ; ke y In dex < = s o u rce Tex t . nu m Ke y s; ke y In de x+ + ) {
/ / tex tVa lue i s a Tex tD o c u m e n t . Re t r i e ve t h e s t r i n g i n s id e
v ar o l d S t r i n g = s o u rceText .ke y Val u e ( ke y In de x ). tex t ;
i f ( o l d S t r i n g . i n d ex O f ( f irs t Word ) ! = - 1 ) {
v ar n e wS t r i n g = re pl a ce Tex t In St r i n g ( o l d S t r in g , fi r s tWo rd , s e con dWord) ;
if ( o l d S t r i n g ! = n e w S t r in g ) {
so urceTex t. se t Valu eAt Ke y ( ke y In dex ,n ew S t r in g );
cha n g ed S om e thi n g = t r u e;
}
}
}
}
}
/ / Re t u r n a b oo le an s ay i n g w h e t h e r w e rep l a ce d a ny t ex t
re tur n ch an g e dS om e t hi n g ;
}
/ / S t a r t a n u n d o g ro u p. By u si n g t hi s w i t h an en d Un do Group ( ), yo u
// a l l ow us ers to undo t he w ho le sc r i p t w i th one undo op er at i on.
a p p. b e g i n Un d o Grou p( " App ly Tex t C h a n g e to S e l e c t i on s" ) ;
/ / If we d on 't m a ke a ny ch a n g e s , w e ' l l p u t u p a n a l er t a t t h e en d .
v ar nu m L aye r s Ch an g e d = 0 ;
/ / G e t t he a c t ive com p
v ar a c t iveItem = app.proj ec t. ac t ive Item ;
i f ( a c t ive Item ! = nul l & & ( a c t ive Item i n s t a n ce of Com p Ite m ) ) {

169

After Effects Scripting Guide

Examples

170

v ar a c t iveCom p = ac t ive Item ;


/ / t r y to a pp ly t o e ve r y se l e c te d layer
v ar sele ctedLayers = ac t ive Comp. se l ec te dL ayers;
for ( v a r i = 0 ; i < s e le c te d L ayer s. l en g th ; i ++ ) {
v ar c u r L aye r = s e l e c te d L ayer s [i ] ;
/ / T h e m e t h o d ret u r n s t r u e i f it cha n g e s a ny tex t , f a l s e o t h e r w i s e .
if (replaceTextInLayer(cu rLayer, "blu e", "monday") == t r ue ) {
nu m L ayers Ch an g e d+ +;
}
}
}
/ / Pr i n t a m e s s a g e i f n o l ayer s w e re a f f e c te d
if (nu m LayersCh ange d == 0 ) {
// No te: if you p ut qu otes i n th e i n ter i or of t he s t r i ng ,
/ / t h e y m u s t b e p re ce d e d by a ba ck s l a s h , a s i n \ " b lue \ " b e l ow.
a l er t( " P l eas e s e le c t a tex t layer or l ayers con t a i n i n g t h e word \ " b lu e \ " a n d r u n s c r i p t a g a i n " ) ;
}
a pp. e n dUn do Grou p( ) ;
}

Save and increment


Although much of the functionality of this script has been superseded by the incremental save feature that was
introduced in After Effects 6.5, it is still included here because it makes effective use of conditionals, functions,
and the ExtendScript File objects.
This script automatically saves a new copy of the open After Effects project and increments a three-digit
number in its name to distinguish it from previous versions of the project. This script is saved as
s ave_ a n d _ in c rem e n t . j s x in your installation folder.
The first step is to determine whether the currently open project has ever been saved. This is accomplished
with an opening if/else statement. The first condition, !a pp.proje ct .f ile , is saying that if the project has not
been saved, an alert telling the user to save the project is popped up, and the script ends.
i f (!a pp.pro j e c t.f i l e ) {
a l er t ( " T h i s p ro j e c t m u s t b e s aved b e f ore r u n n i n g t h i s s c r i p t . " ) ;

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 l a s t In dex O f () JavaScript function
searches a string backwards (from end to start) and in this case looks for the dot that separates the name from
the extension.
} else {
v ar c u r rF i l e = a p p.p ro je c t . fi l e ;
v ar c u r rF i l e Nam e = c u r r F il e . n a m e;
v ar ext Pos = cu r r F ile Na m e.la st In dexO f(".");
v ar e xt = " " ;

Now we set the c u r r F i l e Na m e variable to the current name, before the dot.
i f (ext Pos ! = - 1 ) {
ext = cu r r F ile Na m e.subst r ing (ext Pos, cur rFileNam e.lengt h);
c u r rF i l e Nam e = c u r r Fi l e Na m e . s u b s t r in g (0 , ex t Po s) ;

170

After Effects Scripting Guide

Examples

171

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 c u r rF i l e Nam e . 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.
v ar i n c re m e n ter = 0 ;
i f (c u r r F i l e Na m e . ch a r At( c u r r F i l eName. length - 4) = = "_") {
i n c rem e n ter = c u r rF i le Na m e . su b s t r i n g (c u r r F ile Na m e.l en g t h - 3 , c ur rF i l eNam e .l en g th );
c u r rF i l e Nam e = c u r r Fi l e Na m e . s u b s t r in g (0 , c u r rF i l e Nam e . l e n g t h - 4 ) ;
}

Now we add an incrementer loop and test for whether the numbering has extended to two or three digits (for
example, if the numbering has reached _010 or above, or _100 or above), assigning a zero for each if not.
i n c rem e n ter + +;
v a r i s t r in g = i n c rem e n ter + " " ;
i f ( i n c rem e n te r < 1 0 ) {
i s t r in g = " 0 " + i st r i n g ;
}
i f ( i n c rem e n te r < 1 0 0 ) {
i s t r in g = " 0 " + i st r i n 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.
v ar n e w F i l e = F il e ( c u r r F i l e . p a t h + " / " + c u r rF i le Na m e + " _ " + i s t r i n g + e xt ) ;
a l er t( n ew F i l e.f s Nam e );
a pp. pro je c t .s ave( n e w F i l e ) ;
}

Render named items


This script finds compositions in the open project with a particular text string in their names and sends all
such compositions to the render queue.
To start, we check to see if a default string for rendering has already been set in the user preferences. If so, we
set this as a user prompt. This is handy if youre always looking for the same string (for example, FINAL or
CURRENT). If not, we set a new s e c t i o n Na m e and ke yNa m e for the preferences file along with a placeholder value for the string that will be entered by the user.
v ar s e c t i on Na m e = " A E E xa m p l e S c r i p t s" ;
v ar ke yNa m e = "Render comps w it h t his st r i ng";
v ar s e a rch St r i n g = " " ;
i f (a pp. se t t in g s . h aveS e tt i n g ( s ec t ion Na m e, ke y Na m e) ) {
s e a rch St r i n g = a p p.s e tt i n g s . g e t S e tt i n g ( se c t i o n Na m e , ke yNa m e ) ;
}

Now we display a prompt to the user asking for what text string we should use.
s e a rch St r i n g = p ro m p t ( " Wha t s t r i n g to ren d e r ? " , s e a rchS t r i n g ) ;

171

After Effects Scripting Guide

Examples

172

We next go through the project looking for the text entered by the user, and check if the item that contains
that text is a composition. We send 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, converting it to all
lowercase letters for consistency (although the search is not case sensitive).
i f (s e a rch St r i n g ) {
a pp. se t ti n g s .s aveS e t t in g (s ec t i o n Na m e, ke y Nam e , s earchS t r i n g ) ;
s ea rch St r i n g = se archS t r i n g .toL owerCa se () ;
f o r ( i = 1 ; i < = a p p.p ro je c t . num Item s ; + + i ) {
v ar c ur Item = ap p. pro je c t .i tem ( i );
i f ( c u r Ite m i n s t a n c e o f Com pIte m) {
if (cur Item .nam e.to LowerCase(). indexO f(searchSt r i ng) != -1 ) {
a pp. pro je c t .renderQ ueue. items.a dd(cu rItem);
}
}
}

Finally, we make the Render Queue panel visible and bring it to the front, ready for the user to assign save
locations for the new render queue items.
a pp. pro je c t .renderQ ueue. sh ow Wi ndow (t r ue );
}

New render locations


This script allows the user to select queued items in the render queue and assign a new render destination for
them.
First, we prompt the user for a new folder to use as a render destination.
v ar n e w L o c a t i o n = f o l d e r Ge t D ia l o g ( " S ele c t a render dest in at ion ... ");

Next, we make certain that the user entered a new location (and didnt cancel). 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.
if (new Loca tion) { //b oo lean to se e if th e user cancel led
for (i = 1 ; i <= app.pro jec t .ren derQ ueue.numItems; ++ i) {
v ar cur Item = app. pro je c t .renderQ ueue. item(i);
i f (c ur Item .st at us == RQItem S t atu s. QUE U E D ) {
f o r ( j = 1 ; j < = c u r Item . num O u t p u t Mo d u l e s ; + + j ) {
v ar c u r O M = c u r Item . o u t pu t Mo dul e ( j ) ;
v ar oldLo c at ion = cu rO M.file;
c u r OM .f il e = n e w F i l e ( n e w Lo c a t i on . to S t r i n g ( ) + " / " + o ld L o c a t i o n . n a m e ) ;
a l er t( c ur OM. fi l e. f sNa m e) ;
}
}
}
}

172

After Effects Scripting Guide

Examples

173

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 in
dialog boxes, such as which layer of a multi-layer image (such as 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. We then define and call a function to import all of the files, one by one.
v ar t arge tFolder = fo lderGe tD ialo g("Impor t Items from Folder. ..");
/ / re t u r n s a f o l d e r o r nu l l
i f (t a r g e tFo l der ) {
f u n c t io n p ro ce s s F il e (t h e F i l e ) {
v ar i m p o r tO p t i o n s = n e w Im p o r t O p t io n s (t h e F il e );
//create a v ar i able cont aining Im p or t O p t ions
i m p o r tS a feWit hE r ror ( i m p o r t O p t i on s) ;
}

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 arent of a type that cant be imported as a sequence (moving image files).
We then check adjacent files to see if a sequence exists, stopping after weve evaluated ten files to save
processing time.
f u n c t io n t e s t For S e q u en ce ( f i le s) {
v ar s e a rch er = n e w Re g E x p ( " [ 0 - 9 ] +" ) ;
v ar m ov i e F i l e S e arch e r = n e w Re g Ex p ( " ( m ov| av i| m p g ) $ " , " i " ) ;
v ar p a r s e Re su l t s = n e w Ar r ay ;
for ( x = 0 ; ( x < f ile s. len g th ) & x < 1 0; x + +) {
//te st th at we have a s equ ence, stop pa rsi n g a f ter 10 fi l es
v ar mov i eFileResult = mov i e F ile S earcher.exec(file s[x]. name );
i f (! m ov ie F il e Resu lt ) {
v ar c u r re n t Re su l t = s e a rch er. exe c (f i l e s [x ] . n a m e ) ;

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.
i f (c ur rentRe sul t ) {
/ / w e h ave a m a tch - t h e s t r i n g con t a i n s num b e r s
/ / t h e m a tch o f t h o s e num b e r s i s s t ore d i n t h e a r r ay [ 1 ]
/ / t a ke t h a t n u m b e r a n d s ave i t i n to p a r s e Re s u lt s
p ar s e Re su l t s[ p ars e Res u l ts .l e n g t h ] = c u r re n tRe su l t [ 0 ] ;
}
e l se {
p ar s e Re su l t s[ p ars e Res u l ts .l e n g t h ] = n u l l ;
}
}
e l se {
p ar s e Re su l t s[ p ars e Res u l ts .l e n g t h ] = n u l l ;
}

173

After Effects Scripting Guide

Examples

174

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 ar resu l t = nul l ;
for (i = 0 ; i < parseResult s. l ength ; + +i) {
i f (p ars eRe sul t s[ i ]) {
i f (! res u l t) {
resu l t = fi l e s [ i] ;
}
} else {
/ / c a s e i n w hi ch a f i l e n a m e d i d n o t con t a i n a n u m b e r
resu l t = nul l ;
b re a k ;
}
}
re tur n res ul t;
}

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 tS a f e Wi t h E r ror ( i m p o r t O p t i o n s ) {
try {
a pp. pro je c t .i m p o r tF i l e ( im p or t O pt i o n s );
} c atch (er ro r ) {
a l er t( e r ror.toS t r i n g ( ) + i m p o r t O p t i on s .f i l e .f s Nam e );
}
}

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.forceAlphabetical = true by removing the two slashes at the beginning of that line.
f u n c t io n p ro ce s s Fo l d e r (t h e Fo l d e r ) {
v ar f i l es = t heFol der.ge tF i l es () ;
/ / G e t a n a r r ay o f f i l e s i n t h e t a r g e t f o l d e r
//te st w h et her t heFolder conta in s a se quence
v ar s e qu e n ceS t ar tF i l e = tes tFor S e qu e n ce (f i l e s );
//if it doe s cont ain a se quence, impor t t he se quence
i f ( s e q u en ce S t ar tF i l e ) {
v ar i m p o r tO p t i o n s = n e w Im p o r t O p t ion s (s e quen ce S tar t Fi l e) ;
//create a v ar i able cont aining Im p or t O p t ions
i m p or tO p t i ons. se quence = t r ue;
/ / i m p o r t O p t i on s. fo rceA l p h a b e t i c a l = t r u e ;
//un -com m ent this if you want to force alph a order by default
i m p o r tS a feWit hE r ror ( i m p o r t O p t i on s) ;
}
//ot her w i se , impor t th e file s a n d re curse
for ( i n de x i n f i l e s ) {
//Go t hro ug h t he a r r ay, se t ea ch e lement to sing leFile, r un th is:

174

After Effects Scripting Guide

Examples

175

i f (f i l es [i ndex ] i n s ta n ce of F i l e) {
i f (! s e quence St ar tFi l e) {
/ / i f fi l e i s al rea dy p ar t o f a s e qu e n ce , don ' t i m p o r t i t i n d iv id u al ly
pro ce s s Fi l e ( f i le s[ i n de x] ) ;
/ / c al l s the pro ce ss F i l e f un c t ion a b ove
}
}
i f (f i l es [i ndex ] i n s ta n ce of Fol der) {
proces sFol d er (f i l es [in dex ]) ; / / rec u rs i on
}
}
}
proces sFol der (t arge t Fol d er );
}

Render and email


This script renders all queued items in an open project and sends an email report to indicate when the render
has completed. It makes use of two other scripts that follow, email_methods.jsx (to send the email properly)
and email_setup.jsx (which establishes the sender, recipient, and email server).
We start by establishing conditions under which the script will run. An open project with at least one item
queued is required.
{
v ar s af eToRun Sc r i p t = t r u e;
s afe ToRun Sc r i p t = app.p ro j e c t ! = nu l l ;
if (! app.proje c t) {
a l er t ( " A p ro j e c t m u s t b e op e n to r u n th is s c r i p t ." );
}
i f (s a f e To Ru n Sc r i p t) {
de bugger ;
//che ck th e render queue and make cer ta i n at le ast one item is queue d
s afe ToRun Sc r i p t = fa l se ;
for (i = 1 ; i <= app.pro jec t .ren derQ ueue.numItems; ++ i) {
i f (a pp. pro je c t .renderQ ueue. i tem( i) .s ta tu s = = RQ ItemS ta tus .QU E UE D) {
s afe ToRun Sc r i p t = t r u e ;
b re a k ;
}
}
i f (! s a f e To Ru n S cr i p t) {
a l er t ( " You do n ot h ave a ny items s e t to render.") ;
}
}

Now check whether we have email settings already saved in the preferences. If so, we dont need to prompt the
user. If not, run the em ai l _ se tu p. jsx script, which prompts the user for the mail gateway, sender and recipient
addresses. If there are saved settings that you need to change, you can always run the script to make new
settings that overwrite the existing ones.
i f (s a f e To Ru n Sc r i p t) {
v ar s e tt i n g s = ap p.s e tt i n g s ;

175

After Effects Scripting Guide

Examples

176

i f ( ! s e tt i n g s . h aveS e tt i n g ( " E m a i l S e tt i n g s " , " Ma i l S e r ve r " ) | |


! s e tt i n g s . h ave S e tt i n g ( " E m a i l S e tt i n g s " , " Re p ly - to Ad dre s s" ) | |
! s e tt i n g s . h ave S e tt i n g ( " E m a i l S e tt i n g s " , " Re n der Rep o r t Rec i p i en t" ) ){
// We don' t have t he se tt i n g s ye t, so r un emai l _ s et up.js x
/ / to p ro m p t for t h e m
v ar ema il_se tupfile = new File ("ema i l_se tu p.j sx");
e m a il _ s e tup fi l e . op en (" r " ) ;
e v al( email_s et upf ile.rea d () );
e m a il _ s e t u p f i l e . c l o s e ( ) ;
}
v ar my Qu eu e = a pp.proje c t.renderQ ueue ; //cre ate s a sh or tc ut for RQ

Now were 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.
my Qu eu e.render();
v ar proj ec tNam e = "Unsaved Proj ec t";
i f (a pp. pro j e c t . f i l e ) {
proj ec tNam e = a pp.proje c t.file.na m e;
}
v ar my Me ss age = "Render i ng of " + proje c tName + " i s compl e te .\n\n";

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 tt i n g s . h aveS e tt i n g ( " E m a i l S e tt i n g s " , " Ma i l S e r ve r " ) | |
! s e tt i n g s . h ave S e tt i n g ( " E m a i l S e tt i n g s " , " Re p ly - to Ad dre s s" ) | |
! s e tt i n g s . h ave S e tt i n g ( " E m a i l S e tt i n g s " , " Re n der Rep o r t Rec i p i en t" ) ){
a l er t( "Can't s end an ema i l, I don't h ave a l l th e s et t i n g s I n ee d. Ab or t i n g . " );
} else {
/ / L oa d co de f rom a fi l e w i th han dy em a i li n g m et ho ds :
v ar e m a il Co de F il e = n e w F i l e ( " e m a i l _ m e t h o d s . j s x " );
em a il Co de F il e .op en ( "r " );
e v a l ( e m a i l Co de F i l e . rea d ( ) ) ;
em a il Co de F il e .cl os e( ) ;

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 tt i n g = se t ti n g s . g e tS e t ti ng ( " E m a i l S e t t in g s " , " Ma i l S e r ve r " ) ;
v ar f ro m S e tt i n g = s et t in g s .g e tS e t t in g (" E m a i l S et t i n g s" , " Repl y - to Ad d re ss " ) ;
v ar 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 tt i n g s " , " Re n der Rep o r t Rec i p i en t" ) ;

v ar my Mai l = new Emai lS o cke t( s er verS e tt i n g) ;


i f ( ! my Ma il . se n d ( f rom S e t t in g , toS e t t i n g , " A E Ren de r Com p l e t e d " , my Me s s a g e ) ) {
a l er t ( " S e n d i n g m a i l f a i l e d " ) ;
}
}
}
}

176

After Effects Scripting Guide

Examples

177

Email methods
This script creates an email object for use with the previous render-and-email script. It uses code that is
specific to the socket object and therefore requires advanced understanding of networking to edit; the
comments describe its operation.
// Create an ema i l obje ct . T he func t ion m ay be ca lle d b oth
/ / a s a g lo b al f un c t i on a n d a s a con s t r uc tor. It ta kes t he
/ / n a m e o f t h e e m a i l s e r ver, a n d a n o p t i o n a l B o o l e an t h a t ,
/ / i f t r u e , pr i n ts de bu g g in g m e s sa g e s.
/ / T h i s o b j e c t is n o t g u a r a n t e e d to wor k f o r a l l S M T P s e r ve r s ,
/ / s o m e o f t h e m m ay re q u i re a d i f f e re n t s e t o f com m a n d s .
/ / f u n c t io n s :
/ / s e n d ( f rom Ad d re ss , to Ad dre s s, sub je c t, tex t ) - s e n d an e m a i l
// a ut h ( n am e, p as s ) - do a n aut hor iz at ion v i a P OP 3
// bo th fun c t i ons re tur n fa lse on er rors
// sample:
/ / e = n ew E m a il S o cke t (" m a i l .ho s t .com " ) ;
/ / a ut hor i ze v i a PO P 3 (n ot a l l s er vers re qui re auth or i z a t ion )
/ / e . a u t h ( " my n a m e " , " my pa s s " ) ;
/ / s e n d t h e em a i l
/ / e . s e n d ( " m e @ my.com " , " yo u @ yo u . co m " , " My Sub je c t " , " Hi t h e re ! " )
/ / T h i s s c r i p t m a kes u se o f t h e S o cke t o b j e c t , a n d c re a tes a n e w c la s s
/ / c a l l e d E m a i l S o c ket t h a t i s d e r ived f ro m S o cke t. For m o re i n f o r m a t ion o n
/ / c re a t i n g n e w cl a s s e s i n t h i s w ay, con su lt cha p ter 7 of Java Sc r i p t, T he
// D efinit ive Gu id e, by Dav id Flan ag an ( O 'Reil l y) .
/ / T h i s i s t h e con s t r u c tor f o r t h e em a i l s o cke t . It t a ke s a s a r g u m e n t s :
// ser ver - th e a ddress of th e email ser ver (is not che cke d for va lidit y here)
/ / d b g - a b o o l e an , i f t r u e , p r i n t s a d di t i o n al er ror i n for m a t i on
f u n c t i o n E m a i l S o c ke t ( s e r ver, d b g ) {
v ar ob j = n e w S o cke t ;
obj._h ost = ser ver ;
o b j . _ d e b u g = (d b g = = t r u e ) ;
o b j . _ _ p roto _ _ = E m a i lS o cket . p ro to t y p e ;
re tur n o b j;
}
/ / cor re c t t h e p ro toy p e cha in to p o i n t to t h e S o c ke t pro to t y p e cha in
/ / - t hi s i s w ha t a c tua l l y c aus es th e der iv at i on from So cke t.
E m a i l S o cket . p ro to t y p e . __ p ro t o _ _ = S o cke t . p rotot y p e ;
/ / T h i s s e t s u p t h e s e n d ( ) m em b e r f u n c t io n . s e n d ( ) t ake s a s a rg u m en ts :
/ / f ro m - t he e m a il a d d re s s of t he s e n d e r. T hi s i s n o t v a l i d a t e d .
/ / to - t he e m a i l a d d re s s o f t h e re c i p i e n t . If t he re i s a n e r ror,
/ / a n d t h e f ro m a d d re s s i s i n cor re c t, you w i l l n o t b e n o t i f ie d .
// su bje c t - th e content s of th e su bje c t fie l d.
/ / tex t - t he b o dy o f t he m es sa ge .

177

After Effects Scripting Guide

Examples

178

//
// Re tu r n s t r ue if sending succee de d, fa lse oth er w ise (if t here w as an er ror)
//
/ / No te t h a t t h i s cod e u s e s a l o ca l f u n c t i o n o b j ec t to c re ate
/ / t he f un c t i on t ha t i s as si g n ed to s en d .
E m a i l S o cket .p ro to t y p e. sen d = f un c t i on (f rom , to, su b je c t , tex t) {
/ / o p e n t h e s o c ke t o n p o r t 2 5 ( S M T P )
i f (!t h i s . o p e n ( th i s . _ h o st + " : 2 5 " ) )
re tur n f a ls e;
try {
/ / d i sc a rd th e g re e ti n g
v ar g re e t in g = t hi s. re ad ( );
i f (t h i s . _ de bu g )
w r ite ( " R E C V: " + g re e ti n g ) ;
/ / i s s u e E HLO a n d o t h e r com m a n d s
t h i s . _ S M T P ( " E H LO " + f ro m ) ;
t h i s . _ S M T P ( " M AI L F RO M : " + f ro m ) ;
t h i s . _ S M T P ( " RC P T TO : " + to) ;
t h i s . _ S M T P ( " DATA " ) ;
/ / s e n d s u b j e c t a n d t i m e s t am p
t h i s . w r i te l n ( " Fro m : " + f ro m ) ;
t hi s. w r i te l n ( " To: " + to) ;
t hi s. w r i te l n ( " Date: " + n e w Da te( ) .toS t r i n g ( )) ;
if (typeof subject != undefined)
t h i s. w r i te l n ( " Sub j e c t : " + su b j e c t ) ;
t hi s. w r i te l n ( );
/ / s e n d t h e tex t
i f (t y p e o f tex t ! = u n def in ed )
t hi s. w r i te l n ( tex t );
// ter m in ate w i t h a s i ng le dot and w ait f or re sp ons e
t hi s. _ S MT P (" . " );
/ / ter m in ate the se ss i on
this._SMTP ("QUIT");
t hi s. cl o s e( );
re tur n t r ue ;
}
c atch ( e ) {
t hi s. cl o s e( );
re tur n f a ls e;
}
}
// Auth or i ze v ia P OP 3. Supp l y name a n d pa ss word.
// Re tu r n s t r ue if sending succee de d, fa lse oth er w ise (if t here w as an er ror)
/ / Ar g u m e n t s :
/ / n a m e - t he u s e r Nam e o f t he a ccou n t
/ / p as s - t h e pa ss word
E m a i l S o cket . p ro to t y p e . a u t h = f u n c t i on ( n a m e , p a s s ) {
/ / o p e n t h e con n e c ti o n o n p o r t 1 1 0 ( P O P 3 )

178

After Effects Scripting Guide

Examples

179

i f (!t h i s . o p e n ( th i s . _ h o st + " : 1 1 0 " ))


re tur n f a ls e;
try {
/ / d i sc a rd th e g re e ti n g
v ar g re e t in g = t hi s. re ad ( );
i f (t h i s . _ de bu g )
w r ite ( " R E C V: " + g re e ti n g ) ;
// i s sue P O P3 command s
t hi s. _ PO P 3 ( " US E R " + n am e );
t hi s. _ PO P 3 ( " PAS S " + p as s) ;
t hi s. _ PO P 3 ( " QUI T " ) ;
t hi s. cl o s e( );
re tur n t r ue ;
}
c atch ( e ) {
t hi s. cl o s e( );
re tur n f a ls e;
}
}
// Users of t he Em ailSocke t do no t ne ed to b e concer ned w i th
/ / t he f o l l ow i n g m e t ho d. It is an im p l em en t at i o n he l p er.
/ / l o c al f u n c t i o n to s e n d a com m an d & che ck a PO P 3 rep ly
/ / t h row s i n c a s e o f e r ror
E m a i l S o cket . p ro to t y p e . _P O P3 = f u n c t i on ( c m d ) {
i f (t h i s . _ de bu g )
w r ite l n ( " S E N D : " + c m d ) ;
i f (!t h i s . w r itel n ( c m d ))
throw "Er ror ";
v ar rep ly = th is .re a d () ;
i f (t h i s . _ de bu g )
w r ite ( " RE C V: " + rep ly ) ;
// t he reply sta r t s by eith er + or i f (re p ly [ 0 ] == " +" )
re tur n ;
throw "Er ror ";
}
// Users of t he Em ailSocke t do no t ne ed to b e concer ned w i th
/ / t he f o l l ow i n g m e t ho d. It is an im p l em en t at i o n he l p er.
/ / l o c a l f u n c t i o n to s e n d a com m a n d & che ck a S M T P rep l y
/ / t h row s i n c a s e o f e r ror
E m a i l S o cket . p ro to t y p e . _S M T P = f u n c t i o n ( c m d ) {
i f (t hi s ._ de bu g )
w r ite l n ( " S E N D : " + c m d ) ;
i f (!t h i s . w r itel n ( c m d ))
throw "Er ror ";
v ar rep ly = th is .re a d () ;
i f (t h i s . _ de bu g )

179

After Effects Scripting Guide

Examples

180

w r ite ( " RE C V: " + rep ly ) ;


/ / t h e rep ly i s a t h re e - d i g i t cod e fo l l owe d by a s pa ce
v ar m a tch = re pl y. m atch ( /^ ( \ d{ 3 } ) \ s/ m ) ;
i f (m a tch. l en g th = = 2) {
v ar n = Num b er (m a tch [ 1 ] ) ;
if (n >= 200 && n <= 399)
re tur n ;
}
throw "Er ror ";
}
/ / n i ce to have: a toS t r i n g ( )
/ / T h i s f u n c t i on a l l ow s t h e e m a i l o b j ec t t o b e p r i n t e d .
E m a i l S o cket . p ro to t y p e . toS t r in g = f u n c t i on ( ) {
re t u r n " [ o b j e c t E m a i l ] " ;
}

Email setup
This simple script prompts the user for the server name, email sender, and email recipient that are saved as
Settings for the previous render-and-email script. You can run this script as standalone any time you want to
change the settings. The script runs em ai l _ se tu p. js x whenever the settings don't exist; this should 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 lf , b u t i t is a l s o c a l l e d
/ / w i t h in " 3 - Re n d e r a n d Mai l . j s x " i f t h e s e t t i n g s a re n ' t ye t s e t .
v ar s e r ve r Val u e = p rom p t ( " E n ter n a m e o f m a i l s e r ve r : " ) ;
v ar f ro m Va lue = pro m p t( " E n ter rep ly - to e m ai l a dd re s s: " );
v ar to Valu e

= prompt ("Enter re cipient ' s ema il a d dress");

if (ser verVa lue ! = nu ll && ser ver Valu e != "") {


a pp. se t ti n g s .s aveS e t t in g (" E m a i l S et t i n g s" , " Mai l S er ver" , s er verVa lue) ;
}
i f ( f rom Va lu e ! = nu l l & & f ro m Val u e ! = " " ) {
a pp. se t ti n g s .s aveS e t t in g (" E m a i l S et t i n g s" , " Repl y - to Ad d ress " , f ro m Va lue );
}
i f ( to Va lu e != nul l && t o Valu e != "" ) {
a pp. se t ti n g s .s aveS e t t in g (" E m a i l S et t i n g s" , " Ren der Rep o r t Re c i pi en t " , toVa lue );
}
}

180

After Effects Scripting Guide

Examples

181

Info panel console


This script shows how to write to the Info panel, a simple JavaScript console for After Effects. The script makes
use of the ExtendScript user-interaction dialogs (alert, prompt, and confirm).
/ / Use con fi r m ( ) to l e t t h e u se r t e l l u s w h e t h e r h e c a n s e e t h e " in fo " w i n d ow.
/ / D ep e n d i n g h ow t he u se r c l i c k s , t r u e o r f a l s e i s re t u r n e d .
i f (co n f i r m ( " Ca n yo u se e t he In f o p an e l ?" ) ) {
/ / S ta r t by cl e ar i n g th e i n for m a t ion a re a.
cl e arO ut put () ;
/ / w r ite an d w r i teL n w r i te to the In fo p an e l w it h or w i th out a n ew l i n e at t he en d.
w r i t e ( " Ro s e s a re red , " ) ;
w r ite L n ( " v i o l e t s a re b lu e" ) ;
w r ite("Sug ar is swee t, ");
w r ite L n ( " a n d s o i s E qu a l . " ) ;
v ar rep ly = pro m p t ( " D i d yo u l i ke my p o e m ? " ) ;
i f ( re p ly = = " ye s" | | rep ly = = " Y E S " ) {
a l er t( " S e e th e In fo p a n e l for a s p e c i a l s e c re t f or tu n e ." ) ;
/ / T h i s g e ts r id o f the o l d w r i t i n g o n the i n fo t a b.
cl e arO ut put () ;
w r iteLn( "You have a f utu re as a liter a r y cr it ic. " );
}
e l se {
a l er t ( " H m m , I ' l l t r y on ce m o re. . . " ) ;
w r iteLn( ".. .... .") ;
w r iteLn("Roses are red, v io l et s a re blue, " );
w r ite L n ( " I ' ve g o t s o m e g um , o n t h e s o l e o f my s h o e. " ) ;
}
a l er t( " O kay, a l l don e w i t h t hi s tes t." ) ;
}
e l se {
/ / a le r t( ) ju st d is p l ays a m e ss ag e in a d ia l o g b ox .
a l er t ( " B r i n g u p t h e In f o p a n e l a n d r un t h i s s c r i p t a g a in " ) ;
}

181

After Effects Scripting Guide

Examples

182

File fun
This script shows how to open files, open projects, collect names of the compositions in a scene, prompt a user
for where to write a file, write to a text file, and save the text file. For this example to work correctly, the application preference Allow Scripts to Write Files and Access Network must be set.
/ / F i r s t , c lo se a ny p ro j e c t t h a t m i g h t b e o p e n .
i f (a pp. pro je c t != nul l ){
/ / 3 ch o ices h e re, C l o s e O p t i o n s . D O _ N OT _ S AV E _ C H A N G E S ,
/ / C l o s e O p t i o n s . PRO 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 AVE _ C H A N G E S
a pp. pro je c t .cl o se( C l os eO p t i on s. D O _ N OT _ S AV E _ C H AN G E S );
}
/ / Pro m p t t h e u s er to p i ck a pro je c t f il e :
/ / F i r st ar g u m e n t is a p ro m p t , s e con d i s t h e f i l e t y p e .
v a r pf i l e = fi l e G e tD i a lo g ( " S e l e c t a p ro j e c t f i l e to o p e n " , " Eg g P a ep " ) ;
i f (p fi l e = = nu l l ) {
a l er t( " No pro je c t fi l e s e le c te d. Ab or t i n g . " );
} else {
/ / O p e n t ha t f i l e . It b ecom e s t he c u r re n t p ro je c t .
v ar my _pro je ct = a pp.op en( pfile );
// Bui l d a def au lt text f il e name from the pro je c t ' s f i l ename .
// Remove t he ".a ep" file ex ten sion (if present), t hen a d d
/ / _ co m p n a m e s . t x t .
v ar de fa ult_tex t_f i l ename ;
v a r su ff i x _ in d ex = pfi l e . n a m e . l a s t In d ex O f( " . a e p " );
i f (su ff i x _ in d ex ! = - 1 ) {
def a u l t_ tex t_ f i l e n a m e = pf i l e . n a m e . su b s t r i n g (0 , su ff i x_ i n d ex );
} else {
def a u l t_ tex t_ f i l e n a m e = pf i l e . n a m e ;
}
def a ult_tex t_f i l ename + = "_compnam es .tx t " ;
/ / Cre a t e a n o th er fi l e o b j e c t for t h e f il e we ' l l w r ite o u t .
/ / F i r s t a r g u m e n t is t h e p ro m p t , s e con d is a d e f a u l t f i l e n a m e , t h i rd i s
// the file type.
v ar tex t_f i l e = f ile PutD i a lo g( "S ele c t a fi le to out p ut you r result s " , def au l t_tex t_f i lena m e, "TEXT tx t") ;
i f ( t ex t _ f i l e = = nul l ) {
a l er t ( " No o u t pu t fi l e s e l e c te d. Ab or t i n g . " );
} else {
/ / o p e n s fi l e f or w r i t i n g . F ir s t a r g um e n t i s m o d e ( " w " f or w r i t i n g ) ,
/ / s e con d a r g u m e n t i s f i l e t y p e ( f o r m ac o n l y) ,
/ / t h i rd a r g u m e n t i s c re a t or (m a c o n l y, " ? ? ? ? " i s n o sp e c i f ic a pp ).
tex t _ f i le . o p e n ( " w" , " T E XT " , " ?? ? ? " ) ;
// Wr ite th e he ading of the file:
tex t_ f i le . w r ite l n ( " He re is a l i s t o f a l l t h e com p s i n " + p f il e .n a m e) ;
tex t_ f i le . w r ite l n ( ) ;
for ( v a r i = 1 ; i <= a p p.p ro j e c t . num Item s ; i + +) {
i f (a pp. pro j e c t . i tem ( i ) i n s ta n ce o f C om pIte m ) {
tex t_ f i l e . w r ite l n ( a p p. pro j e c t . i te m ( i ).n am e ) ;

182

After Effects Scripting Guide

Examples

183

}
}
tex t_ f i le . cl o se ( ) ;
a l er t( " Al l don e !" );
}
}

183

After Effects Object Summary

This code dump summarizes all public JavaScript objects (instantiable classes) and enumerated types defined
for After Effects 7.0.
= = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = =
AlphaMo de enum
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A l p h a Mo de .I G N O R E
AlphaMo de .PREMU LT I PLI E D
A l ph a Mo de .S T RA I G H T
= = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = =
App li c a ti o n o b j e c t
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a c t iva te () n o ret ur n
b e g i n Su ppres s Di a l og s () n o re tur n
b e g i nUndo Group(st r ing u n doName ) no re tur n
b ui l d Na m e : st r i n g : rea d On ly
b u i l d Nu m b e r : i n te g e r : rea d O n l y
c a n ce l Ta s k ( i n t e g e r t a s k I D ) n o re t u r n
e n d Su ppre s s Di a l o g s (b o o le an s h ow A l e r t ) n o re t u r n
e n d Un d o Grou p ( ) n o re t u r n
endWatchFolder() n o re tu r n
e x it Af ter L a u n ch An d Eva l : b o o l e a n : rea d / w r i te
ex it Co de : in te ger : rea d/ w r i te
i s Pro f e s s i o n a l Ver s i o n : b o o l e a n : re a d O n ly
i s Ren d e r E n g i n e : b o o l e a n : rea d O n l y
i s UI Supp re ss ed : b oo l ean : re ad O n ly
is Watch Fo ld er : b oole an : rea d Only
l a n g u a g e : L a n g u a ge : rea d O n l y
n ewPro je c t () n o re tur n
o p e n ( [ F il e fi l e ] ) re tu r n s Pro je c t
pa useWatch Folder(b oo lean do Pause) no re tur n
p ro je c t : Pro j e c t : re ad O n ly
p ur g e(Purg e Tar ge t tar g et ) n o re tu r n
q ui t( ) n o re tu r n
re g is te re d Com p a ny : s t r i n g : rea d O n l y
re g is te re d Nam e : s t r in g : re a dO n l y
s ave Pro je c tO n Cr as h : b o o l e a n : rea d/ w r i te
s che du l eTa sk (s t r i n gTo Exe c ute, fl o a t de l ay, b o ol ea n rep ea t) ret ur n s ta sk ID
s e r i al Num b e r : s t r in g : rea dO n l y
s e tMem or y Us ag eL i m i t s( fl o a t i m a ge Ca che Percent , f l o a t m a xi m u m Me m o r y Pe rcen t ) n o ret u r n
s e tS avePreferen ce sO n Q ui t( b o ol ea n doS ave ) n o re tu r n
s e tt i n g s : S e tt i n g s : re ad O n ly
ver s i o n : s t r i n g : rea d O n l y

184

After Effects Scripting Guide

After Effects Object Summary

185

w a tch Fo l der ( F il e fi l e ) n o ret u r n


on E r ror( s t r in g er ror St r in g , s t r i n g s e ver it y ) n o re tur n
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == =
AVL ayer ob j ec t
su b cl a ss of Layer
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - (inte g er proper t y In dex) ret ur n s Prop er t y B a se
( st r i n g p ro p e r t y Na m e ) re tu r n s Prop er t y B as e
a c t ive : b oo l ean : re ad O n ly
a c t iveAtTim e(f lo at at Ti me ) re tur n s b oole an
a d dProp er t y (s t r i ng prop er t y Name ) re tur n s Prop er t y Ba s e
a d ju s t m e n t L ayer : b o o l e an : rea d / w r i te
a pp ly Pre se t( F i l e pres e tName ) no re tu r n
a udio Ac t ive : bo olea n : rea dO n ly
a ud io Ac t iveAtTi m e( flo a t at Time ) re tur n s b oo le an
a ud io E n ab l ed : b oo l ean : re ad / w r ite
b l endi ngMo de : Bl endi ngMo de : rea d/w r i te
can AddProper t y (str ing prop er t y Name ) re tur n s b oole an
can S et Col l ap se Tr ans for ma tion : b oo l ean : re ad O n ly
can S et Ena ble d : bo olea n : rea dO n ly
c a n S e t Ti m e Rem a p E n a bl e d : b o o l e a n : rea d O n l y
co l l ap s e Tr an s fo r m at i on : b o o l e a n : rea d/ w r i te
com m e n t : s t r i n g : rea d /w r i te
con t a i n i n g Com p : Com p Ite m : rea d O n l y
cop y ToCom p ( Com p Item i n toC om p) n o ret u r n
du pl i c ate( ) re tur n s AV Layer
effe ct sAct ive : b oo l ean : re ad/w r ite
e l id ed : b ool e an : rea d On ly
ena ble d : bo olea n : rea d/w r i te
f r a m e B l e n d i n g : b o o l e a n : rea d/ w r i te
gu ideLayer : bo olea n : rea d /w r i te
h as Au di o : b o ol ea n : rea dO n l y
h as Tr a ck Ma tte : bo olea n : rea d Only
h as Vi de o : b oo l ean : re ad O n ly
h eig h t : f l o at : rea dO n l y
i n Poi n t : fl o a t : rea d / w r i te
i n dex : i n te g e r : rea dO n l y
i s E ff e c t : b o o l e a n : re a d O n ly
i s Mas k : b o o l e a n : rea dO n l y
i s Mod i fi e d : b o o l e a n : rea dO n l y
i s Na m e Fro m S o u rce : b o o l e a n : rea d O n l y
i s Na m e S e t : b o o l e a n : rea dO n l y
i s Tr a ck Ma tte : b o ol ea n : rea d On l y
l o cke d : b o o l e a n : rea d/ w r i te
ma tchNam e : s t r i ng : rea dO n ly
mo tionBlu r : bo ole an : rea d /w r i te
moveAfter(Layer o ther L ayer) no re tur n
m oveB ef ore( L ayer oth erL ayer ) n o re tu r n
m oveTo( in te g er in d ex ) n o ret u r n
m oveToB e g i n n i n g ( ) n o re t u r n
moveToEnd() no re tu r n

185

After Effects Scripting Guide

After Effects Object Summary

186

n a m e : s t r i n g : rea d / w r i te
nu l l L aye r : b o o l e a n : rea d O n l y
nu m Prop er t i e s : i n te g e r : rea d On l y
o u t Po i n t : f l o at : rea d/ w r i te
parent : Layer : re ad/w r ite
p a ren t Pro p e r t y : Pro p e r t y Gro u p : rea d O n l y
preser veTr a n spa rency : b oole an : rea d /w r i te
prop er t y ( i nte g er prop er t y Index) ret ur n s Prop er t yB a se
prop er t y (st r ing proper t y Na me) ret ur n s Prop er t y B a se
prop er t y D ep t h : i n te ger : rea d On ly
prop e r t y Gro u p ([ i n te g e r cou n tUp ]) ret u r n s Prop e r t y Gro u p
prop er t y Ty p e : Prop er t y Ty p e : re ad O n ly
qua l it y : LayerQu alit y : rea d /w r i te
remove() no re tu r n
s e l e c te d : b oo le an : rea d / w r i te
s e l e c t e d Pro p e r t i e s : A r r ay of Pro p e r t y B a s e : rea dO n l y
s et Paren t Wi th Jum p ( L ayer n e wPa ren t ) n o re t ur n
s hy : b oo le an : rea d / w r i te
s o l o : b oo l e an : re ad / w r ite
s ource : AVItem : rea d On ly
s ta r t Ti m e : fl o a t : rea d / w r i te
s t retch : f l o at : rea d/w r i te
t h ree DL ayer : b o o l e a n : rea d / w r i te
t i m e : fl o at : rea d On l y
t i m e Rem ap E n a b l e d : b oo l e a n : re a d / w r it e
t r ac kMat teTy p e : Tr a ck Ma tte Ty p e : rea d/ w r i te
w i dt h : fl o a t : rea d On l y
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Bl e n d in g Mod e e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Bl e n d in g Mod e .AD D
Bl e n d in g Mod e .AL PH A _ A DD
Bl e n d in g Mod e .C L A S S I C _ C O LOR _ BUR N
Bl e n d in g Mod e .C L A S S I C _ C O LOR _ D O D G E
Bl e n d in g Mod e .C L A S S I C _ D I F F E R E N C E
Bl e n d in g Mod e .C O LOR
Bl e n d in g Mod e .C O LOR _ BUR N
Bl e n d in g Mod e .C O LOR _ D O D G E
Bl e n d in g Mod e .DA N C I N G _ DI S S OLV E
Bl e n d in g Mod e .DA R K E N
Bl e n d in g Mod e .D I F F E R E N C E
Bl e n d in g Mod e .D I S SO LVE
Bl e n d in g Mod e .E XC LUS I ON
Bl e n d in g Mod e .H A R D _ L I G HT
Bl e n d in g Mod e .H A R D _ M I X
Bl e n d in g Mod e .H UE
Bl e n d in g Mod e .L I G H T E N
Bl e n d in g Mod e .L I N E A R _ BU R N
Bl e n d in g Mod e .L I N E A R _ D O D G E
Bl e n d in g Mod e .L I N E A R _ L I G H T
Bl e n d in g Mod e .LU M I N E S C E N T _ PR E M U L

186

After Effects Scripting Guide

After Effects Object Summary

187

Bl e n d in g Mod e .LU M I N O S I T Y
Bl e n d in g Mod e .M ULT I PLY
Bl e n d in g Mod e .N O R M A L
Bl e n d in g Mod e .OV E R L AY
Bl e n d in g Mod e .PI N _ L I G H T
Bl e n d in g Mod e .S AT U RAT I O N
Bl e n d in g Mod e .S C R E E N
Bl e n d in g Mod e .S I L H OU E T E _ AL PH A
Bl e n d in g Mod e .S I L H OU E T T E _ LUM A
Bl e n d in g Mod e .S O F T _ L I G HT
Bl e n d in g Mod e .S T E N C I L _ A L PHA
Bl e n d in g Mod e .S T E N C I L _ LUM A
B l e n d in g Mod e . V I V I D _ L I G H T
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
C a m e r a L ayer o b j e c t ( s u b c l a s s o f L ayer, n o ow n m e t h o d s o r a t t r i b u e s )
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - = == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
C l o s e O p t i o n s e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - C l o s e O p t i o n s . D O _ N OT _ S AV E _ C H A N G E S
C l o s e O p t i o n s . PRO M P T _ TO _ S AVE _ C H A N G E S
C l o s e O p t i o n s . SAV E _ C H A N G E S
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
CompItem obje c t (in her it s from Item a n d AV Item, w h ich are no t instan tia ble )
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a c t iveCamer a : Layer : rea d Only
b g Co lor : Ar r ay of fl o a t : rea d / w r i te
com m e n t : s t r i n g : rea d /w r i te
d i sp layS ta r t Ti me : flo a t : rea d /w r i te
d r a ft 3 d : b o o l e a n : rea d / w r i te
du pl i c ate( ) re tur n s Comp Item
du r at i o n : f l o at : rea d/ w r i te
fo otageMissin g : bo olea n : rea d Only
f r a m e B l e n d i n g : b o o l e a n : rea d/ w r i te
f r a m eD ur a t i on : fl o a t : rea d / w r i te
f r a m eRa te : fl o a t : rea d / w r i te
h as Au di o : b o ol ea n : rea dO n l y
h as Vi de o : b oo l ean : re ad O n ly
h eig h t : i n teg er : re ad / w r i te
h id e S hy L aye r s : b o o l e an : rea d / w r i te
i d : i n te g e r : rea d On l y
l ayer (i n t e g e r l ayer In dex ) re t u r n s L ayer
l ayer (s t r i n g l ayer Na m e ) re t u r n s L ayer
layer (Layer ot herLayer, inte ger re lat iveIn dex) re tur n s Layer
l ayer s : L ayer Co l l e c t i o n : rea dO n l y
mo tionBlu r : bo ole an : rea d /w r i te
n a m e : s t r i n g : rea d / w r i te
nu mLayers : inte ger : rea d Only
parentFolder : Fo lderItem : rea d /w r i te
p i xel As p e c t : f l o at : rea d/ w r i te
preser veNeste d Fr a m eRa te : bo olea n : rea d/w r i te

187

After Effects Scripting Guide

After Effects Object Summary

188

preser veNeste d Resolut i on : bo olea n : rea d /w r i te


prox ySou rce : Fo ota g eSource : rea d Only
remove() no re tu r n
renderer : st r i ng : rea d/w r i te
renderers : Ar r ay of st r i ng: rea d Only
res o lut i o n Fa c to r : A r r ay of i n te g e r : rea d / w r i te
s e l e c te d : b oo le an : rea d / w r i te
s e l e c t e d L ayer s : A r r ay o f L ayer : rea d O n l y
s e l e c t e d Pro p e r t i e s : A r r ay of Pro p e r t y B a s e : rea dO n l y
s e t Proxy ( F i l e prox y F i l e ) n o re t u r n
s e t Proxy ToNon e ( ) n o ret u r n
s et Proxy Wi thP l a ceh o l der( s t r in g n am e , i n te g er w id t h, i n teg er h ei g h t, fl o at f r am e R a te, f l o at dur at i o n )
no re tur n
set ProxyWi thSe quence(File prox yFile , bo olea n forceAlphab et i cal) no re tur n
s e t Proxy Wi thS o l id ( Ar r ay O fF l o a t co lor, s t r i n g n a m e , i n te g e r w i d th , i n te g e r h e i g h t ,
f l o at pi xe l Asp ec tR at i o) no ret ur n
s hut terAn g l e : i n te g er : rea d / w r i te
s hut terP ha se : i n te g er : rea d / w r i te
t i m e : fl o at : rea d / w r i te
t y p e Na m e : s t r i n g : rea d O n ly
u s e Prox y : b o o l e a n : rea d / w r i te
u s e dIn : Ar r ay o f Com p Ite m : rea d O n l y
w i dt h : in te ger : rea d/ w r i te
wor k Area D ur a ti on : f l o at : rea d/ w r i te
wor k Area St ar t : flo a t : rea d /w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
F i e l d S e p a r a t i o n Ty p e e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - F i e l d S e p a r a t i o n Ty p e . LOW E R _ F I E L D _ F I R S T
F i e l d S e p a r a t i o n Ty p e . O F F
F i e l d S e p a r a t i o n Ty p e . U PPE R _ F I E L D _ F I R S T
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
F i l e S o u rce o b j e c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a l pha Mod e : Al ph aMo de : rea d / w r i te
con f o r m Fr a m e R a te : f l o a t : rea d / w r i te
d i s p l ay Fr a m e R ate : f l o at : re a d O n ly
f i e l d S e p a r a t i on Ty p e : F i e l d S e p a r a t i on Ty p e : rea dO n l y
f i le : File : rea d Only
g u e ss A l ph aMo de( ) n o re t u r n
g u e ss Pu l l dow n (Pul l dow n Me t h o d p u l l dow n Me t h o d) n o re t u r n
h a s Al p h a : b o o l e a n : rea dO n l y
h ig hQ ua l it y F ie l dS epa r a ti on : b oo l ean : re ad / w r ite
inver t Alpha : bo olea n : rea d /w r i te
i s St i l l : b o o l e a n : rea dO n l y
l o op : i n te g er : rea d / w r i te
m i s s i n g Fo ot a g e Pat h : s t r i n g : rea d O n l y
na t iveFr am eRa te : flo at : rea d Only
premu l Col or : Ar r ay of f l oa t : re ad / w r ite
rel o a d () n o re tur n
rem ovePu l l dow n : Pul l dow n P ha se : re ad O n ly

188

After Effects Scripting Guide

After Effects Object Summary

189

= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Fol d e r Ite m o b j ec t ( i n h e r i t s f ro m Ite m , w h i ch i s n o t i n s t a n t ia bl e )
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - com m e n t : s t r i n g : rea d /w r i te
i d : i n te g e r : rea d On l y
i te m ( i n te g e r i te m In d e x ) ret ur n s Ite m
i te m s : Ite m Col l e c t i o n : rea dO n l y
n a m e : s t r i n g : rea d / w r i te
nu mItem s : inte ger : re ad O n ly
parentFolder : Fo lderItem : rea d /w r i te
remove() no re tu r n
s e l e c te d : b oo le an : rea d / w r i te
t y p e Na m e : s t r i n g : rea d O n ly
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Foo ta ge Item o b j e c t ( i n h e r i t s f ro m Ite m , AV Item , and Foot age S ource , w h ich are not inst ant i a ble)
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - com m e n t : s t r i n g : rea d /w r i te
du r at i o n : f l o at : rea dO n l y
f i le : File : rea d Only
fo otageMissin g : bo olea n : rea d Only
f r a m eD ur a t i on : fl o a t : rea d On ly
f r a m eRa te : fl o a t : rea d On l y
h as Au di o : b o ol ea n : rea dO n l y
h as Vi de o : b oo l ean : re ad O n ly
h eig h t : i n teg er : re ad / w r i te
i d : i n te g e r : rea d On l y
ma inSource : Fo ot ageSo urce : re adO n ly
n a m e : s t r i n g : rea d / w r i te
parentFolder : Fo lderItem : rea d /w r i te
p i xel As p e c t : f l o at : rea d/ w r i te
prox ySou rce : Fo ota g eSource : rea d Only
remove() no re tu r n
rep l a ce ( F il e p rox y F il e ) n o re t u r n
replaceWit hP laceho lder( st r ing na me, inte ger w i dth , inte ger he ig ht , flo at fr ameR ate, flo at dur a t i on )
no re tur n
rep l a c e Wi t h S e qu e n c e ( F i l e p rox y F i l e , b o o l e a n f o rce A l p h ab e t i c a l ) n o ret ur n
rep l a ce Wi t h S o l i d (Ar r ay O fF l o a t col o r, s t r i n g n am e , i nteg e r w id t h , i n te g e r h e i g h t, f l o at p i xe lAs p e c tR a t i o )
no re tur n
s e l e c te d : b oo le an : rea d / w r i te
s e t Proxy ( F i l e prox y F i l e ) n o re t u r n
s e t Proxy ToNon e ( ) n o ret u r n
s et Proxy Wi thP l a ceh o l der( s t r in g n am e , i n te g er w id t h, i n teg er h ei g h t, fl o at f r am e R a te, f l o at dur at i o n )
no re tur n
set ProxyWi thSe quence(File prox yFile , bo olea n forceAlphab et i cal) no re tur n
s e t Proxy Wi thS o l id ( Ar r ay O fF l o a t co lor, s t r i n g n a m e , i n te g e r w i d th , i n te g e r h e i g h t ,
f l o at pi xe l Asp ec tR at i o) no ret ur n
t i m e : fl o at : rea d On l y
t y p e Na m e : s t r i n g : rea d O n ly
u s e Prox y : b o o l e a n : rea d / w r i te
u s e dIn : Ar r ay o f Com p Ite m : rea d O n l y
w i dt h : in te ger : rea d/ w r i te

189

After Effects Scripting Guide

After Effects Object Summary

190

= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Im p o r tAs Ty p e e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Im p o r tAs Ty p e .C O M P
Im p o r tAs Ty p e .C O M P _ C RO PPE D _ L AYE R S
Im p o r tAs Ty p e .F O OTAG E
Im p o r tAs Ty p e .P ROJ E C T
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Im por tO p tions ob jec t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - n ew Im p or t O p t i on s( F i le fi l eToIm p or t ) re tu r n s Im p or tO p t i on s
c an Im p or tAs ( Im p o r t AsTy p e a sTy p e ) ret u r n s b o o l e a n
f i le : File : rea d /w r i te
force A lp h a b e t i c a l : b o o l e a n : rea d/ w r i te
i m p o r tAs : Im p o r t AsTy p e : re ad / w r ite
sequ ence : bo olea n : rea d/w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Ite m Col l e c t i o n o b j e c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a d dComp ( st r i ng na me, inte ger w i d th , i n te ger he ig ht , f l o at pi xe l Asp ec tR at i o, f l o at dur at i on ,
f l o at fr ameR ate ) re tur n s Comp Item
a d dFol der( s t r in g name ) re tur n s Fol derItem
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Ke y fr am e E as e o b j ec t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - n e w Ke y fr a m e E as e ( fl o at s p e e d , f l o at i n f lu en ce) ret ur n s Ke y f r a m eE a se
i n f lu e n ce : f l o at : rea d/ w r i te
s p e ed : f l o at : rea d/w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Ke y fr am eIn ter p o la t i on Ty p e enum
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Ke y fr ameIn ter p o la t ion Ty p e .BE ZIER
Ke y fr am eIn ter p o la t i on Ty p e .H OL D
Ke y fr am eIn ter p o la t i on Ty p e .L I N E A R
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
L a n g u a ge e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - L a n g u a ge . E N G L I S H
L a n g u a ge . F R E N C H
L a n g u a ge . G E R M AN
L a n g u a ge . JA PA N E S E
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
L ayer o b je c t ( n o t in s t an t i ab l e , but b a s e cl as s of C am e r a L ayer an d L i g h tL aye r )
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - i n te ger prop er t y Index ) re tur n s Prop er t y Ba s e
s t r i n g pro p e r t y Nam e ) ret u r n s Pro p e r t yB a se
a c t ive : b oo l ean : re ad O n ly
a c t iveAtTim e(f lo at at Ti me ) re tur n s b oole an
a d dProp er t y (s t r i ng prop er t y Name ) re tur n s Prop er t y Ba s e
a pp ly Pre se t( F I l e pres et Na me) no re tur n
can AddProper t y (str ing prop er t y Name ) re tur n s b oole an

190

After Effects Scripting Guide

After Effects Object Summary

191

can S et Ena ble d : bo olea n : rea dO n ly


com m e n t : s t r i n g : rea d /w r i te
con t a i n i n g Com p : Com p Ite m : rea d O n l y
cop y ToCom p ( Com p Item i n toC om p) n o ret u r n
du pl i c ate( ) re tur n s Camer aLayer
e l id ed : b ool e an : rea d On ly
ena ble d : bo olea n : rea d/w r i te
h as Vi de o : b oo l ean : re ad O n ly
i n Poi n t : fl o a t : rea d / w r i te
i n dex : i n te g e r : rea dO n l y
i s E ff e c t : b o o l e a n : re a d O n ly
i s Mas k : b o o l e a n : rea dO n l y
i s Mod i fi e d : b o o l e a n : rea dO n l y
i s Na m e S e t : b o o l e a n : rea dO n l y
l o cke d : b o o l e a n : rea d/ w r i te
ma tchNam e : s t r i ng : rea dO n ly
moveAfter(Layer o ther L ayer) no re tur n
m oveB ef ore( L ayer oth erL ayer ) n o re tu r n
m oveTo( in te g er in d ex ) n o ret u r n
m oveToB e g i n n i n g ( ) n o re t u r n
moveToEnd() no re tu r n
n a m e : s t r i n g : rea d / w r i te
nu l l L aye r : b o o l e a n : rea d O n l y
nu m Prop er t i e s : i n te g e r : rea d On l y
o u t Po i n t : f l o at : rea d/ w r i te
parent : Layer : re ad/w r ite
p a ren t Pro p e r t y : Pro p e r t y Gro u p : rea d O n l y
prop er t y ( i nte g er prop er t y Index) ret ur n s Prop er t yB a se
prop er t y (st r ing proper t y Na me) ret ur n s Prop er t y B a se
prop er t y D ep t h : i n te ger : rea d On ly
prop e r t y Gro u p ([ i n te g e r cou n tUp ]) ret u r n s Prop e r t y Gro u p
prop er t y Ty p e : Prop er t y Ty p e : re ad O n ly
remove() no re tu r n
s e l e c te d : b oo le an : rea d / w r i te
s e l e c t e d Pro p e r t i e s : A r r ay of Pro p e r t y B a s e : rea dO n l y
s et Paren t Wi th Jum p ( L ayer n e wPa ren t ) n o re t ur n
s hy : b oo le an : rea d / w r i te
s o l o : b oo l e an : re ad / w r ite
s ta r t Ti m e : fl o a t : rea d / w r i te
s t retch : f l o at : rea d/w r i te
t i m e : fl o at : rea d On l y
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
L ayer Co l l e c t i on o b j e c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a d d(AVItem t heItem,
[ fl o a t du r a ti o n ] ) re tur n s AV L ayer
a d dC am er a( st r i n g n a m e, Ar r ay O fF l o at cen terPoi n t) re tu r n s Ca m er aL ayer
a d dL i g h t (s t r i n g n a m e, A r r ay Of F l o a t cen ter Poi n t ) re tu r n s L ig ht L ayer
a d dNu l l ( [f l o a t dur at i o n ]) ret u r n s AVL ayer
a d dS o li d ( Ar r ay O fF l o at col o r, s t r i n g n am e , i n te g e r w i dt h , in te ger h e i g h t, fl o a t p i xel As p e c t R a t io,
[ fl o a t du r a ti o n ] ) re tur n s AV L ayer

191

After Effects Scripting Guide

After Effects Object Summary

192

a d dTex t( [ Tex t D oc um en t tex tD o c] ) re tu r n s Tex t L ayer


a d dTex t( s t r in g tex t ) re tur n s Tex tLayer
by Na m e ( s t r i n g n a m e ) ret u r n s L ayer
pre compose(Ar r ay OfIn teger layerIndices, st r i ng na m e , [ b o ol e a n m oveA l l At t r i b u tes ] ) ret u r n s Com p Ite m
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
LayerQu alit y enum
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - LayerQu alit y.B EST
L ayer Q u al i t y. D RA F T
L ayer Q u al i t y. W I R E F RA M E
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
L i g ht L aye r o b j e c t ( s u b cl a ss o f L ayer, n o ow n m et h o ds o r a t t r i bu es )
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - = == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
LogTy p e enu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - L o g Ty p e . E R RO R S _ A N D _ PE R _ F RA ME _ I N F O
L o g Ty p e . E R RO R S _ A N D _ S E T T I N G S
L o g Ty p e . E R RO R S _ O N LY
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Ma r kerVa lue ob je c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - n e w Ma r ke r Va lue ( s t r i n g com m e n t , [ s t r i n g cha pter] , [ s t r ing u r l] , [ s t r ing fr ame Targe t] )
re tur n s Ma r kerVa lue
cha p ter : st r i n g : rea d / w r i te
com m e n t : s t r i n g : rea d /w r i te
f r a m eTa rg et : s t r i n g : rea d /w r i te
ur l : s t r i ng : rea d /w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Ma sk Mo de enu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Ma sk Mo de. ADD
Ma sk Mo de. DA RK E N
Ma sk Mo de. DIF F E R E NCE
Ma sk Mo de. I NTERS E CT
Ma sk Mo de. L IG HTE N
Ma sk Mo de. N ONE
Ma sk Mo de. SU BTRAC T
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Ma skMot i onBlur en um
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Ma sk Mot i on Blur.O F F
Ma sk Mot i on Blur.O N
Ma sk Mot i on Blur.S A ME _ AS _ L AYE R
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Ma skProper t yGroup obj ec t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - (inte g er proper t y In dex) ret ur n s Prop er t y B a se
( st r i n g p ro p e r t y Na m e ) re tu r n s Prop er t y B as e
a c t ive : b oo l ean : re ad O n ly
a d dProp er t y (s t r i ng prop er t y Name ) re tur n s Prop er t y Ba s e

192

After Effects Scripting Guide

After Effects Object Summary

193

can AddProper t y (str ing prop er t y Name ) re tur n s b oole an


can S et Ena ble d : bo olea n : rea dO n ly
co lor : Ar r ay of fl o a t : rea d / w r i te
du pl i c ate( ) re tur n s Ma s kProp er t y G
e l id ed : b ool e an : rea d On ly
ena ble d : bo olea n : rea dO n ly
i nver te d : b o o l e an : rea d / w r i te
i s E ff e c t : b o o l e a n : re a d O n ly
i s Mas k : b o o l e a n : rea dO n l y
i s Mod i fi e d : b o o l e a n : rea dO n l y
l o cke d : b o o l e a n : rea d/ w r i te
ma sk Mo de : Mas kMo de : rea d/w r i te
m a sk Mot i on Blur : Mas k Mot i on Bl ur : re ad / w r i te
ma tchNam e : s t r i ng : rea dO n ly
m oveTo( in te g er in d ex ) n o ret u r n
n a m e : s t r i n g : rea d / w r i te
nu m Prop er t i e s : i n te g e r : rea d On l y
p a ren t Pro p e r t y : Pro p e r t y Gro u p : rea d O n l y
prop er t y ( i nte g er prop er t y Index) ret ur n s Prop er t yB a se
prop er t y (st r ing proper t y Na me) ret ur n s Prop er t y B a se
prop er t y D ep t h : i n te ger : rea d On ly
prop e r t y Gro u p ([ i n te g e r cou n tUp ]) ret u r n s Prop e r t y Gro u p
prop er t y Index : i n te ger : rea d Onl y
prop er t y Ty p e : Prop er t y Ty p e : re ad O n ly
remove() no re tu r n
rotoB ez i e r : b o o l e a n : rea d/ w r i te
s e l e c te d : b oo le an : rea d / w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
O MCol l e c t i o n o b j e c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a d d( ) re tu r n s O ut p ut Mo dul e
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
O ut put Mod ul e ob j ec t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a pp ly Te m p l ate ( st r i n g tem pl a teNam e ) n o ret u r n
f i le : File : rea d /w r i te
n a m e : s t r i n g : rea d O n l y
p o s t Ren de r Ac t i o n : Pos t Ren de r Ac t i o n : rea d/ w r i te
remove() no re tu r n
s aveAs Tem p l a t e ( s t r i n g t e m p l a teNam e) n o re t u r n
tem pl a tes : Ar r ay of s t r in g : rea dO n l y
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Placeho l derSou rce obj ec t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a l pha Mod e : Al ph aMo de : rea d / w r i te
con f o r m Fr a m e R a te : f l o a t : rea d / w r i te
d i s p l ay Fr a m e R ate : f l o at : re a d O n ly
f i e l d S e p a r a t i on Ty p e : F i e l d S e p a r a t i on Ty p e : rea d/ w r i te
g u e ss A l ph aMo de( ) n o re t u r n
g u e ss Pu l l dow n (Pul l dow n Me t h o d p u l l dow n Me t h o d) n o re t u r n
h a s Al p h a : b o o l e a n : rea dO n l y

193

After Effects Scripting Guide

After Effects Object Summary

194

h ig hQ ua l it y F ie l dS epa r a ti on : b oo l ean : re ad / w r ite


inver t Alpha : bo olea n : rea d /w r i te
i s St i l l : b o o l e a n : rea dO n l y
l o op : i n te g er : rea d / w r i te
na t iveFr am eRa te : flo at : rea d Only
premu l Col or : Ar r ay of f l oa t : re ad / w r ite
rem ovePu l l dow n : Pul l dow n P ha se : re ad / w r ite
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Post RenderAc t i on enum
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Pos t Ren derAc t i on .I M PO RT
Pos t Ren derAc t i on .I M PO RT _ AN D _ RE P L AC E _ US AG E
Pos t Ren derAc t i on .N O N E
Pos t Ren derAc t i on .S E T _ P ROXY
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Pro jec t ob je c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a c t iveItem : Item : rea d On ly
bit s PerChan n el : integer : re ad/w r ite
cl o se( C l os eO p t i on s c lo se O p t ion s ) re tu r n s b oo l ean
con s o l i d a te Fo o t a g e ( ) re tur n s i n te g e r
d i sp layS ta r t Fr a m e : i n teger : re ad /w r ite
f i le : File : rea d Only
i m p o r tF i l e ( Im p or tO pt i o n s i m p o r t O p ti o n s ) re tur n s Ite m
i m p o r tF i l eWi t hD i al o g () ret ur n s Ar r ay O f Item
i m p o r tP l a ce h o ld e r ( st r i n g i te m Nam e, i n te g e r i te m Wi dt h , i n teg e r i tem He ig h t , f l o a t fr a m e R a te ,
f l o at dur a t i on ) ret ur n s Fo o t ag e Item
i te m ( i n te g e r i te m In d e x ) ret ur n s Ite m
i te m s : Ite m Col l e c t i o n : rea dO n l y
l i n e a r B l e n d i n g : b o o l e a n : rea d / w r i te
nu mItem s : inte ger : re ad O n ly
red u ce Pro je c t( Ar r ay O fItem i te m s To Pres e r ve ) re t u r n s i n te g er
rem oveUnu se d Fo ota g e( ) re tur n s i n te g er
renderQ ueue : RenderQ ueue : re adO n ly
root Fo lder : FolderItem : re adO n ly
s ave( F i l e toF i l e ) ret u r n s b o o l e a n
s aveWi th Di a l og( ) re tur n s b oo le an
s el e c t i o n : A r r ay o f Ite m : rea d O n l y
s how Win dow( b o ol ea n doS how) n o re tur n
t i m e cod e B as e Ty p e : Ti m e cod e B as e Ty p e : re ad / w r ite
t i m e cod e D i sp l ay Ty p e : Ti m e cod e D is p l ay Ty p e : rea d / w r i te
t i m e cod e F i l m Ty p e : Ti m e co d e F il m Ty p e : rea d / w r it e
t i m e cod e N TS C D ro p Fr a m e : b o o l e an : rea d / w r i te
t r an s p aren c y Gr i d T hu m bn ai l s : b o o l e an : rea d/ w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Pro p e r t y o b j e c t ( i n h e r i t s f ro m Pro p e r t y B a s e , w hi ch i s n o t i n s ta n t ia b l e )
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a c t ive : b oo l ean : re ad O n ly
a d dKe y (f lo at at Ti me) ret ur n s inte ger
can S et Ena ble d : bo olea n : rea dO n ly
can S et Ex pression : bo olea n : rea dO n ly

194

After Effects Scripting Guide

After Effects Object Summary

195

can Var yOverTime : b oo l ean : re adO n ly


du pl i c ate( ) re tur n s Prop er t y
e l id ed : b ool e an : rea d On ly
ena ble d : bo olea n : rea dO n ly
e xp re ss i on : s t r in g : re ad / w r ite
e xp re ss i on E n ab l e d : b oo l e an : re ad / w r ite
e xp re ss i on E r ror : s t r i n g : rea dO n l y
h as Max : b oo le an : re ad O n ly
h as Mi n : b o o l e a n : rea d O n l y
i s E ff e c t : b o o l e a n : re a d O n ly
i s In ter p o l a t i o n Ty p e Va l i d (
Ke y fr am eIn ter p o la t i on Ty p e t y p e) ret ur n s b o ol ea n
i s Mas k : b o o l e a n : rea dO n l y
i s Mod i fi e d : b o o l e a n : rea dO n l y
i s Sp a t i a l : b o o l e a n : rea dO n l y
i s Ti m e Va r y i n g : b o o l e a n : rea dO n l y
ke y In In t e r p o l a t i o n Ty p e ( i n t e g e r ke y In dex ) ret ur n s Ke y f r a m eIn ter p ol a ti on Ty p e
ke y In Sp a t i a lTan g e n t (i n te g e r ke y In dex ) re t u r n s Ar r ay O fF l o a t
ke y In Te m p o r a l E a s e ( i n te g er ke y In d e x ) re t u r n s Ar r ay O f Ke y f r a m e
ke y Out In ter p ol at i on Ty p e( in te ger ke y In dex) ret ur n s Ke y f r a m eIn ter p ol a t ion Ty p e
ke y O u t Sp a t i a l Ta n g e n t ( i n t e g e r ke y In dex ) ret ur n s Ar r ay O fF l o a t
ke y Out Tem p or a l E as e( i n te g er ke y In d ex ) re tur n s Ar r ay Of Ke y f r a m e
ke y Rov i n g (i n teg e r ke y In dex ) ret u r n s b o o l e a n
ke y S e l e c t e d ( i n t e ger ke y In d e x ) ret ur n s b o o l e a n
ke ySp a ti a l AutoB ezi er( inte ger ke y In d e x ) ret ur n s b o o l e a n
ke y Sp a t i a l Con t inu ou s ( in t e ge r ke y In d e x) ret u r n s b o o l e a n
ke y Te m p o r a l Au t o B e z i e r ( i n t e ger ke y In d e x ) ret ur n s b o o l e a n
ke y Tem p or a l Con t in uous ( in te ger ke y In dex ) ret ur n s b o ol ea n
ke y Ti m e ( i n te g e r ke y In d ex ) re tu r n s fl o a t
ke y Ti m e ( s t r i n g m a r ker Na m e ) ret u r n s f l o a t
ke y Valu e ( in te ge r ke y In de x) ret u r n s t y p e - stored - i n - prop er t y
ke y Valu e( st r i n g ma r kerNam e) re tur n s t y p e- s tore d- i n - p rop er t y
ma tchNam e : s t r i ng : rea dO n ly
m oveTo( in te g er in d ex ) n o ret u r n
n a m e : s t r i n g : rea d O n l y
ne ares tKe y In d ex(f l o at at Ti me ) re tur n s inte ger
nu m Ke y s : in te ger : rea dO n ly
p a ren t Pro p e r t y : Pro p e r t y Gro u p : rea d O n l y
prop er t y D ep t h : i n te ger : rea d On ly
prop e r t y Gro u p ([ i n te g e r cou n tUp ]) ret u r n s Prop e r t y Gro u p
prop er t y Index : i n te ger : rea d Onl y
prop er t y Ty p e : Prop er t y Ty p e : re ad O n ly
prop er t y Va lue Ty p e : Prop er t yVa lue Ty p e : rea d On l y
remove() no re tu r n
rem oveKe y ( i n te g e r ke yIn d ex ) n o re t u r n
s e l e c te d : b oo le an : rea d / w r i te
s e l e c t e d Ke y s : Ar r ay o f in te g er : rea dO n l y
s e t In te r p o l at i o n Ty p e AtKe y( i n te g e r ke y In d ex , Ke y fr ameIn ter p o l at ion Ty p e in Ty p e ,
[ Ke y f r a m e In te r p o l a t i o n Ty p e o ut Ty p e ] ) n o re t u r n
s e t Rov i n g At Ke y ( i n te g e r ke y In d ex , b o o l e an i s Rov in g ) n o re t u r n
s et S e l ec te dAtKe y( i n te g er ke y In d ex , b ool e an i s S el e c ted ) n o re t ur n

195

After Effects Scripting Guide

After Effects Object Summary

196

s e t S p a t i a l AutoB ez i e r AtKe y( i n te g e r ke y In d ex , b o o l e an i s Aut o B ez i e r ) n o re t u r n


s et S pa t i al Con t i nuou sAtKe y( i n te g er ke y In d ex , b o o l e an i s Con t in u o u s ) n o ret u r n
s et S pa t i alTa ngen ts At Ke y( inte ger ke yIndex, Ar r ayO fFlo a t i n Ta ngen t, [ Ar r ayO f Flo at o utTa n gent] )
no re tur n
s e t Te m p or al Au to B e z i e r At Ke y( i n te g e r ke y In d ex , b oo le an i s Aut o B ez i e r ) n o ret ur n
s e t Te m p or al Co n t i nuo u s At Ke y ( i n te g e r ke y In dex , b oo le an i s Con t in u o u s ) n o ret u r n
set Temp or alEa se AtKe y (integer ke yIndex , Ar r ayO fKe y fr ame E ase inEa se,
[ Ar r ay O f Ke y f r am e E as e o ut E a se ] ) n o ret u r n
s e t Va l u e ( t y p e - s to re d - i n - p rop er t y n e w Va l u e ) n o re t u r n
s et Val ueAtKe y( i n te g er ke y In dex , t y p e- s tore d- i n - p rop er t y n ewVa lue ) n o re tu r n
s e t Va l u e AtTi m e ( f l o a t a t Tim e , t y p e - s tore d- i n - prop er t y n ew Va lue) n o re tur n
s e t Val u e s At Ti m e s( Ar r ay O f F lo a t a tTi m e s , Ar r ayO f -t y p e - s tored - i n - prop e r t y n e w Valu e s ) n o re tu r n
un it sTex t : st r ing : re ad O n ly
v alu e : t y p e - store d- i n - prop er t y : re a dO n ly
v alu e At Ti m e ( f l o at a tTi m e , b o o l pre Ex p res s i on ) ret u r n s t y p e - stored - i n - prop er t y
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Pro p e r t y Gro u p o b j ec t ( i n h e r i t s f ro m Prop er t y B as e , w h i ch i s n o t i n s t a n t i a b l e )
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - (inte g er proper t y In dex) ret ur n s Prop er t y B a se
( st r i n g p ro p e r t y Na m e ) re tu r n s Prop er t y B as e
a c t ive : b oo l ean : re ad O n ly
a d dProp er t y (s t r i ng prop er t y Name ) re tur n s Prop er t y Ba s e
can AddProper t y (str ing prop er t y Name ) re tur n s b oole an
can S et Ena ble d : bo olea n : rea dO n ly
du pl i c ate( ) re tur n s Prop er t y Group
e l id ed : b ool e an : rea d On ly
ena ble d : bo olea n : rea dO n ly
i s E ff e c t : b o o l e a n : re a d O n ly
i s Mas k : b o o l e a n : rea dO n l y
i s Mod i fi e d : b o o l e a n : rea dO n l y
ma tchNam e : s t r i ng : rea dO n ly
m oveTo( in te g er in d ex ) n o ret u r n
n a m e : s t r i n g : rea d O n l y
nu m Prop er t i e s : i n te g e r : rea d On l y
p a ren t Pro p e r t y : Pro p e r t y Gro u p : rea d O n l y
prop er t y ( i nte g er prop er t y Index) ret ur n s Prop er t yB a se
prop er t y (st r ing proper t y Na me) ret ur n s Prop er t y B a se
prop er t y D ep t h : i n te ger : rea d On ly
prop e r t y Gro u p ([ i n te g e r cou n tUp ]) ret u r n s Prop e r t y Gro u p
prop er t y Index : i n te ger : rea d Onl y
prop er t y Ty p e : Prop er t y Ty p e : re ad O n ly
remove() no re tu r n
s e l e c te d : b oo le an : rea d / w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Pro p e r t y Ty p e e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Prop er t y Ty p e .I N D E XE D_ G RO UP
Prop er t y Ty p e .NA ME D _ GROU P
Prop er t y Ty p e .P ROPE RT Y

196

After Effects Scripting Guide

After Effects Object Summary

197

= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Proper t y Valu eTy p e enum
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Proper t y Valu eTy p e.CO LO R
Proper t y Valu eTy p e.CU STOM _VALU E
Proper t y Valu eTy p e.LAY E R_IND E X
Proper t y Valu eTy p e.M ARKER
Proper t y Valu eTy p e.M ASK_INDEX
Proper t y Valu eTy p e.NO _VA LUE
Proper t y Valu eTy p e.O n eD
Proper t y Valu eTy p e.SH APE
Proper t y Valu eTy p e.TE XT _D O C UM ENT
Proper t y Valu eTy p e.T hree D
Proper t y Valu eTy p e.T hree D_SPATIAL
Proper t y Valu eTy p e.TwoD
Proper t y Valu eTy p e.TwoD _SPATI AL
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Pul l dow n Ph a s e e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Pul l dow n Ph a s e . O F F
Pul l dow n Ph a s e . S S W W W
Pul l dow n Ph a s e . S W W WS
Pul l d ow n Ph a s e . S W W W W _ 2 4 P _ A DVA N C E
Pul l dow n Ph a s e . WS S W W
Pul l d ow n Ph a s e . WS W W W _ 2 4P _ A DVAN C E
Pul l dow n Ph a s e . W WS S W
Pul l d ow n Ph a s e . W WS W W _ 2 4P _ A DVAN C E
Pul l dow n Ph a s e . W W WS S
Pul l dow n Ph a s e . W W WS W _ 2 4 P _ A DVA N C E
Pul l dow n Ph a s e . W W W WS_ 2 4 P _ A DVA N C E
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Pul l dow n Me t h o d e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Pul l dow n Me t h o d . A DVAN C E _ 2 4 P
Pul l dow n Me t h o d . P U L L D OW N _ 3 _ 2
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
PurgeTa rge t enu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Pur g e Ta r g e t . A L L _ C AC H E S
Pur g e Ta r g e t . I M AG E _ C AC H E S
PurgeTa rge t. SNAP SH OT _ C AC HES
Purg eTa rg e t. UN D O _C AC HE S
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
RenderQu eu e obj ec t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - i te m ( i n te g e r i te m In d e x ) ret ur n s Ren d e r Q u e u e It
items : RQ ItemCol l ec t ion : re adO n ly
nu mItem s : inte ger : re ad O n ly
pau se Render ing (b oole an doPa use) no retur n
ren d e r ( ) n o re t u r n
render in g : bo olea n : rea d Only

197

After Effects Scripting Guide

After Effects Object Summary

198

s how Win dow( b o ol ea n doS how) n o re tur n


s to p Ren d e r i n g ( ) n o re t u r n
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
RenderQu eu eItem obje c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a pp ly Te m p l ate ( st r i n g tem pl a teNam e ) n o ret u r n
com p : Com p Ite m : rea d O n l y
du pl i c ate( ) re tur n s Rend erQu eu eIt
e l ap se d S e co n d s : f l o a t : re ad O n ly
l o g Ty p e : L o g Ty p e : rea d / w r i te
nu m O u t p u t Mo du le s : in te g er : rea d O n l y
out p utMo du le (i nteger o utp ut Modu l eIndex) ret ur n s O ut p utMo du l e
out p utMo du le s : OM Col le c ti on : rea d On ly
remove() no re tu r n
render : bo olean : re ad/w r ite
s aveAs Tem p l a t e ( s t r i n g t e m p l a teNam e) n o re t u r n
s ki p Fr a m e s : i n te g e r : rea d / w r i te
s ta r t Ti m e : fl o a t : rea d On ly
s ta tus : RQ Item S ta tus : rea d On l y
tem pl a tes : Ar r ay of s t r in g : rea dO n l y
t i m eS p an D ur at i o n : f l o at : re ad / w r ite
t i m e S p an S t ar t : f l o at : rea d/ w r i te
o n S t a t u s C h a n g e d ( ) n o re t u r n
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
RQ ItemCol le c tion ob jec t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a d d ( Com p Ite m com p ToAd d ) re t u r n s Ren d er Q u eu e It
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
RQ ItemSt at us enum
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - RQ Item St at us .D ON E
RQ Item St at us .E RR _ STO P PE D
RQ Ite m S t a t u s . N E E D S _ O U T P U T
RQ Item St at us .QU E UE D
RQ Item St at us .RE N D E RI N G
RQ Item St at us .UN QUE U E D
RQ Item St at us .US E R _ STO P PED
RQ Ite m St a t u s . W I L L _ C ON T I N U E
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
S e tt i n g s o b j e c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - g e tS e tt i n g ( s t r in g se c t i o n Nam e ,
s t r i n g se c ti o n Ke y) ret u r n s s t r in g
h aveS e tt i n g ( s t r in g s e c t i o n Nam e ,
s t r i n g s e c ti o n Ke y) ret u r n s b o o l e a n
s aveS e t t in g ( s t r i n g s e c ti o n Na m e , s t r in g s e c t i o n Ke y, s t r i n g n e w Va l u e ) n o re t u r n
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Shape object
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - n e w S ha p e ( ) re tu r n s Sh ap e
cl o se d : b o ol ea n : rea d/ w r i te

198

After Effects Scripting Guide

After Effects Object Summary

199

i n Ta n g e n t s : Ar r ay o f f l o a t [ 2 ] : rea d / w r i te
o u t Ta n gen t s : Ar r ay o f f l o a t [ 2 ] : rea d/ w r i te
ver t ices : Ar r ay of f lo a t[ 2] : rea d /w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
S o l i d S o u rce o b j e c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - a l pha Mod e : Al ph aMo de : rea d / w r i te
co lor : Ar r ay of fl o a t : rea d / w r i te
confor mFr a meRate : flo a t : readOn ly
d i s p l ay Fr a m e R ate : f l o at : re a d O n ly
f i e l d S e p a r a t i on Ty p e : F i e l d S e p a r a t i on Ty p e : rea dO n l y
g u e ss A l ph aMo de( ) n o re t u r n
g u e ss Pu l l dow n (Pul l dow n Me t h o d p u l l dow n Me t h o d) n o re t u r n
h a s Al p h a : b o o l e a n : rea dO n l y
h ig hQ ua l it y F ie l dS epa r a ti on : b oo l ean : re ad O n ly
inver t Alpha : bo olea n : rea d /w r i te
i s St i l l : b o o l e a n : rea dO n l y
l o op : i n te g e r : rea d O n ly
na t iveFr am eRa te : flo at : rea d Only
premu l Col or : Ar r ay of f l oa t : re ad / w r ite
rem ovePu l l dow n : Pul l dow n P ha se : re ad O n ly
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Sys tem ob j ec t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - c a l l Sy s te m ( st r i n g c m d L i n e To Exec tu te ) re t u r n s o u t p u t O f Com m a n d
ma chine Na m e : s t r i ng : rea d Only
o s Nam e : s t r in g : re a d O n ly
os Vers ion : s t r in g : rea dO n ly
us erNam e : s t r i ng : rea dO n ly
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Tex t D o c u m e n t o b j e c t
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - n e w Tex tD o c u m e n t (s t r i n g tex t ) re tur n s Tex tD o c u m e n t
text : s t r i ng : rea d /w r i te
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Tex t L ayer o b j ec t ( s u b cl a s s of AVL ayer, n o ow n m et h o ds o r a t t r i bu t e s )
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - = == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Tim eco de Ba s eTy p e enum
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Tim eco de Ba s eTy p e.AU TO
Tim eco de Ba seTy p e.FPS100
Tim eco de Ba s eTy p e.F P S 24
Tim eco de Ba s eTy p e.F P S 25
Tim eco de Ba s eTy p e.F P S 30
Tim eco de Ba s eTy p e.F P S 48
Tim eco de Ba s eTy p e.F P S 50
Tim eco de Ba s eTy p e.F P S 60

199

After Effects Scripting Guide

After Effects Object Summary

200

= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Tim e co de Di s p l ay Ty p e e nu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Tim e co de Di s p l ay Ty p e .F E E T _ A N D_ F R A M E S
Tim e co de Di s p l ay Ty p e .F R A M E S
Tim e co de Di s p l ay Ty p e .T I M E C O DE
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Tim eco de F il m Ty p e en um
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Tim eco de F il m Ty p e .MM 16
Tim eco de F il m Ty p e .MM 35
= == == == = == == == = == == == == = == == == == = == == == == = == == == == = == == == == = == == == = == ==
Tr a ck Mat teTy p e enu m
- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - Tr a ck Mat teTy p e. AL PH A
Tr a ck Mat teTy p e. AL PH A_ I N VE RT E D
Tr a ck Mat teTy p e. LUM A
Tr a ck Ma t teTy p e . LU M A _ I N V E RT E D
Tr a ck Mat teTy p e. N O_ T RAC K _ MAT T E

200

The Socket Object

TCP connections are the basic transport layer of the Internet. Every time your Web browser connects to a server
and requests a new page, it opens a TCP connection to handle the request as well as the server's reply. The
JavaScript Socket object lets you connect to any server on the Internet and to exchange data with this server.
The Socket object provides basic functionality to connect to a remote computer over a TCP/IP network or the
Internet. It provides calls like open() and close() to establish or to terminate a connection, or read() or write()
to transfer data. The object also contains a listen() method to establish a simple Internet server; the server uses
the method poll() to check for incoming connections.
Many of these connections are based on simple data exchange of ASCII data, while other protocols, like the
FTP protocol, are more complex and involve binary data. One of the simplest protocols is the HTTP protocol.
The following sample TCP/IP client connects to a WWW server (which listens on port 80); it then sends a very
simple HTTP GET request to obtain the home page of the WWW server, and then it reads the reply, which is
the home page together with a HTTP response header.
rep l y = " " ;
con n = n ew S o cke t;
/ / a cces s Ado b e 's h o m e pa g e
i f ( co n n . o p e n ( " w w w.a do b e .com : 8 0" ) ) {
/ / s e n d a H T T P G E T re q u e st
con n . w r it e ( " GE T / in d ex . h t m l H T T P / 1 . 0 \ n \ n " ) ;
/ / a n d re ad th e s e r ve r ' s rep ly
rep l y = con n .rea d () ;
con n .cl o s e ( ) ;
}

After executing this code, the variable rep ly contains the contents of the Adobe home page together with an
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 connections 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.
con n = n ew S o cke t;
/ / l i s te n o n p o r t 8 0
i f con n .l i s te n ( 8 0 ) ) {

201

After Effects Scripting Guide

The Socket Object

202

/ / w a i t f o re ver for a con n e c t io n


v ar i n com i n g ;
d o i n com i n g = con n . p ol l ( ) ;
w hi l e (i ncom ing = = nul l );
/ / d i sc a rd th e requ e s t
rea d () ;
/ / Rep l y w i t h a H T T P h e a d e r
i n com i n g . w r it e l n ( " H T T P / 1 . 0 2 0 0 O K " ) ;
i n com i n g . w r it e l n ( " Con te n t - Ty p e: tex t / h t m l " ) ;
i n com i n g .w r itel n ( ) ;
/ / Tr a n s m i t a d u m my h om e p a g e
i n comi ng .w r iteln ( " <h t m l> <b ody> <h1 >Homep age </h1 >< /bo dy>< / ht ml> " ) ;
// done!
i n com i n g .cl o s e ( ) ;
d e l e te i n com i n g ;
}

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
Socket object constructor
[new ] So cket ();

Creates a new Socket object.


Returns

Socket object.
Properties
conne cted

Boolean

When true, the connection is still active. Read only.

e of

Boolean

When true, the receive buffer is empty. Read only.

er ror

String

A message describing the last error. Setting this value clears any error message.

h ost

String

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.

t i m e o ut

Number

The timeout in seconds to be applied to read or write operations. Default is 10.

202

After Effects Scripting Guide

The Socket Object

203

Methods
cl o se

Terminates the open connection.

l i ste n

Starts listening on an incoming connection.

open

Opens a connection.

poll

Checks a listening object for a new incoming connection.

rea d

Reads characters from a connection.

rea d l n

Reads one line of text from a connection.

w r ite

Writes characters to a connection.

w r itel n

Writes one line of text to a connection.

Socket object close() method


cl o se ( ) ;

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

Socket object listen() method


l i s t e n ( p or t [ , e n co d i n g ] ) ;

Instructs the object to start listening for an incoming connection.


The call to op en () and the call to l i sten () are mutually exclusive. Call one function or the other, not both.
Parameters
port

Number

The TCP/IP port number to listen on. Valid port numbers are 1 to 65535. Typical values are 80 for a Web
server, 23 for a Telnet server and so on.

enco din g

String

Optional. The encoding to be used for the connection. Typical values are "ASCII", "binary", or "UTF-8".
Default is ASCII.

Returns

Boolean

Socket object open() method


o p e n ( hos t [ , e n cod i n g ]) ;

Opens the connection for subsequent read/write operations. The call to o p e n ( ) and the call to l i s te n ( ) are
mutually exclusive. Call one function or the other, not both.

203

After Effects Scripting Guide

The Socket Object

204

Parameters
h ost

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 required. Valid computer names are, for example, "www.adobe.com:80" or
"192.150.14.12:80".

enco din g

String

Optional. The encoding to be used for the connection. Typical values are "ASCII", "binary", or "UTF-8".
Default is ASCII.

Returns

Boolean, true on success.

Socket object poll() method


p o l l ( );

Checks 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

Socket object or null.

Socket object read() method


rea d ( [ co u n t] ) ;

Reads up to the specified number of characters from the connection. Returns a string that contains up to the
number of characters that were supposed to be read, or the number of characters read before the connection
closed or timed out.
Parameters
co un t

Number

Optional. The number of characters to read. If not 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

Socket object readln() method


rea d l n ( );

Reads one line of text up to the next line feed. Line feeds are recognized as CR, LF, CRLF or LFCR pairs.
Returns

String

Socket object write() method


w r ite ( tex t , );

204

After Effects Scripting Guide

The Socket Object

205

Concatenates all arguments into a single string and writes that string to the connection.
Parameters
text

String

Any number of string values. All arguments are concatenated to form the string to be written.

Returns

Boolean, true on success.

Socket object writeln() method


w r itel n ( text , ) ;

Concatenates all arguments into a single string, appends a Line Feed character, and writes that string to the
connection.
Parameters
text

String

Any number of string values. All arguments are concatenated to form the string to be written.

Returns

Boolean, true on success.

Chat server sample


The following sample code implements a very simple chat server. A chat client may connect to the chat server,
who is listening on port number 1234. The server responds with a welcome message and waits for one line of
input from the client. The client types some text and transmits it to the server who displays the text and lets
the user at the server computer type a line of text, which the client computer again displays. This goes back
and forth until either the server or the client computer types the word "bye".
f u n c t io n ch at S e r ve r ( ) {
v ar tc p = n ew S o cket ;
// listen on port 1234
w r i t e l n ( " Ch a t s e r ve r l i s te n i n g o n p o r t 1 2 3 4 " ) ;
i f (tc p.l i sten (1 234 )) {
for ( ;; ) {
/ / p o l l f o r a n e w con n e c t i on
v ar con n e c ti o n = tc p. p o l l ( ) ;
i f ( co n n e c ti o n ! = nul l ) {
w r ite l n ( " Con n e c t i o n f ro m " + con n e c t io n . ho s t ) ;
// we h ave a n ew con n ec t ion, so we lcome a n d ch at
/ / u n ti l cl i e n t ter m i n a te s the se ss i o n
con n e c ti o n . w r i te l n ( " We l co m e to a l it t le cha t ! " ) ;
ch a t ( co n n e c t i o n ) ;
con n e c ti o n . w r i te l n (" * * * G o o d bye * * * " );
con n e c ti o n . c l o s e () ;
de le te conne c t ion;
w r ite l n ( " Con n e c t i o n cl o s e d " ) ;
}
}

205

After Effects Scripting Guide

The Socket Object

206

}
}
f u n c t io n ch a t C li e n t ( ) {
v ar con n e c ti o n = n e w S o c ke t ;
/ / con n e c t to s am pl e s e r ve r
i f ( co n n e c ti o n . o p e n ( " rem o te -pc.cor p.a dob e.com: 123 4")) {
// t hen cha t w i th ser ver
cha t ( co n n e c t i o n ) ;
con n e c t i o n . c l o s e () ;
d e l e te con n e c ti o n ;
}
}
f u n c t io n ch at (c ) {
// select a long timeout
c.t i me out= 10 00;
w hi l e (t r ue ) {
// get one line and echo it
w r iteln (c.rea d());
/ / s top i f t h e con n e c t i o n is b ro ke n
i f ( ! c . con n e c te d )
b re a k ;
/ / rea d a l i n e of tex t
w r ite ( " chat : " ) ;
v ar tex t = re ad l n () ;
i f ( t ex t = = " bye" )
// stop conversat i on if t he user entere d "bye"
b re a k ;
e l se
/ / o t h e r w i se t r a n s m it to s e r ve r
c . w r i te ln (tex t ) ;
}
}

206

Render Automation Command

A command-line tool provided with After Effects, allows you to render After Effects compositions from the
command line without going through the user interface. This chapter provides reference information for the
tool.

aerender command-line tool


The executable file a eren der (a eren der.exe in Windows) renders After Effects compositions from the
command line. The command takes a series of optional arguments. Some are simple flags, like " reus e ", and
some have one or two parameters, such as " p ro j e c t proj ec t_p ath " and
" m e m _ u s a g e i m age _ ca c he _ p e rc e n t m a x _ m e m _ p e rc e n t ". Execute the command with no arguments or with
the h el p argument to print a usage message with the information contained in this section.
The render may be performed either by an already running instance of After Effects or by a newly invoked
instance. By default, a eren der invokes a new instance of After Effects, even if one is already running. To change
this, specify the " re u s e " argument.
Argument

Description

help

Print usage message.

re u s e

Reuse the currently running instance of After Effects (if found) to perform the render. When
a running instance is used, a eren der saves preferences to disk when rendering is completed, but does not quit After Effects.
If this argument is not supplied, a eren der launches a new instance of After Effects, even if
one is already running. It quits that instance when rendering is completed, and does not save
preferences.

p ro j e c t proj ect_p ath

p roj ec t _ p a t h is a file path or URI specifying a project file to open.


If this argument is not provided, a eren der works with the currently open project. If no
project is specified and no project is open, an error results.

com p c o m p_ n a m e

c o m p_ n a m e specifies a composition to be rendered.

If the composition is in the render queue already, and in a queueable state, then the first
queueable instance of that composition in the render queue is rendered.

If the composition is in the project but not in the render queue, then it is added to the render queue and rendered.
If this argument is not provided, a eren der renders the entire render queue as is. In this case,
only the p ro j e c t , l o g , o u t p u t , v, m e m _ u sa ge and cl o s e arguments are
used. All other arguments are ignored.

R Stempla te

r e n d e r _ s e t t i n g s _ te m p l a te is the name of a template to apply to the render queue item.

r e n d e r _s e t t in g s _ te m p l a t e

If the template does not exist, an error results.


If this argument is not provided, aerender uses the render template already defined for the
item.

207

After Effects Scripting Guide

Render Automation Command

208

Argument

Description

O Mtemplate

out p ut_mo dul e_te mplate is the name of a template to apply to the output module. If

o u t p u t _ m o d u le _ t e m p l a t e

the template does not exist, an error results.


If this argument is not provided, aerender uses the template already defined for the output
module.

o u t p u t ou t p ut_p a t h

out p ut_p a t h is a file path or URI specifying the destination render file.
If this argument is not provided, aerender uses the path already in the project file.

log log file_path

l o g f i l e _ p a t h is a file path or URI specifying the location of the log file.


If this argument is not provided, aerender uses s tdo ut .

s star t_frame

star t_frame is the first frame to render.


If this argument is not provided, aerender uses the start frame in the file.

e e n d _ f ra m e

e n d_ f ram e is the last frame to render (note that specified frame is rendered).
If this argument is not provided, aerender uses the end frame in the file.

i i n c re m e n t

in c re m e n t is the number of frames to advance before rendering a new frame. A value of 1


(the default) results in a normal rendering of all frames. Higher increments repeat the same
frame i 1 times and then render a new one, starting the cycle again. Higher values result in
faster renders but choppier motion.

m e m _ u sa ge

im a ge_ c ac h e_ p e rce n t specifies the maximum percent of memory used to cache already

ima ge _ cac h e_p e rce n t

rendered images/footage.

m a x _ m e m _ p e rc e n t

m a x _ m e m _ p e rce n t specifies the total percent of memory that can be used by After
Effects.
For both values, if installed RAM is less than a given amount (n gigabytes), the value is a percentage of the installed RAM, and is otherwise a percentage of n. The value of n is: 2 Gb for
Win32, 4 Gb for Win64, 3.5 Gb for Mac OS.

v ve rb os e_flag

v e r b o s e _ f l a g specifies the type of messages reported. One of:

ERRO RS : prints only fatal and problem errors.


E R RO R S _ A N D _ P RO GR E S S (default): prints progress of rendering as well.
cl o se c lo s e_ f l ag

c lo s e _ f la g specifies whether or not to close the project when done rendering, and whether
or not to save changes. One of:

D O_ N OT _ S AVE _ C H A N G E S (default): the project is closed without saving


changes.

S AV E _ C H A N G E S : the project is closed and changes are saved.


D O_ N OT _ C LO SE : the project is left open if using an already-running instance of After
Effects (new invocations of After Effects must always close and quit when done).
s o u n d s oun d _ f la g

s oun d _ f la g specifies whether or not to play a sound when rendering is complete. One of
O N or O F F. Default is OFF.

ve r s i on

Displays the version number of a eren d er to the console. Does not render.

Examples

To render just Comp 1 to a specified file, enter this command:


a erend er - pro je c t c :\proj ec ts \ proj1 .a ep - comp "Comp 1" - o ut p ut c : \out put \ pro j1 \ pro j1. av i

To render everything in the render queue as is in the project file, enter this command:
a eren d er - pro je c t c :\ proj ec ts \ proj1 .a ep

208

After Effects Scripting Guide

Render Automation Command

209

To render frames 1 through 10 using multi-machine render, enter this command:


a e ren d e r - pro j e c t c : \ proj e c ts \ pro j 1 .a e p - co m p " Co m p 1 " - s 1 - e 1 0
- R S te m p l a te " Mu l t i - Ma ch i n e S e t t i n g s " - O M te m p l a te " Mu l t i- Ma ch in e S e q u e n ce "
-out put c:\o utput \ pro j1\fr a m es[# ### ]. psd

209

También podría gustarte