Está en la página 1de 209

bb

c

G

ua de secuencias de comandos
de After Effects
C

op

yr

igh

t 2005 A

dobe S

y

st

ems I

nc

or

por

a

t

ed

.

T

odos los der

echos r

eser

v

ados

.

Gua de secuencias de c

omandos de A

dobe


A

f

t

er Eff

ec

ts


A

VISO:

T

oda la

inf

or

macin c

on

t

enida en est

e documen

t

o es pr

opiedad de A

dobe S

y

st

ems I

nc

or

por

a

t

ed

. S

e pr

ohbe r

epr

oducir y tr

ansmitir

cualquier par

t

e de esta publicacin (y

a sea en f

or

ma

t

o

impr

eso o elec

tr

nic

o) en cualquier f

or

ma o por cualquier medio (elec

tr

nic

o

,

mecnic

o

, f

ot

oc

opiado

, g

r

abacin o de otr

o tipo) sin el pr

evio c

onsen

timien

t

o por escr

it

o de A

dobe S

y

st

ems I

nc

or

por

a

t

ed

. El sof

t

w

ar

e

descr

it

o en est

e documen

t

o se pr

opor

ciona bajo lic

encia y slo puede utilizarse o c

opiarse de acuer

do c

on los t

r

minos de dicha lic

encia.

Esta publicacin y la

inf

or

macin que c

on

tiene se pr

opor

ciona

T

AL CU

AL, est sujeta a cambios sin pr

evio a

viso y no debe

in

t

er

pr

etarse c

omo

un c

ompr

omiso por par

t

e de A

dobe S

y

st

ems I

nc

or

por

a

t

ed

. A

dobe S

y

st

ems I

nc

or

por

a

t

ed no asume ninguna r

esponsabilidad ni c

ompr

omiso

por er

r

or

es o

inexac

titudes

, no ofr

ec

e gar

an

ta de ningn tipo (y

a sean expr

esas

,

implcitas o legales) r

espec

t

o a esta publicacin y niega

expr

esamen

t

e t

odas las gar

an

tas de c

omer

ciabilidad

, adaptacin par

a un pr

opsit

o par

ticular y no

-infr

ac

cin de der

echos de t

er

c

er

os

.

C

ualquier r

ef

er

encia a nombr

es de empr

esas en las plan

tillas de ejemplo tiene slo fines

inf

or

ma

tiv

os y no pr

et

ende r

ef

er

irse a ninguna

or

ganizacin r

eal

.

A

dobe

, el logotipo de A

dobe

, A

f

t

er Eff

ec

ts y P

hot

oshop son mar

cas c

omer

ciales o mar

cas r

eg

istr

adas de A

dobe 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.
3



In

troduccin

La

G

ua de s

ecue

nc

ias de c

omandos de

A

ft

e

r E

ff

ec

ts



m

uest

r

a cmo o

b

t

e

ne

r un c

o

nt

r

ol d

e los p

r

o

c

e

dimie

nt

os d

e

los p

r

o

y

e

c

t

os d

e

A

ft

e

r Eff

e

c

ts me

diant

e se

cue

ncias d

e c

o

mand

os.

Est

e c

o

nj

unt

o d

e funcio

nes est disp

o

nib

le

nicame

nt

e e

n

A

d

o

b

e

A

ft

e

r Eff

e

c

ts 7.0 P

r

o

f

essio

nal Edit

io

n.

M

e

diant

e las se

cue

ncias d

e c

o

mand

os d

e

l sist

e

ma,

pue

d

e simpli

car la canaliza

cin d

e p

r

o

c

esos y e

v

itar t

e

ne

r

q

ue se

le

c

cio

nar y ha

c

e

r c

lic r

e

p

e

t

idame

nt

e.

S

i ha u

t

iliza

d

o e

xp

r

esio

nes u ot

r

as tcnicas similar

es a J

a

v

aScr

ip

t

par

a la anima

cin,

o ha t

r

abaj

a

d

o c

o

n se

cue

ncias d

e c

o

mand

os d

e

l sist

e

ma e

n

A

p

pleScr

ip

t o

V

is

ual B

asic,



r

e

c

o

no

c

e

r la e


ca

cia d

e las se

cue

ncias d

e c

o

mand

os e

n

A

ft

e

r Eff

e

c

ts.

C

o

n p

rc

t

ica y e

xp

e

r

ie

ncia s

u

cie

nt

e e

n

e

l le

nguaje J

a

v

aScr

ip

t,

p

o

dr c

o

nt

r

olar la canaliza

cin d

e los g

r

c

os.
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 codicadas
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 er en d er , 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 grca; 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 ecacia del
procesamiento en red en situaciones en las que la Carpeta de inspeccin es menos ecaz (y ms difcil de
congurar). 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 ecacia de las secuencias de
comandos mediante soluciones de terceros como Rush Network Render Queue, una interfaz de usuario grca
que permite congurar procesos distribuidos desde cualquier equipo de la red sin tener que congurarlos 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 er en d er , especial para este n (consulte Render Automation Command en la pgina 207).
4
Gua de secuencias de comandos de After Effects Introduccin
4
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
www. a d o b e f o r u m s . co m .
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 especica el usuario.
Acerca de esta gua
Esta gua est destinada a usuarios que administren canalizaciones de grcos (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.
5
Gua de secuencias de comandos de After Effects Introduccin
5
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 at ributos en esta
gua para evitar la confusin con la propia denicin de una propiedad en After Effects ( un valor que se puede
animar de un efecto, mscara o t ransformacin 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
Denir 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 codicacin 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 modicar 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.
6



E

scritura de secuencias de comandos

C

uand

o u

t

iliza

A

d

o

b

e

A

ft

e

r Eff

e

c

ts,

cr

ea p

r

o

y

e

c

t

os,

c

o

mp

osicio

nes y e

le

me

nt

os d

e la c

ola d

e p

r

o

c

esamie

nt

o

j

unt

o c

o

n t

o

d

os los e

le

me

nt

os q

ue c

o

nt

ie

ne

n:

mat

e

r

ial d

e ar

c

hi

v

o

,

img

e

nes,

slid

os,

capas,

mscar

as,

e

f

e

c

t

os

y p

r

o

pie

da

d

es.

En tr

minos d

e se

cue

ncia d

e c

o

mand

os,

ca

da uno d

e est

os e

le

me

nt

os es un o

b

je

t

o

.

El nc

le

o d

e una aplica

cin d

e se

cue

ncia d

e c

o

mand

os es e

l mo

d

e

lo d

e o

b

je

t

os.

En

A

ft

e

r Eff

e

c

ts,

e

l mo

d

e

lo

d

e



o

b

je

t

os est f

o

r

ma

d

o p

o

r un p

r

o

y

e

c

t

o

,

e

le

me

nt

os,

c

o

mp

osicio

nes,

capas y e

le

me

nt

os d

e la c

ola d

e

p

r

o

c

esamie

nt

o

.

C

a

da o

b

je

t

o t

ie

ne s

us at

r

ib

u

t

os esp

e

ciales y ca

da o

b

je

t

o d

e un p

r

o

y

e

c

t

o d

e

A

ft

e

r Eff

e

c

ts

t

ie

ne



una id

e

nt

ida

d p

r

o

pia (aunq

ue no t

o

d

os se pue

den 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 codicacin Unicode (UTF-8).
Algunas aplicaciones de Windows tiles para editar secuencias de comandos son EM Editor o el Bloc de
notas integrado (asegrese de denir la codicacin 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 denir el tipo de almacenamiento como Unicode [UTF-
8] 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 especicacin 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 dene un objeto de depuracin global, el objeto de dlar ($) y una utilidad de
generacin de informes para elementos de ExtendScript, la interfaz ExtendScript Reection.
Objetos File y Folder: Puesto que la sintaxis de los nombres de rutas es muy diferente en los distintos sistemas
operativos, Adobe ExendScript dene los objetos Fi l e y Fo l d er para proporcionar un acceso independiente de
la plataforma al sistema de archivos subyacente.
7
Gua de secuencias de comandos de After Effects Escritura de secuencias de comandos
7
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 , co n r m y p r o m 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 codicado 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 denir variables y funciones disponibles para todas las secuencias de comandos. En todos los
casos, las variables y las funciones, una vez denidas mediante la ejecucin de la secuencia de comandos que
las contiene, continan en las siguientes secuencias de comandos durante una sesin de After Effects
especca. Cuando se cierra la aplicacin, todas estas variables y funciones denidas 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.
8
Gua de secuencias de comandos de After Effects Escritura de secuencias de comandos
8
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 t er f x. exe s :
a f t er f x. exe s "a l e r t ( "Aca b a d e e n vi a r u n a a l e r t a a Af t er Ef f e c t s ") "
Tambin puede especicar la ubicacin del archivo JSX que se va a ejecutar. Por ejemplo:
a f t er f x. exe r c: \ m i s Do cu m e n t o s \ Scr i p t s \ su AEScr i p t H er e . j s x
a f t er f x. exe r "c: \ m i s Do cu m e n t o s \ Scr i p t s \ No m b r e d e Scr i p t co n Sp 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:
t e l l a p p l i ca t i o n "Ad o b e Af t er Ef f e c t s 7. 0"
Do Scr i p t "a l e r t ( \ "Aca b a d e e n vi a r u n a a l e r t a a Af t er Ef f e c t s \ ") "
en d t e 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 Fi l e t o ch o o s e l e
t e l l a p p l i ca t i o n "Ad o b e Af t er Ef f e c t s 7. 0"
Do Scr i p t t h e Fi l e
en d t e 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 ecaz, debe especicar 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.
9
Gua de secuencias de comandos de After Effects Escritura de secuencias de comandos
9
Basta con que resalte el texto de la secuencia que desea ejecutar y, a continuacin, active este AppleScript:
( *
Es t a s e cu e n ci a d e co m a n d o s e n v a l a s e l e cci n a c t u a l a Af t er Ef f e c t s co m o u n a s e cu e n ci a d e co m a n d o s .
*)
t e l l a p p l i ca t i o n Text Ed i t
s e t t h e _ s cr i p t t o s e l e c t i o n a s t ext
en d t e l l
t e l l a p p l i ca t i o n "Ad o b e Af t er Ef f e c t s 7. 0"
a c t i va t e
Do Scr i p t t h e _ s cr i p t
en d t e l l
Para obtener ms informacin sobre cmo utilizar AppleScript, consulte AppleScript: the Denitive 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 www. e cm a - i n t er n a t i o n a l . o r g/ p u b l i ca t i o n s / s t a n d a r d s /
Ecm a - 262. h t m .
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 Denitive 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.
10
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
b r e a k JavaScript estndar; cierra el bucle que se est ejecutando actualmente.
co n t i n u e JavaScript estndar; interrumpe la ejecucin de la repeticin del bucle actual.
ca s e Etiqueta que se utiliza en una instruccin s wi t ch .
d e f a u l t Etiqueta que se utiliza en una instruccin s wi t ch cuando no se encuentra una etiqueta ca s e.
d o . . . wh i l e Constructor estndar de JavaScript. Similar al bucle wh i l e, salvo que la evaluacin de la condicin
del bucle se produce al nal del mismo.
f a l s e Literal que representa el valor falso booleano.
f o r Construccin de bucle estndar de JavaScript.
f o r . . . i n Construccin estndar de JavaScript. Proporciona una manera de desplazarse fcilmente por las
propiedades de un objeto.
f u n c t i o n Se utiliza para denir una funcin.
i f / i f . . . e l s e Construcciones condicionales estndar de JavaScript.
n e w Instruccin de constructor estndar de JavaScript.
n u l l Se asigna a una variable, elemento de conjunto o propiedad de objeto para indicar que no
contiene un valor vlido.
r e t u r n Forma estndar de JavaScript de devolver un valor de una funcin o salir de una funcin.
s wi t ch Forma estndar de JavaScript de evaluar una expresin de JavaScript e intentar corresponder el
valor de la expresin con una etiqueta ca s e.
t h i s Mtodo estndar de JavaScript para indicar el objeto actual.
t r u e Literal que representa el valor verdadero booleano.
u n d e n e d Indica que todava no se ha asignado un valor a la variable, elemento de conjunto o propiedad de
objeto.
va r Sintaxis estndar de JavaScript que se utiliza para declarar una variable local.
wh i l e Construccin estndar de JavaScript. Similar al bucle d o . . . wh i l e, salvo que la evaluacin de la
condicin del bucle se produce al principio del mismo.
wi t h Construccin estndar de JavaScript que se utiliza para especicar un objeto que se va a utilizar
en instrucciones posteriores.
11
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 e w Asigna un objeto.
d e l e t e Anula la asignacin de un objeto.
t yp e o f Devuelve un tipo de datos.
vo i d Devuelve un valor sin denir.
. 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.
12
Gua de secuencias de comandos de After Effects Escritura de secuencias de comandos
12
Table 3 Prioridad de los operadores
?: 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.
Operadores (de mayor a menor prioridad) Asociatividad
[ ] , ( ) , . izquierda a derecha
n e w, d e l e t e , ( n e ga ci n u n a r i a ) , !, t yp e o f , vo i d , + + , derecha a izquierda
*, / , % izquierda a derecha
+ , ( r e 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
Operadores Descripcin
13
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 imple-
ments the 3rd Edition of the ECMA-262 Standard, including its notational and lexical conventions, types,
objects, expressions and statements. For a complete listing of the keywords and operators included with
ECMAScript, refer to ECMA-262. pdf , available at www. ecma-i nternat i onal . org/ publ i cat i ons/ st andards/
Ecma-262. ht 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 correspon-
dence to the user interface.
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.
application
pro|ect settings
renderQueue ITEMS
ITEMSmay be any of the following 3 types of item:
item(s)
renderQueue|tem(s)
outputModule(s)
socket file folder system
folder|tem footage|tem
PROXY3OURCE PROXY3OURCE MAIN3OURCE
solidSource
color
fileSource
file
placeholderSource
layer(s)
properties
comp|tem
/2
/2
/2
/2
MAIN3OURCE& PROXY3OURCE
may be any of the following 3 types of item:
14
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 repre-
sented by objects in scripting.
NOTE: To avoid ambiguity, this manual uses the term attribute to refer to JavaScript object properties, and the
term property or AE property to refer to After-Effects layer properties.
Object summary
The following table lists all objects alphabetically, with links to the documentation page for each.
Object Description
Global functions on page 16 Globally available functions that allow you to display text for script debugging purposes,
and help convert time values between seconds and frames.
Application object on page 19 A single global object, available by its name (app), 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.
15
After Effects Scripting Guide JavaScript Reference
15
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.
Object Description
16
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.
Additional global functions for standard user I/O (al er t , conf i rm, and prompt ) 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 earOut put ()
Description
Clears the output in the Info panel.
Parameters
None.
Returns
Nothing.
currentFormatToTime() global function
cur rent Format ToTi me(f or mat t edTi me, f ps , i s Durat i on)
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
Global function Description
wr i t e() Writes text to the Info panel, with no line break added.
wr i t eLn() Writes text to the Info panel, adding a line break at the end.
cl earOut put () Clears text from the Info panel.
t i meToCur rent For mat () Converts a numeric time value to a string time value.
cur rent Format ToTi me() Converts string time value to a numeric time value.
f ormat tedTi me The frame time value, a string specifying a number of frames in the projects current time display format.
f ps The frames-per-second, a floating-point value.
17
After Effects Scripting Guide JavaScript Reference
17
Returns
Floating-point value, the number of seconds.
timeToCurrentFormat() global function
t i meToCur rent For mat (t i me, f ps , i s Durat 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
Returns
String in the projects current time display format.
write() global function
wr i t e(t ext )
Description
Writes output to the Info panel, with no line break added.
Parameters
Returns
Nothing.
Example
wr i t e("Thi s text appears i n Inf o panel ");
wr i t e("wi t h more on same l i ne. ");
i sDurat i on 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.
t i me The number of seconds, a floating-point value.
f ps The frames-per-second, a floating-point value.
i sDurat i on 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.
text The string to display. Truncated if too long for the Info panel.
18
After Effects Scripting Guide JavaScript Reference
18
writeLn() global function
wr i t eLn(t ext )
Description
Writes output to the Info panel and adds a line break at the end.
Parameters
Returns
Nothing.
Example
wr i t el n("Thi s text appears on f i rst l i ne");
wr i t el n("Thi s text appears on second l i ne");
text The string to display.
19
After Effects Scripting Guide JavaScript Reference
19
Application object
app
Description
Provides access to objects and application settings within the After Effects application. The single global object
is always available by its name, app.
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 ect Application project attribute on
page 27 and Project object on
page 104
The current After Effects project.
l anguage Application language attribute on
page 25
The language in which the application is running.
versi on Application version attribute on
page 30
The version number of the After Effects application.
seri al Number Application serialNumber attribute on
page 29
The serial number of the After Effects installation.
regi steredName Application registeredName attribute
on page 28
The user name to which the After Effects installation is
registered.
regi steredCompany Application registeredCompany
attribute on page 28
The company to which the After Effects installation is
registered.
bui l dName Application buildName attribute on
page 21
The name of this build of the application.
bui l dNumber Application buildNumber attribute on
page 22
The number of this build of the application.
i sProf essi onal Versi on Application isProfessionalVersion
attribute on page 24
When true, the installation is the Professional Edition.
i sWatchFol der Application isWatchFolder attribute
on page 25
When true, the local application is running in Watch
Folder mode.
i sRenderEngi ne Application isRenderEngine attribute
on page 24
When true, the local After Effects application is installed
as a render engine.
set t i ngs Application settings attribute on
page 30 and RQItemCollection object
on page 156
Application settings that can be set via scripting.
onEr ror Application onError attribute on
page 26
A callback function that is called when an error occurs
in the application.
exi t Code 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.
exi t Af terLaunchAndEval Application exitAfterLaunchAndEval
attribute on page 23
When true, the application remains open after running
a script from the command line on Windows.
20
After Effects Scripting Guide JavaScript Reference
20
Methods
Application activate() method
app. act i vate()
Description
Opens the application main window if it is minimized or iconified, and brings it to the front of the desktop.
Parameters
None.
saveProj ect OnCr ash Application saveProjectOnCrash
attribute on page 28
When true, the project is saved if the application closes
unexpectedly.
Method Reference Description
newProj ect () 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.
watchFol der() Application watchFolder() method on
page 30
Starts Watch Folder mode; does not return
until Watch Folder mode is turned off.
pauseWatchFol der() Application pauseWatchFolder() method
on page 27
Pauses a current watch-folder process.
endWatchFol der() Application endWatchFolder() method on
page 23
Ends a current watch-folder process.
purge() Application purge() method on page 27 Purges a targeted type of cached information
(replicates Purge options in the Edit menu).
begi 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.
begi nSuppressDi al ogs() Application beginSuppressDialogs()
method on page 21
Begins suppression of dialogs in the user inter-
face.
endSuppressDi al ogs() Application endSuppressDialogs()
method on page 22
Ends suppression of dialogs in the user inter-
face.
set Memor yUsageLi mi t s() Application setMemoryUsageLimits()
method on page 29
Sets memory usage limits as in the Memory &
Cache preferences area.
set SavePref erencesOnQui t () Application setSavePreferencesOnQuit()
method on page 30
Sets whether preferences are saved when the
application is quit.
act i vate() Application activate() method on page 20 Brings the After Effects main window to the
front of the screen.
schedul eTask() Application scheduleTask() method on
page 29
Schedules a JavaScript script for delayed exe-
cution.
cancel Task() Application cancelTask() method on
page 22
Cancels a scheduled task.
Attribute Reference Description
21
After Effects Scripting Guide JavaScript Reference
21
Returns
Nothing.
Application beginSuppressDialogs() method
app. begi nSuppressDi al ogs()
Description
Begins suppression of script error dialog boxes in the user interface. Use endSuppressDi al ogs() to resume the
display of error dialogs. See Application endSuppressDialogs() method on page 22.
Parameters
None.
Returns
Nothing.
Application beginUndoGroup() method
app. begi nUndoGroup(undoSt r i ng)
Description
Marks the beginning of an undo group, which allows a script to logically group all of its actions as a single
undoable action (for use with the Edit > Undo/Redo menu items). Use the endUndoGroup() method to mark
the end of the group. (See Application endUndoGroup() method on page 22.)
begi nUndoGroup() and endUndoGroup() pairs can be nested. Groups within groups become part of the
larger group, and will undo correctly. In this case, the names of inner groups are ignored.
Parameters
Returns
Nothing.
Application buildName attribute
app. bui l dName
Description
The name of the build of After Effects being run, used internally by Adobe for testing and troubleshooting.
Type
String; read-only.
undoSt r i ng The text that will appear for the Undo command in the Edit menu (that is, Undo <undoSt ri ng>)
22
After Effects Scripting Guide JavaScript Reference
22
Application buildNumber attribute
app. bui l dNumber
Description
The number of the build of After Effects being run, used internally by Adobe for testing and troubleshooting.
Type
Integer; read-only.
Application cancelTask() method
app. cancel Task(t as kI D)
Description
Removes the specified task from the queue of tasks scheduled for delayed execution.
Parameters
Returns
Nothing.
Application endSuppressDialogs() method
app. endSuppressDi al ogs(al er 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 begi nSuppressDi al ogs() has previously been called. See Application beginSuppress-
Dialogs() method on page 21.
Parameters
Returns
Nothing.
Application endUndoGroup() method
app. endUndoGroup()
Description
Marks the end of an undo group begun with the app. begi nUndoGroup() 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.
t askI D An integer that identifies the task, as returned by app. schedul eTask().
al er t Boolean; when true, errors that have occurred following the call to begi nSuppressDi al ogs() are displayed in a
dialog box.
23
After Effects Scripting Guide JavaScript Reference
23
Calling this method without having set a begi nUndoGroup() method yields an error.
Parameters
None.
Returns
Nothing.
Application endWatchFolder() method
app. endWatchFol 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
app. exi t Af t erLaunchAndEval
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.
24
After Effects Scripting Guide JavaScript Reference
24
Application exitCode attribute
app. exi t Code
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 terf x or af t gerf x m command), and a script was specified with the r or s option.
in Mac OS, the value is returned as the Applescript DoScri pt result for each script.
In both Mac OS and Windows, the value is set to 0 (EXIT_SUCCESS) at the beginning of each script evalu-
ation. In the event of an error while the script is running, the script can set this to a positive integer that
indicates what error occured.
Type
Integer; read/write.
Example
app. exi t Code = 2; / / on qui t , i f val ue i s 2, an er ror has occurred
Application isProfessionalVersion attribute
app. i sProf essi onal Versi 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
var PB = app. i sProf essi onal Versi on;
al er t ("It i s " + PB + " t hat you are runni ng t he Prof essi onal Edi t i on. ");
Application isRenderEngine attribute
app. i sRenderEngi ne
Description
True if an installation of After Effects is a Render Engine-only installation.
Type
Boolean; read-only.
25
After Effects Scripting Guide JavaScript Reference
25
Application isWatchFolder attribute
app. i sWat chFol 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
app. l anguage
Description
The language After Effects is running.
Type
A Language enumerated value; read-only. One of:
Language. ENGLI SH
Language. FRENCH
Language. GERMAN
Language. I TALI AN
Language. JAPANESE
Language. SPANI SH
Example
var l ang = app. l anguage;
i f (l ang == Language. ENGLISH)
al er t ("Af ter Ef f ect s i s runni ng i n Engl i sh. ");
el se i f (l ang == Language. FRENCH)
al er t ("Af ter Ef f ect s i s runni ng i n French. ");
el se
al er t ("Af ter Ef f ect s i s not runni ng i n Engl i sh or French. ");
Application newProject() method
app. newProj ect ()
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 app. proj ect . cl ose(Cl oseOp-
t i ons. DO_NOT_SAVE_CHANGES) to close the current project before opening a new one. See Project
close() method on page 105.
Parameters
None.
26
After Effects Scripting Guide JavaScript Reference
26
Returns
A new Project object, or null if no new project is created.
Example
app. proj ect . cl ose(Cl oseOpt i ons. DO_NOT_SAVE_CHANGES);
app. newProj ect ();
Application onError attribute
app. onError
Description
The name of a callback function that is called when an error occurs. By creating a function and assigning it to
this attribute, you can respond to errors systematically; for example, you can close and restart the application,
noting the error in a log file if it occurred during rendering. See RenderQueue render() method on page 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 unct i on er r(errSt ri ng) {
al er t (er rSt r i ng);
}
app. onError = er r ;
Application open() method
app. open()
app. open(f i l e)
Description
Opens a project.
Parameters
Returns
A new Project object for the specified project, or null if the user cancels the Open dialog box.
Example
var my_f i l e = new Fi l e(". . / my_f ol der/ my_test . aep");
i f (my_f i l e. exi st s){
new_proj ect = app. open(my_f i l e);
i f (new_proj ect ){
al er t (new_proj ect . f i l e. name);
}
f i l e Optional. An ExtendScript File object for the project file to open. If not supplied, the method prompts the
user to select a project file.
27
After Effects Scripting Guide JavaScript Reference
27
}
Application pauseWatchFolder() method
app. pauseWat chFol der(paus e)
Description
Pauses or resumes the search of the target watch folder for items to render.
Parameters
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
app. proj ect
Description
The project that is currently loaded. See Project object on page 104.
Type
Project object; read-only.
Application purge() method
app. purge(t arget )
Description
Purges unused data of the specified types from memory. Replicates the Purge options in the Edit menu.
Parameters
Returns
Nothing.
pause True to pause, false to resume.
t arget The type of elements to purge from memory; a PurgeTarget enumerated value, one of:
PurgeTarget . ALL_CACHES: Purges all data that After Effects has cached to physical memory.
PurgeTarget . UNDO_CACHES: Purges all data saved in the undo cache.
PurgeTarget . SNAPSHOT_CACHES: Purges all data cached as comp/layer snapshots.
PurgeTarget . IMAGE_CACHES: Purges all saved image data.
28
After Effects Scripting Guide JavaScript Reference
28
Application quit() method
app. qui t ()
Description
Quits the After Effects application.
Parameters
None.
Returns
Nothing.
Application registeredCompany attribute
app. regi steredCompany
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
var company = app. regi steredCompany;
al er t (Your company name i s + company + .);
Application registeredName attribute
app. regi steredName
Description
The user name, if any, that the user of the application entered for the registered name at the time of instal-
lation.
Type
String; read-only.
Example
var userName = app. regi st eredName;
conf i rm(Are you + userName + ?);
Application saveProjectOnCrash attribute
app. saveProj ect OnCrash
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.
29
After Effects Scripting Guide JavaScript Reference
29
Type
Boolean; read/write.
Application scheduleTask() method
app. schedul eTask(s t r i ngToExecut e, del ay, repeat )
Description
Schedules the specified JavaScript for delayed execution.
Parameters
Returns
Integer, a unique identifier for this task, which can be used to cancel it with app. cancel Task().
Application serialNumber attribute
app. ser i al Number
Description
The alphanumeric string that is the serial number of the installed version of After Effects.
Type
String; read-only.
Example
var seri al = app. ser i al Number ;
al er t ("Thi s copy i s seri al number " + ser i al );
Application setMemoryUsageLimits() method
app. set Memor yUsageLi mi t s(i mageCachePercent age, maxi mumMemor yPercent 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
st r i ngToExecut e A string containing JavaScript to be executed.
del ay A number of milliseconds to wait before executing the JavaScript. A floating-point value.
repeat When true, execute the script repeatedly, with the specified delay between each execution. When false
the script is executed only once.
i mageCachePercent age Floating-point value, the percentage of memory assigned to image cache.
maxi mumMemor yPercent age Floating-point value, the maximum usable percentage of memory.
30
After Effects Scripting Guide JavaScript Reference
30
Returns
Nothing.
Application setSavePreferencesOnQuit() method
app. set SavePref erencesOnQui t (doSave)
Description
Set or clears the flag that determines whether preferences are saved when the application is closed.
Parameters
Returns
Nothing.
Application settings attribute
app. set t i ngs
Description
The currently loaded settings. See RQItemCollection object on page 156.
Type
Settings object; read-only.
Application version attribute
app. versi on
Description
An alphanumeric string indicating which version of After Effects is running.
Type
String; read-only.
Example
var ver = app. versi on;
al er t ("Thi s machi ne i s runni ng versi on " + ver + " of Af ter Ef f ect s. ");
Application watchFolder() method
app. watchFol der(f ol der_obj ect _t o_wat ch)
Description
Starts a Watch Folder (network rendering) process pointed at a specified folder.
doSave When true, preferences saved on quit, when false they are not.
31
After Effects Scripting Guide JavaScript Reference
31
Parameters
Returns
Nothing.
Example
var t heFol der = new Fol der(c: / tool );
app. watchFol der(t heFol der);
See also
Application endWatchFolder() method on page 23
Application pauseWatchFolder() method on page 27
Application isWatchFolder attribute on page 25
f ol der_obj ect _to_watch The ExtendScript Folder object for the folder to watch.
32
After Effects Scripting Guide JavaScript Reference
32
AVItem object
app. proj ect . i tem(i ndex)
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
Methods
Attribute Reference Description
name AVItem name attribute on page 35 The name of the object as shown in the Project panel.
wi dt h AVItem width attribute on page 38 The width of the item.
hei ght AVItem height attribute on page 34 The height of the item.
pi xel Aspect AVItem pixelAspect attribute on page 35 The pixel aspect ratio of the item.
f rameRate AVItem frameRate attribute on page 34 The frame rate of the item.
f rameDurat i on AVItem frameDuration attribute on page 33 The frame duration for the item.
durat i on AVItem duration attribute on page 33 The total duration of the item.
useProxy AVItem useProxy attribute on page 38 When true, a proxy source is used for this item.
proxySource AVItem proxySource attribute on page 35 The FootageItem object used as proxy for the item.
t i me AVItem time attribute on page 38 Current time of the item.
usedIn AVItem usedIn attribute on page 38 The CompItem objects that use this item.
hasVi deo AVItem hasVideo attribute on page 34 When true, the item has a video component.
hasAudi o AVItem hasAudio attribute on page 34 When true, the item has an audio component.
f oot ageMi ssi ng AVItem footageMissing attribute on
page 33
When true, the item cannot be found or is a placeholder.
Method Reference Description
set Proxy() AVItem setProxy() method on page 36 Sets a proxy for the item.
set ProxyWi t hSequence() AVItem setProxyWithSequence() method on
page 37
Sets a sequence as a proxy for theitem.
set ProxyWi t hSol i d() AVItem setProxyWithSolid() method on
page 37
Sets a solid as a proxy for the item.
set ProxyWi t hPl acehol der() AVItem setProxyWithPlaceholder() method on
page 36
Sets a placeholder as a proxy for the item.
set ProxyToNone() AVItem setProxyToNone() method on page 36 Removes the proxy for the item.
33
After Effects Scripting Guide JavaScript Reference
33
AVItem duration attribute
app. proj ect . i tem(i ndex). durat i on
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 durat i on of the composition, and is read/write.
In a FootageItem, the value is linked to the dur at i on of the mai nSource object, and is read-only.
Type
Floating-point value in the range [0.0..10800.0]; read/write for a CompItem; otherwise, read-only.
AVItem footageMissing attribute
app. proj ect . i tem(i ndex). f oot ageMi ssi ng
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 mi ssi ngFoot agePat 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
app. proj ect . i tem(i ndex). f rameDur at i on
Description
Returns the length of a frame for this AVItem, in seconds. This is the reciprocal of f rameRate. When set, the
reciprocal is automatically set as a new f rameRate value.
This attribute returns the reciprocal of the f rameRate, 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 mai nSource, and is read-only. To change it, set the
conf or mFrameRate of the mai nSource object. This sets both the f rameRate and f rameDur at i on of the
FootageItem.
Type
Floating-point value in the range [1/99 .. 1.0 ]; read-only for a FootageItem, otherwise read/write.
34
After Effects Scripting Guide JavaScript Reference
34
AVItem frameRate attribute
app. proj ect . i tem(i ndex). f rameRate
Description
The frame rate of the AVItem, in frames-per-second. This is the reciprocal of the f rameDurat i on. When set,
the reciprocal is automatically set as a new f rameDurat i on value.
In a CompItem, the value is linked to the f rameRate of the composition, and is read/write.
In a FootageItem, the value is linked to the f rameRate of the mai nSource object, and is read-only. To change
it, set the conf ormFr ameRat e of the mai nSource object. This sets both the f r ameRat e and f r ameDurat i 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
app. proj ect . i tem(i ndex). hasAudi 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 mai nSource object.
Type
Boolean; read-only.
AVItem hasVideo attribute
app. proj ect . i tem(i ndex). hasVi deo
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 mai nSource object.
Type
Boolean; read-only.
AVItem height attribute
app. proj ect . i tem(i ndex). hei ght
Description
The height of the item in pixels.
In a CompItem, the value is linked to the composition, and is read/write.
35
After Effects Scripting Guide JavaScript Reference
35
In a FootageItem, the value is linked to the mai nSource object, and is read/write only if the mai nSource
object is a SolidSource. Otherwise, it is read-only.
Type
Integer in the range [1...30000]; read/write, except as noted.
AVItem name attribute
app. proj ect . i tem(i ndex). name
Description
The name of the item, as shown in the Project panel.
In a FootageItem, the value is linked to the mai nSource object. If the mai nSource object is a FileSource, this
value controls the display name in the Project panel, but does not affect the file name.
Type
String; read/write.
AVItem pixelAspect attribute
app. proj ect . i tem(i ndex). pi xel Aspect
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 mai nSource object.
Certain pi xel Aspect 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. 07, 1. 42, 2, 0. 95, 1. 9 }. Other values may show slight rounding
errors when you set or get them; that is, the value you retrieve after setting may be slightly different from the
value you supplied.
Type
Floating-point value, in the range [0.01..100.0]; read/write.
AVItem proxySource attribute
app. proj ect . i tem(i ndex). proxySource
Description
The FootageSource being used as a proxy. The attribute is read-only; to change it, call any of the AVItem
methods that change the proxy source: set Proxy(), set ProxyWi t hSequence(), set ProxyWi t hSol i d(), or
set ProxyWi t hPl acehol der().
Type
FootageSource object; read-only.
36
After Effects Scripting Guide JavaScript Reference
36
AVItem setProxy() method
app. proj ect . i tem(i ndex). set Proxy(f i l e)
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 proxySource attribute, and sets useProxy 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
Returns
None.
AVItem setProxyToNone() method
app. proj ect . i tem(i ndex). set ProxyToNone()
Description
Removes the proxy from this AVItem, sets the value of proxySource to null, and sets the value of useProxy to
f al se.
Parameters
None.
Returns
Nothing.
AVItem setProxyWithPlaceholder() method
app. proj ect . i tem(i ndex). set ProxyWi t hPl acehol der(name, wi dt h, he i ght , f rameRat e, durat i on)
Description
Creates a PlaceholderSource object with specified values, sets this as the value of the proxySource attribute,
and sets useProxy to true. It does not preserve the interpretation parameters, instead using the user prefer-
ences.
NOTE: There is no direct way to set a placeholder as a proxy in the user interface; this behavior occurs when a proxy
has been set and then moved or deleted.
Parameters
f i l e An ExtendScript File object for the file to be used as a proxy.
name A string containing the name of the new object.
wi dt h, hei ght The pixel dimensions of the placeholder, an integer in the range [4..30000].
f rameRate The frames-per-second, an integer in the range [1..99].
37
After Effects Scripting Guide JavaScript Reference
37
Returns
Nothing.
AVItem setProxyWithSequence() method
app. proj ect . i tem(i ndex). set ProxyWi t hSequence(f i l e, f orceAl phabet i cal )
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 proxySource attribute, and sets
useProxy to true. It does not preserve the interpretation parameters, instead using the user preferences. If any
file has an unlabeled alpha channel, and the user preference says to ask the user what to do, the method
estimates the alpha interpretation, rather than asking the user.
Parameters
Returns
Nothing.
AVItem setProxyWithSolid() method
app. proj ect . i tem(i ndex). set ProxyWi t hSol i d(col or, name, wi dt h, hei ght , pi xel As pect )
Description
Creates a SolidSource object with specified values, sets this as the value of the proxySource attribute, and sets
useProxy to true. It does not preserve the interpretation parameters, instead using the user preferences.
NOTE: There is no way, using the user interface, to set a solid as a proxy; this feature is available only through
scripting.
Parameters
Returns
Nothing.
durat i on The total length in seconds, up to 3 hours. An integer in the range [0.0..10800.0].
f i l e An ExtendScript File object for the first file in the sequence.
f orceAl phabet i cal When true, use the Force alphabetical order option.
col or 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.
wi dt h, hei ght The pixel dimensions of the placeholder, an integer in the range [1...30000].
pi xel Aspect The pixel aspect of the solid, a floating-point value in the range [0.01... 100.0].
38
After Effects Scripting Guide JavaScript Reference
38
AVItem time attribute
app. proj ect . i tem(i ndex). t i me
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 meToCur rent Format 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 mai nSource is still (i t em.mai nSource. i sSt i l l is true).
Type
Floating-point value; read/write.
AVItem usedIn attribute
app. proj ect . i tem(i ndex). usedIn
Description
All the compositions that use this AVItem.
Note: Upon retrieval, the array value is copied, so it is not automatically updated. If you get this value, then add
this item into another composition, you must retrieve the value again to get an array that includes the new item.
Type
Array of CompItem objects; read-only.
AVItem useProxy attribute
app. proj ect . i tem(i ndex). useProxy
Description
When true, a proxy is used for the item. It is set to true by all the Set Proxy methods, and to false by the
Set ProxyToNone() method.
Type
Boolean; read/write.
AVItem width attribute
app. proj ect . i tem(i ndex). wi dt h
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 mai nSource object, and is read/write only if the mai nSource
object is a SolidSource. Otherwise, it is read-only.
Type
Integer in the range [1...30000]; read/write, except as noted.
39
After Effects Scripting Guide JavaScript Reference
39
AVLayer object
app. proj ect . l ayer(i ndex)
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:
Marker
Ti me Remap
Mot i on Tr ackers
Masks
Ef f ect s
Transf orm
Anchor Poi nt
Posi t i on
Scal e
Ori ent at i on
X Rot at i on
Y Rot at i on
Rot at i on
Opaci t y
Mater i al Opt i ons
Cast s Shadows
Li ght Transmi ssi on
Accept s Shadows
Accept s Li ght s
Ambi ent
Di f f use
Specul ar
Shi ni ness
Met al
Audi o
Audi o Level 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 qual i t y, st ar t Ti me, and i nPoi nt .
var f i rst Layer = app. proj ect . i tem(1). l ayer(1);
f i rst Layer. qual i t y = LayerQual i t y. BEST;
f i rst Layer. st ar t Ti me = 1;
f i rst Layer. i nPoi nt = 2;
40
After Effects Scripting Guide JavaScript Reference
40
Attributes
Attribute Reference Description
source AVLayer source attribute on page 46 The source item for this layer.
i sNameFromSource AVLayer isNameFromSource attribute
on page 45
When true, the layer has no expressly set name,
but contains a named source.
hei ght AVLayer height attribute on page 44 The height of the layer.
wi dt h AVLayer width attribute on page 47 The width of the layer.
audi oEnabl ed AVLayer audioEnabled attribute on
page 42
When true, the layer's audio is enabled.
mot i onBl ur AVLayer motionBlur attribute on
page 45
When true, the layer's motion blur is enabled.
ef f ect sAct i ve AVLayer effectsActive attribute on
page 43
When true, the layer's effects are active.
adj ust ment Layer AVLayer adjustmentLayer attribute on
page 41
When true, this is an adjustment layer.
gui deLayer AVLayer guideLayer attribute on
page 44
When true, this is a guide layer.
t hreeDLayer AVLayer threeDLayer attribute on
page 46
When true, this is a 3D layer.
canSet Col l apseTr ansf ormat i on AVLayer canSetCollapseTransformation
attribute on page 43
When true, it is legal to change the value of
col l apseTransf or mat i on.
col l apseTransf ormat i on AVLayer collapseTransformation
attribute on page 43
When true, collapse transformation is on.
f rameBl endi ng AVLayer frameBlending attribute on
page 44
When true, frame blending is enabled.
canSet Ti meRemapEnabl ed AVLayer canSetTimeRemapEnabled
attribute on page 43
When true, it is legal to change the value of
t i meRemapEnabl ed.
t i meRemapEnabl ed AVLayer timeRemapEnabled attribute
on page 46
When true, time remapping is enabled on this
layer.
hasAudi o AVLayer hasAudio attribute on
page 44
When true, the layer contains an audio compo-
nent.
audi oAct i ve AVLayer audioActive attribute on
page 41
When true, the layer's audio is active at the cur-
rent time.
bl endi ngMode AVLayer blendingMode attribute on
page 42
The blending mode of the layer.
preser veTransparency AVLayer preserveTransparency
attribute on page 45
When true, preserve transparency is enabled.
t r ackMat teType AVLayer trackMatteType attribute on
page 46
if layer has a track matte, specifies the way it is
applied.
i sTrackMat te AVLayer isTrackMatte attribute on
page 45
When true, this layer is being used as a track
matte for the layer below it.
hasTrackMat te AVLayer hasTrackMatte attribute on
page 44
When true, the layer above is being used as a
track matte on this layer.
qual i t y AVLayer quality attribute on page 45 The layer quality setting.
41
After Effects Scripting Guide JavaScript Reference
41
Method
AVLayer adjustmentLayer attribute
app. proj ect . i tem(i ndex). adj ust ment Layer
Description
True if the layer is an adjustment layer.
Type
Boolean; read/write.
AVLayer audioActive attribute
app. proj ect . i tem(i ndex). audi oAct i ve
Description
True if the layer's audio is active at the current time.
For this value to be true, audi oEnabl 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 nPoi nt and out Poi nt of this layer.
Type
Boolean; read-only.
AVLayer audioActiveAtTime() method
app. proj ect . i tem(i ndex). audi oAct i veAt Ti me(t i me)
Description
Returns true if this layer's audio will be active at the specified time.
For this method to return true, audi oEnabl 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 nPoi nt and out Poi nt of this layer.
Parameters
Returns
Boolean.
Method Reference Description
audi oAct i veAt Ti me() AVLayer audioActiveAtTime() method
on page 41
Reports whether this layer's audio is active at a given time.
t i me The time, in seconds. A floating-point value.
42
After Effects Scripting Guide JavaScript Reference
42
AVLayer audioEnabled attribute
app. proj ect . i tem(i ndex). audi oEnabl ed
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
app. proj ect . i tem(i ndex). bl endi ngMode.
Description
The blending mode of the layer.
Type
A Bl endi ngMode enumerated value; read/write. One of:
Bl endi ngMode. ADD
Bl endi ngMode. ALPHA_ADD
Bl endi ngMode. CLASSI C_COLOR_BURN
Bl endi ngMode. CLASSI C_COLOR_DODGE
Bl endi ngMode. CLASSI C_DI FFERENCE
Bl endi ngMode. COLOR
Bl endi ngMode. COLOR_BURN
Bl endi ngMode. COLOR_DODGE
Bl endi ngMode. DANCI NG_DI SSOLVE
Bl endi ngMode. DARKEN
Bl endi ngMode. DI FFERENCE
Bl endi ngMode. DI SSOLVE
Bl endi ngMode. EXCLUSI ON
Bl endi ngMode. HARD_LI GHT
Bl endi ngMode. HARD_MI X
Bl endi ngMode. HUE
Bl endi ngMode. LI GHTEN
Bl endi ngMode. LI NEAR_BURN
Bl endi ngMode. LI NEAR_DODGE
Bl endi ngMode. LI NEAR_LI GHT
Bl endi ngMode. LUMI NESCENT_PREMUL
Bl endi ngMode. LUMI NOSI TY
Bl endi ngMode. MULTI PLY
Bl endi ngMode. NORMAL
43
After Effects Scripting Guide JavaScript Reference
43
Bl endi ngMode. OVERLAY
Bl endi ngMode. PI N_LI GHT
Bl endi ngMode. SATURATI ON
Bl endi ngMode. SCREEN
Bl endi ngMode. SI LHOUETE_ALPHA
Bl endi ngMode. SI LHOUETTE_LUMA
Bl endi ngMode. SOFT_LI GHT
Bl endi ngMode. STENCI L_ALPHA
Bl endi ngMode. STENCI L_LUMA
Bl endi ngMode. VIVID_LIGHT
AVLayer canSetCollapseTransformation attribute
app. proj ect . i tem(i ndex). canSet Col l apseTr ansf ormat i on
Description
True if it is legal to change the value of the col l apseTransf ormat i on attribute on this layer.
Type
Boolean; read-only.
AVLayer canSetTimeRemapEnabled attribute
app. proj ect . i tem(i ndex). canSet Ti meRemapEnabl ed
Description
True if it is legal to change the value of the t i meRemapEnabl ed attribute on this layer.
Type
Boolean; read-only.
AVLayer collapseTransformation attribute
app. proj ect . i tem(i ndex). col l apseTransf ormat i on
Description
True if collapse transformation is on for this layer.
Type
Boolean; read/write.
AVLayer effectsActive attribute
app. proj ect . i tem(i ndex). ef f ect sAct i ve
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.
44
After Effects Scripting Guide JavaScript Reference
44
AVLayer frameBlending attribute
app. proj ect . i tem(i ndex). f rameBl endi ng
Description
True if frame blending is enabled for the layer.
Type
Boolean; read/write.
AVLayer guideLayer attribute
app. proj ect . i tem(i ndex). gui deLayer
Description
True if the layer is a guide layer.
Type
Boolean; read/write.
AVLayer hasAudio attribute
app. proj ect . i tem(i ndex). hasAudi 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
app. proj ect . i tem(i ndex). hasTrackMat t e
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 rack-
Mat t eType value controls how the matte is applied.
Type
Boolean; read-only.
AVLayer height attribute
app. proj ect . i tem(i ndex). hei ght
Description
The height of the layer in pixels.
Type
Floating-point; read-only.
45
After Effects Scripting Guide JavaScript Reference
45
AVLayer isNameFromSource attribute
app. proj ect . i tem(i ndex). i sNameFromSource
Description
True if the layer has no expressly set name, but contains a named source. In this case, l ayer. name has the same
value as l ayer. source. name.
False if the layer has an expressly set name, or if the layer does not have a source.
Type
Boolean; read-only.
AVLayer isTrackMatte attribute
app. proj ect . i tem(i ndex). i sTrackMat te
Description
True if this layer is being used as a track matte for the layer behind it.
Type
Boolean; read-only.
AVLayer motionBlur attribute
app. proj ect . i tem(i ndex). mot i onBl ur
Description
True if motion blur is enabled for the layer.
Type
Boolean; read/write.
AVLayer preserveTransparency attribute
app. proj ect . i tem(i ndex). preser veTransparency
Description
True if preserve transparency is enabled for the layer.
Type
Boolean; read/write.
AVLayer quality attribute
app. proj ect . i tem(i ndex). qual i t y
Description
The quality with which this layer is displayed.
46
After Effects Scripting Guide JavaScript Reference
46
Type
A LayerQual i t y enumerated value; read/write. One of:
LayerQual i t y. BEST
LayerQual i t y. DRAFT
LayerQual i t y. WIREFRAME
AVLayer source attribute
app. proj ect . i tem(i ndex). source
Description
The source AVItem for this layer. The value is null in a Text layer.
Type
AVItem object; read-only.
AVLayer threeDLayer attribute
app. proj ect . i tem(i ndex). t hreeDLayer
Description
True if this is a 3D layer.
Type
Boolean; read/write.
AVLayer timeRemapEnabled attribute
app. proj ect . i tem(i ndex). t i meRemapEnabl ed
Description
True if time remapping is enabled for this layer.
Type
Boolean; read/write.
AVLayer trackMatteType attribute
app. proj ect . i tem(i ndex). t rackMat teType
Description
If this layer has a track matte, specifies the way the track matte is applied.
47
After Effects Scripting Guide JavaScript Reference
47
Type
A TrackMat teType enumerated value; read/write. One of:
TrackMat teType. ALPHA
TrackMat teType. ALPHA_INVERTED
TrackMat teType. LUMA
TrackMat teType. LUMA_INVERTED
TrackMat teType. NO_TRACK_MATTE
AVLayer width attribute
app. proj ect . i tem(i ndex). wi dt h
Description
The width of the layer in pixels.
Type
Floating-point; read-only.
48
After Effects Scripting Guide JavaScript Reference
48
CameraLayer object
app. proj ect . i tem(i ndex). l ayer(i ndex)
Description
The CameraLayer object represents a camera layers within a composition. Create it using the LayerCollection
objects addCamer 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:
Marker
Transf orm
Poi nt of Interest
Posi t i on
Scal e
Ori ent at i on
X Rot at i on
Y Rot at i on
Rot at i on
Opaci t y
Camera Opt i ons
Zoom
Dept h of Fi el d
Focus Di st ance
Bl ur Level
49
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
Attributes
Methods
Object Reference Description
ItemCol l ect i on ItemCollection object on page 77 All of the items (imported files, folders, solids, and so on) found in
the Project panel.
LayerCol l ect i on LayerCollection object on
page 90
All of the layers in a composition.
OMCol l ect i on OMCollection object on page 99 All of the Output Module items in the project.
RQIt emCol l ect i on RenderQueueItem object on
page 150
All of the render-queue items in the project.
l engt h The number of objects in the collection.
[] Retrieves an object in the collection by its index number. The first object is at index 1.
50
After Effects Scripting Guide JavaScript Reference
50
CompItem object
app. proj ect . i tem(i ndex)
app. proj ect . i tems[i ndex]
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 tem 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.
var f i rst Comp = app. proj ect . i tem(1);
al er t ( "number of l ayers i s " + f i rst Comp. numLayers );
al er t ( "name of l ast l ayer i s " + f i rst Comp. l ayer(f i rst Comp. numLayers). name );
Attributes
Attribute Reference Description
f rameDurat i on CompItem frameDuration attribute on
page 53
The duration of a single frame.
workAreaSt ar t CompItem workAreaStart attribute on
page 57
The work area start time.
workAreaDurat i on CompItem workAreaDuration
attribute on page 56
The work area duration.
numLayers CompItem numLayers attribute on
page 54
The number of layers in the composition.
hi deShyLayers CompItem hideShyLayers attribute on
page 53
When true, shy layers are visible in the Timeline panel.
mot i onBl ur CompItem motionBlur attribute on
page 54
When true, motion blur is enabled for this composi-
tion.
draf t 3d CompItem draft3d attribute on
page 52
When true, Draft 3D mode is enabled for the Compo-
sition panel.
f rameBl endi ng CompItem frameBlending attribute on
page 52
When true, time filtering is enabled for this composi-
tion.
preser veNestedFrameRate CompItem preserveNestedFrameRate
attribute on page 54
When true, the frame rate of nested compositions is
preserved.
preser veNestedResol ut i on CompItem preserveNestedResolution
attribute on page 55
When true, the resolution of nested compositions is
preserved.
bgCol or CompItem bgColor attribute on
page 51
The background color of the composition.
act i veCamera CompItem activeCamera attribute on
page 51
The current active camera layer.
di spl aySt ar t Ti me CompItem displayStartTime attribute
on page 52
Changes the display of the start time in the Timeline
panel.
51
After Effects Scripting Guide JavaScript Reference
51
Methods
CompItem activeCamera attribute
app. proj ect . i tem(i ndex). act i veCamer 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
app. proj ect . i tem(i ndex). bgCol 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.
resol ut i onFactor CompItem resolutionFactor attribute
on page 55
The factor by which the x and y resolution of the Com-
position panel is downsampled.
shut terAngl e CompItem shutterAngle attribute on
page 56
The camera shutter angle.
shut terPhase CompItem shutterPhase attribute on
page 56
The camera shutter phase.
l ayers CompItem layers attribute on page 54
LayerCollection object on page 90
The layers of the composition.
sel ect edLayers CompItem selectedLayers attribute on
page 56
The selected layers of the composition.
sel ect edProper t i es 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.
Method Reference Description
dupl i cat e() 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.
Attribute Reference Description
52
After Effects Scripting Guide JavaScript Reference
52
CompItem displayStartTime attribute
app. proj ect . i tem(i ndex). di spl aySt ar t Ti me
Description
The time set as the beginning of the composition, in seconds. This is the equivalent of the Start Timecode or
Start Frame setting in the Composition Settings dialog box.
Type
Floating-point value in the range [0.0...86339.0] (1 second less than 25 hours); read/write.
CompItem draft3d attribute
app. proj ect . i tem(i ndex). draf t 3d
Description
When true, Draft 3D mode is enabled for the Composition panel. This corresponds to the value of the Draft
3D button in the Composition panel.
Type
Boolean; read/write.
CompItem duplicate() method
app. proj ect . i tem(i ndex). dupl i cate()
Description
Creates and returns a duplicate of this composition, which contains the same layers as the original.
Parameters
None.
Returns
CompItem object.
CompItem frameBlending attribute
app. proj ect . i tem(i ndex). f rameBl endi ng
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.
53
After Effects Scripting Guide JavaScript Reference
53
CompItem frameDuration attribute
app. proj ect . i tem(i ndex). f rameDur at i on
Description
The duration of a frame, in seconds. This is the inverse of the f rameRate value (frames-per-second).
Type
Floating-point; read/write.
CompItem hideShyLayers attribute
app. proj ect . i tem(i ndex). hi deShyLayers
Description
When true, only layers with shy set to false are shown in the Timeline panel. When false, all layers are visible,
including those whose 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
app. proj ect . i tem(i ndex). l ayer(i ndex)
app. proj ect . i tem(i ndex). l ayer(ot herLayer, rel Index)
app. proj ect . i tem(i ndex). l ayer(name)
Description
Returns a Layer object, which can be specified by name, an index position in this layer, or an index position
relative to another layer.
Parameters
or

or
i ndex The index number of the desired layer in this composition. An integer in the range [1...num-
Layers], where numLayers is the number of layers in the composition.
ot herLayer A Layer object in this composition. The rel Index value is added to the index value of this
layer to find the position of the desired layer.
rel Index The position of the desired layer, relative to ot herLayer. An integer in the range [1ot her-
Layer. i ndex. . . numLayersot herLayer. i ndex], where numLayers is the number of
layers in the composition.
This value is added to the ot herLayer value to derive the absolute index of the layer to
return.
name The string containing the name of the desired layer.
54
After Effects Scripting Guide JavaScript Reference
54
Returns
Layer object.
CompItem layers attribute
app. proj ect . i tem(i ndex). 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
app. proj ect . i tem(i ndex). mot i onBl ur
Description
When true, motion blur is enabled for the composition. Corresponds to the value of the Motion Blur button
in the Composition panel.
Type
Boolean; read/write.
CompItem numLayers attribute
app. proj ect . i tem(i ndex). numLayers
Description
The number of layers in the composition.
Type
Integer; read-only.
CompItem preserveNestedFrameRate attribute
app. proj ect . i tem(i ndex). preser veNestedFrameRate
Description
When true, the frame rate of nested compositions is preserved in the current composition. Corresponds to the
value of the Preserve frame rate when nested or in render queue option in the Advanced tab of the Compo-
sition Settings dialog box.
Type
Boolean; read/write.
55
After Effects Scripting Guide JavaScript Reference
55
CompItem preserveNestedResolution attribute
app. proj ect . i tem(i ndex). preser veNestedResol ut 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
app. proj ect . i tem(i ndex). 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 compIt em. renderers.
Type
String; read/write.
CompItem renderers attribute
app. proj ect . i tem(i ndex). 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
app. proj ect . i tem(i ndex). resol ut i onFactor
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.
56
After Effects Scripting Guide JavaScript Reference
56
CompItem selectedLayers attribute
app. proj ect . i tem(i ndex). sel ect edLayers
Description
All of the selected layers in this composition. This is a 0-based array (the first object is at index 0).
Type
Array of Layer objects; read-only.
CompItem selectedProperties attribute
app. proj ect . i tem(i ndex). sel ect edProper t i es
Description
All of the selected properties (Property and PropertyGroup objects) in this composition. The first property is
at index position 0.
Type
Array of Property and PropertyGroup objects; read-only.
CompItem shutterAngle attribute
app. proj ect . i tem(i ndex). shut terAngl 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
app. proj ect . i tem(i ndex). shut terPhase
Description
The shutter phase setting for the composition. This corresponds to the Shutter Phase setting in the Advanced
tab of the Composition Settings dialog box.
Type
Integer in the range [360...360]; read/write.
CompItem workAreaDuration attribute
app. proj ect . i tem(i ndex). workAreaDurat i on
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.
57
After Effects Scripting Guide JavaScript Reference
57
Type
Floating-point; read/write.
CompItem workAreaStart attribute
app. proj ect . i tem(i ndex). workAreaSt ar t
Description
The time when the Composition work area begins, in seconds.
Type
Floating-point; read/write.
58
After Effects Scripting Guide JavaScript Reference
58
FileSource object
app. proj ect . i tem(i ndex). mai nSource
app. proj ect . i tem(i ndex). proxySource
Description
The FileSource object describes footage that comes from a file.
FileSource is a subclass of FootageSource. All methods and attributes of FootageSource, in addition to those
listed below, are available when working with FileSource. See FootageSource object on page 65.
Attributes
Methods
FileSource file attribute
app. proj ect . i tem(i ndex). mai nSource. f i l e
app. proj ect . i tem(i ndex). proxySource. f i l e
Description
The ExtendScript File object for the file that defines this asset. To change the value:
If this FileSource is a proxySource of an AVItem, call set Proxy() or set ProxyWi t hSequence().
If this FileSource is a mai nSource of a FootageItem, call repl ace() or repl aceWi t hSequence().
Type
File object; read-only.
FileSource missingFootagePath attribute
app. proj ect . i tem(i ndex). mai nSource. f i l e. mi ssi ngFoot agePat h
app. proj ect . i tem(i ndex). proxySource. f i l e. mi ssi ngFoot agePat h
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.
Attribute Reference Description
f i l e FileSource file attribute on page 58 The file that defines this asset.
mi ssi ngFoot agePat h FileSource missingFootagePath attribute
on page 58
The file that contains footage missing from this asset.
Method Reference Description
rel oad() FileSource reload() method on page 59 Reloads the asset from the file, if it is a mai nSource of
a FootageItem.
59
After Effects Scripting Guide JavaScript Reference
59
FileSource reload() method
app. proj ect . i tem(i ndex). mai nSource. f i l e. mai nSource. rel oad()
Description
Reloads the asset from the file. This method can be called only on a mai nSource, not a proxySource.
Parameters
None.
Returns
Nothing.
60
After Effects Scripting Guide JavaScript Reference
60
FolderItem object
app. proj ect . Fol derItem
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.
var secondItem = app. proj ect . i t em(2);
i f ( ! (secondItem i nst anceof Fol derItem) ) {
al er t ( "probl em: second i tem i s not a f ol der");
} el se {
f or (i = 1; i <= secondIt em. numItems; i ++ ) {
al er t ( "i tem number " + i + " wi t hi n t he f ol der i s named "
+ secondIt em. i tem(i ). name);
}
}
Attributes
Methods
FolderItem item() method
app. proj ect . i tem(i ndex). i tem
Description
Returns the top-level item in this folder at the specified index position. Note that top-level here means top-
level within the folder, not necessarily within the project.
Parameters
Returns
Item object.
Attribute Reference Description
i tems FolderItem items attribute on page 61 The contents of this folder.
numIt ems FolderItem numItems attribute on page 61 The number of items contained in the folder.
Method Reference Description
i tem() FolderItem item() method on page 60 Gets an item from the folder.
i ndex An integer, the position index of the item to retrieve. The first item is at index 1.
61
After Effects Scripting Guide JavaScript Reference
61
FolderItem items attribute
app. proj ect . i tem(i ndex). i tems
Description
An ItemCollection object containing Item object that represent the top-level contents of this folder.
Unlike the ItemCollection in the Project object, this collection contains only the top-level items in the folder.
Top-level within the folder is not the same as top-level within the project. Only those items that are top-level
in the root folder are also top-level in the Project.
Type
ItemCollection object; read only.
FolderItem numItems attribute
app. proj ect . i tem(i ndex). numIt ems
Description
The number of items contained in the i tems collection (f ol derIt em. i t ems. l engt h).
If the folder contains another folder, only the FolderItem for that folder is counted, not any subitems
contained in it.
Type
Integer; read only.
62
After Effects Scripting Guide JavaScript Reference
62
FootageItem object
app. proj ect . i tem(i ndex)
app. proj ect . i tems[i ndex]
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 t em 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
Methods
FootageItem file attribute
app. proj ect . i tem(i ndex). f i l e
Description
The ExtendScript File object for the footage's source file.
If the FootageItem's mai nSource is a FileSource, this is the same as Foot ageIt em. mai nSource. f i l e. Otherwise
it is null.
Type
File object; read only.
Attribute Reference Description
f i l e FootageItem file attribute on page 62 The footage source file.
mai nSource FootageItem mainSource attribute on page 63 All settings related to the footage item.
Method Reference Description
repl ace() FootageItem replace() method on
page 63
Replaces a footage file with another footage file.
repl aceWi t hPl acehol der() FootageItem replaceWithPlaceholder()
method on page 63
Replaces a footage file with a placeholder object.
repl aceWi t hSequence() FootageItem replaceWithSequence()
method on page 64
Replaces a footage file with an image sequence.
repl aceWi t hSol i d() FootageItem replaceWithSolid()
method on page 64
Replaces a footage file with a solid.
63
After Effects Scripting Guide JavaScript Reference
63
FootageItem mainSource attribute
app. proj ect . i tem(i ndex). mai nSource
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 oot ageMi ssi ng value is true, the path to the missing footage file is in the
Fi l eSource. mi ssi ngFoot agePat h attribute. See AVItem footageMissing attribute on page 33 and FileSource
missingFootagePath attribute on page 58.
Type
FootageSource object; read-only.
FootageItem replace() method
app. proj ect . i tem(i ndex). repl ace(f i l e)
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 mai nSource to that object. In the new source object, it sets the
name, wi dt h, hei ght , f rameDurat i on, and durat i on attributes (see AVItem object on page 32) based on the
contents of the file.
The method preserves interpretation parameters from the previous mai nSource object. If the specified file has
an unlabeled alpha channeI, the method estimates the alpha interpretation.
Parameters
FootageItem replaceWithPlaceholder() method
app. proj ect . i tem(i ndex). repl aceWi t hPl acehol der(name, wi dt h, hei ght , f rameRat e, durat 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 mai nSource to that object.
Parameters
f i l e An ExtendScript File object for the file to be used as the footage main source.
name A string containing the name of the placeholder.
wi dt h The width of the placeholder in pixels, an integer in the range [4..30000].
hei ght The height of the placeholder in pixels, an integer in the range [4..30000].
64
After Effects Scripting Guide JavaScript Reference
64
FootageItem replaceWithSequence() method
app. proj ect . i tem(i ndex). repl aceWi t hSequence(f i l e, f orceAl phabet i cal )
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 mai nSource to that object. In the new source
object, it sets the name, wi dt h, hei ght , f r ameDurat i on, and durat i on attributes (see AVItem object on
page 32) based on the contents of the file.
The method preserves interpretation parameters from the previous mai nSource object. If the specified file has
an unlabeled alpha channeI, the method estimates the alpha interpretation.
Parameters
FootageItem replaceWithSolid() method
app. proj ect . i tem(i ndex). repl aceWi t hSol i d(col or, name, wi dt h, hei ght , pi xel As pect )
Description
Changes the source of this FootageItem to the specified solid. Creates a new SolidSource object, sets its values
from the parameters, and sets mai nSource to that object.
Parameters
f rameRate The frame rate of the placeholder, a floating-point value in the range [1.0..99.0]
durat i on The duration of the placeholder in seconds, a floating-point value in the range [0.0..10800.0].
f i l e An ExtendScript File object for the first file in the sequence to be used as the footage main source.
f orceAl phabet i cal When true, use the Force alphabetical order option.
col or 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.
wi dt h The width of the solid in pixels, an integer in the range [4..30000].
hei ght The height of the solid in pixels, an integer in the range [4..30000].
pi xel Aspect The pixel aspect ratio of the solid, a floating-point value in the range [0.01..100.0].
65
After Effects Scripting Guide JavaScript Reference
65
FootageSource object
app. proj ect . i tem(i ndex). mai nSource
app. proj ect . i tem(i ndex). proxySource
Description
The FootageSource object holds information describing the source of some footage. It is used as the
mai nSource of a FootageItem, or the proxySource 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
Methods
Attribute Reference Description
hasAl pha FootageSource hasAlpha attribute on
page 68
When true, a footage clip or proxy includes an
alpha channel.
al phaMode FootageSource alphaMode attribute
on page 66
The mode of an alpha channel.
premul Col or FootageSource premulColor attribute
on page 69
The color to be premultiplied.
i nver t Al pha FootageSource invertAlpha attribute
on page 68
When true, an alpha channel in a footage clip or
proxy should be inverted.
i sSt i l l FootageSource isStill attribute on
page 68
When true, footage is a still image.
f i el dSeparat i onType FootageSource fieldSeparationType
attribute on page 67
The field separation type.
hi ghQual i t yFi el dSeparat i on FootageSource highQualityFieldSepa-
ration attribute on page 68
How the fields are to be separated in non-still foot-
age.
removePul l down FootageSource removePulldown
attribute on page 69
The pulldown type for the footage.
l oop FootageSource loop attribute on
page 69
How many times an image sequence is set to loop.
nat i veFrameRate FootageSource nativeFrameRate
attribute on page 69
The native frame rate of the footage.
di spl ayFr ameRate FootageSource displayFrameRate
attribute on page 66
The effective frame rate as displayed and rendered
in compositions by After Effects.
conf or mFrameRate FootageSource conformFrameRate
attribute on page 66
The rate to which footage should conform.
Method Reference Description
guessAl phaMode() FootageSource guessAlphaMode()
method on page 67
Estimates the al phaMode setting.
guessPul l down() FootageSource guessPulldown()
method on page 67
Estimates the pul l downType setting.
66
After Effects Scripting Guide JavaScript Reference
66
FootageSource alphaMode attribute
app. proj ect . i tem(i ndex). mai nSource. al phaMode
app. proj ect . i tem(i ndex). proxySource. al phaMode
Description
The alphaMode attribute of footageSource defines how the alpha information in the footage is to be inter-
preted. If hasAlpha is false, this attribute has no relevant meaning.
Type
An Al phaMode enumerated value; (read/write). One of:
Al phaMode. IGNORE
Al phaMode. STRAI GHT
Al phaMode. PREMULTIPLIED
FootageSource conformFrameRate attribute
app. proj ect . i tem(i ndex). mai nSource. conf ormFrameRate
app. proj ect . i tem(i ndex). proxySource. conf ormFr ameRat e
Description
A frame rate to use instead of the nat i veFrameRate value. If set to 0, the nat i veFrameRate is used instead.
It is an error to set this value if Foot ageSource. i sSt i l l is true. It is an error to set this value to 0 if remove-
Pul l down is not set to Pul l downPhase. OFF. If this is 0 when you set removePul l down to a value other than
Pul l downPhase. OFF, then this is automatically set to the value of nat i veFrameRate.
Type
Floating-point value in the range [0.0 .. 99.0]; read/write.
FootageSource displayFrameRate attribute
app. proj ect . i tem(i ndex). mai nSource. di spl ayFrameRate
app. proj ect . i tem(i ndex). proxySource. di spl ayFrameRate
Description
The effective frame rate as displayed and rendered in compositions by After Effects.
If removePul l down is Pul l downPhase. OFF, then this is the same as the conf ormFrameRate (if non-zero) or
the nat i veFrameRate (if conf ormFrameRate is 0). If removePul l down is not Pul l downPhase. OFF, this is
conf or mFrameRate * 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.
67
After Effects Scripting Guide JavaScript Reference
67
FootageSource fieldSeparationType attribute
app. proj ect . i tem(i ndex). mai nSource. f i el dSeparat i onType
app. proj ect . i tem(i ndex). proxySource. f i el dSepar at i onType
Description
How the fields are to be separated in non-still footage.
It is an error to set this attribute if i sSt i l l is true. It is an error to set this value to Fi el dSeparat i onType. OFF if
removePul l down is not Pul l downPhase. OFF.
Type
A Fi el dSeparat i onType enumerated value; read/write. One of:
Fi el dSepar at i onType. NONE
Fi el dSepar at i onType. UPPER_FI ELD_FI RST
Fi el dSepar at i onType. LOWER_FIELD_FIRST
FootageSource guessAlphaMode() method
app. proj ect . i tem(i ndex). mai nSource. guessAl phaMode()
app. proj ect . i tem(i ndex). proxySource. guessAl phaMode()
Description
Sets al phaMode, premul Col or, and i nver t Al pha to the best estimates for this footage source. If hasAl pha is
false, no change is made.
Parameters
None.
Returns
Nothing.
FootageSource guessPulldown() method
app. proj ect . i tem(i ndex). mai nSource. guessPul l down(met hod)
app. proj ect . i tem(i ndex). proxySource. guessPul l down(met hod)
Description
Sets f i el dSepar at i onType and removePul l down to the best estimates for this footage source. If i sSt i l l is true,
no change is made.
Parameters
Returns
Nothing.
met hod The method to use for estimation. A Pul l downMet hod enumerated value, one of:
Pul l downMet hod. PULLDOWN_3_2
Pul l downMet hod. ADVANCE_24P
68
After Effects Scripting Guide JavaScript Reference
68
FootageSource hasAlpha attribute
app. proj ect . i tem(i ndex). mai nSource. hasAl pha
app. proj ect . i tem(i ndex). proxySource. hasAl pha
Description
When true, the footage has an alpha component. In this case, the attributes al phaMode, i nver t Al pha, and
premul Col or have valid values. When false, those attributes have no relevant meaning for the footage.
Type
Boolean; read-only.
FootageSource highQualityFieldSeparation attribute
app. proj ect . i tem(i ndex). mai nSource. hi ghQual i t yFi el dSeparat i on
app. proj ect . i tem(i ndex). proxySource. hi ghQual i t yFi el dSeparat 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 sSt i l l is true, or if f i el dSepar at i onType is Fi el dSeparat i onType. OFF.
Type
Boolean; read/write.
FootageSource invertAlpha attribute
app. proj ect . i tem(i ndex). mai nSource. i nver t Al pha
app. proj ect . i tem(i ndex). proxySource. i nver t Al pha
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 hasAl pha is false, or if al phaMode is Al phaMode. IGNORE,
this attribute is ignored.
Type
Boolean; read/write.
FootageSource isStill attribute
app. proj ect . i tem(i ndex). mai nSource. i sSt i l l
app. proj ect . i tem(i ndex). proxySource. i sSt i l 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.
69
After Effects Scripting Guide JavaScript Reference
69
FootageSource loop attribute
app. proj ect . i tem(i ndex). mai nSource. l oop
app. proj ect . i tem(i ndex). proxySource. l oop
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 sSt i l l is true.
Type
Integer in the range [1.. 9999]; default is 1; read/write.
FootageSource nativeFrameRate attribute
app. proj ect . i tem(i ndex). mai nSource. nat i veFr ameRat e
app. proj ect . i tem(i ndex). proxySource. nat i veFrameRate
Description
The native frame rate of the footage.
Type
Floating-point; read/write.
FootageSource premulColor attribute
app. proj ect . i tem(i ndex). mai nSource. premul Col or
app. proj ect . i tem(i ndex). proxySource. premul Col or
Description
The color to be premultiplied. This attribute is valid only if the al phaMode is al phaMode. PREMULTI PLI ED.
Type
Array of four floating-point values [R, G, B, A], in the range [0.0..1.0]; read/write.
FootageSource removePulldown attribute
app. proj ect . i tem(i ndex). mai nSource. removePul l down
app. proj ect . i tem(i ndex). proxySource. removePul l down
Description
How the pulldowns are to be removed when field separation is used.
It is an error to set this attribute if i sSt i l l is true. It is an error to attempt to set this to a value other than
Pul l downPhase. OFF in the case where f i el dSepar at i onType is Fi el dSeparat i onType. OFF.
Type
A Pul l downPhase enumerated value; read/write. One of:
Pul l downPhase. RemovePul l down. OFF
Pul l downPhase. RemovePul l down. WSSWW
Pul l downPhase. RemovePul l down. SSWWW
70
After Effects Scripting Guide JavaScript Reference
70
Pul l downPhase. RemovePul l down. SWWWS
Pul l downPhase. RemovePul l down. WWWSS
Pul l downPhase. RemovePul l down. WWSSW
Pul l downPhase. RemovePul l down. WSSWW_24P_ADVANCE
Pul l downPhase. RemovePul l down. SSWWW_24P_ADVANCE
Pul l downPhase. RemovePul l down. SWWWS_24P_ADVANCE
Pul l downPhase. RemovePul l down. WWWSS_24P_ADVANCE
Pul l downPhase. RemovePul l down. WWSSW_24P_ADVANCE
71
After Effects Scripting Guide JavaScript Reference
71
ImportOptions object
new Impor t Opt i ons();
new Impor t Opt i ons(f i l e);
Description
The ImportOptions object encapsulates the options used to import a file with the Proj ect . i mpor t Fi l 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 mpor t Fi l e method. For
example:
new Impor t Opt i ons(). f i l e = new Fi l e("myf i l e. psd");
Attributes
Methods
ImportOptions canImportAs() method
i mpor t Opt i ons . canImpor t As(t ype)
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 mpor t As attribute. See ImportOptions importAs attribute on
page 72.
Parameters
Attributes Reference Description
i mpor t As ImportOptions importAs attribute on
page 72
The type of file to be imported.
sequence ImportOptions sequence attribute on
page 73
When true, import a sequence of files, rather than an individ-
ual file.
f orceAl phabet i cal ImportOptions forceAlphabetical
attribute on page 72
When true, the Force alphabetical order option is set.
f i l e ImportOptions file attribute on
page 72
The file to import, or the first file of the sequence to import.
Method Reference Description
canImpor t As() ImportOptions canImportAs() method
on page 71
Restricts input to a particular file type.
t ype
The type of file that can be imported. An Impor t AsType enumerated value; one of:
Impor t AsType. COMP
Impor t AsType. FOOTAGE
Impor t AsType. COMP_CROPPED_LAYERS
Impor t AsType. PROJ ECT
72
After Effects Scripting Guide JavaScript Reference
72
Returns
Boolean.
Example
var i o = new Impor t Opt i ons( Fi l e(c: \ \ myFi l e. psd));
i f i o. canImpor t As( Impor t AsType. COMP );
i o. i mpor t As = Impor t AsType. COMP;
ImportOptions file attribute
i mpor t Opt 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
i mpor t Opt i ons . f orceAl phabet i cal
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
i mpor t Opt i ons . i mpor t As
Description
The type of object for which the imported file is to be the source. Before setting, use canImpor t As 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 Impor t AsType enumerated value; read/write. One of:
Impor t AsType. COMP_CROPPED_LAYERS
Impor t AsType. FOOTAGE
Impor t AsType. COMP
Impor t AsType. PROJ ECT
73
After Effects Scripting Guide JavaScript Reference
73
ImportOptions sequence attribute
i mpor t Opt i ons . sequence
Description
When true, a sequence is imported; otherwise, an individual file is imported.
Type
Boolean; read/write.
74
After Effects Scripting Guide JavaScript Reference
74
Item object
app. proj ect . i tem(i ndex)
app. proj ect . i tems[i ndex]
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
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.
var myFol der = app. proj ect . i tem(2);
i f (myFol der. t ypeName ! = "Fol der") {
al er t ("er ror : second i tem i s not a f ol der");
}
el se {
var numInFol der = myFol der. numItems;
/ / Al ways run l oops backwards when del et i ng t hi ngs:
f or(i = numInFol der ; i >= 1; i --) {
var curItem = myFol der. i t em(i );
i f ( curItem. parent Fol der ! = myFol der) {
al er t ("er ror wi t hi n AE: t he parent Fol der i s not set correct l y");
}
el se {
i f ( ! curIt em. sel ect ed && curItem. t ypeName == "Foot age") {
/ / Aha! an unsel ected sol i d.
curItem. remove();
Attributes Reference Description
name Item name attribute on page 75 The name of the object as shown in the Project panel.
comment Item comment attribute on page 75 A descriptive string.
i d Item id attribute on page 75 A unique identifier for this item.
parent Fol der Item parentFolder attribute on page 75 The parent folder of this item.
sel ect ed Item selected attribute on page 76 When true, this item is currently selected.
t ypeName Item typeName attribute on page 76 The type of item.
Method Reference Description
remove() Item remove() method on page 76 Deletes the item from the project.
75
After Effects Scripting Guide JavaScript Reference
75
}
}
}
}
Item comment attribute
app. proj ect . i tem(i ndex). comment
Description
A string that holds a comment, up to 15,999 bytes in length after any encoding conversion. The comment is
for the user's purpose only; it has no effect on the item's appearance or behavior.
Type
String; read/write.
Item id attribute
app. proj ect . i tem(i ndex). 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
app. proj ect . i tem(i ndex). name
Description
The name of the item as displayed in the Project panel.
Type
String; read/write.
Item parentFolder attribute
app. proj ect . i tem(i ndex). parent Fol der
Description
The FolderItem object for the folder that contains this item. If this item is at the top level of the project, this
is the project's root folder (app. proj ect . root Fol der). You can use the ItemCollections addFol der method to
add a new folder, and set this value to put items in the new folder. See ItemCollection addFolder() method
on page 77.
76
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.
/ / creat e a new Fol derItem i n proj ect , wi t h name comps
var compFol der = app. proj ect . i t ems. addFol der(comps);
/ / move al l composi t i ons i nt o new f ol der by set t i ng
/ / compIt ems parent Fol der to comps f ol der
f or(var i = 1; i <= app. proj ect . numItems; i ++) {
i f (app. proj ect . i tem(i ) i nst anceof CompItem)
app. proj ect . i tem(i ). parent Fol der = compFol der ;
}
Item remove() method
app. proj ect . i tem(i ndex). remove()
Description
Deletes this item from the project and from the Project panel. If the item is a FolderItem, all the items
contained in the folder are also removed from the project. No files or folders are removed from disk.
Parameters
None.
Returns
Nothing.
Item selected attribute
app. proj ect . i tem(i ndex). sel ect ed
Description
When true, this item is selected. Multiple items can be selected at the same time. Set to true to select the item
programmatically, or to false to deselect it.
Type
Boolean; read/write.
Item typeName attribute
app. proj ect . i tem(i ndex). t ypeName
Description
A user-readable name for the item type; for example, Folder, Footage, or Composition.
Type
String; read-only.
77
After Effects Scripting Guide JavaScript Reference
77
ItemCollection object
app. proj ect . i tems
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
ItemCollection addComp() method
app. proj ect . i temCol l ect i on. addComp(name, wi dt h, hei ght , pi xel As pect , durat i on, f rameRat e)
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 parent Fol der is the root
folder. If the ItemCollection belongs to any other folder, the new items parent Fol der is that Fol derIt em.
Parameters
Returns
CompItem object.
ItemCollection addFolder() method
app. proj ect . i temCol l ect i on. addFol der(name)
Description
Creates a new folder. Creates and returns a new FolderItem object and adds it to this collection.
Method Reference Description
addComp() ItemCollection addComp() method on
page 77
Creates a new CompItem object and adds it to the collection.
addFol der() ItemCollection addFolder() method on
page 77
Creates a new FolderItemobject and adds it to the collection.
name A string containing the name of the composition.
wi dt h The width of the composition in pixels, an integer in the range [4..30000].
hei ght The height of the composition in pixels, an integer in the range [4..30000].
pi xel Aspect The pixel aspect ratio of the composition, a floating-point value in the range [0.01..100.0].
durat i on The duration of the composition in seconds, a floating-point value in the range [0.0..10800.0].
f rameRate The frame rate of the composition, a floating-point value in the range [1.0..99.0]
78
After Effects Scripting Guide JavaScript Reference
78
If the ItemCollection belongs to the project or the root folder, then the new folders parent Fol der is the root
folder. If the ItemCollection belongs to any other folder, the new folders parent Fol der is that Fol derItem.
To put items in the folder, set the item objects parent Fol der attribute; see Item parentFolder attribute on
page 75.
Parameters
Returns
FolderItem object.
Example
This script creates a new FolderItem in the Project panel and moves compositions into it.
/ / creat e a new Fol derItem i n proj ect , wi t h name comps
var compFol der = app. proj ect . i t ems. addFol der(comps);
/ / move al l composi t i ons i nt o new f ol der by set t i ng
/ / compIt ems parent Fol der to comps f ol der
f or(var i = 1; i <= app. proj ect . numItems; i ++) {
i f (app. proj ect . i tem(i ) i nst anceof CompItem)
app. proj ect . i tem(i ). parent Fol der = compFol der ;
}
name A string containing the name of the folder.
79
After Effects Scripting Guide JavaScript Reference
79
KeyframeEase object
myKey = new Keyf rameEase(s peed, i nf l uence);
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 set Tempor al EaseAt Key method. See Property setTemporalEaseAtKey() method on
page 131.
The constructor creates a KeyframeEase object. Both parameters are required.
speed: A floating-point value. Sets the speed attribute.
i nf l uence: A floating-point value in the range [0.1..100.0]. Sets the i nf l uence attribute.
Example
This example assumes that the Position, a spatial property, has more than two keyframes.
var easeIn = new Keyf r ameEase(0. 5, 50);
var easeOut = new Keyf r ameEase(0. 75, 85);
var myPosi t i onProper t y = app. proj ect . i tem(1). l ayer(1). proper t y("Posi t i on")
myPosi t i onProper t y. set Temporal EaseAt Key(2, [easeIn], [easeOut ]);
This example sets the Scale, a temporal property with two dimensions. For 2D and 3D properties you must
set an easeIn and and easeOut value for each dimension:
var easeIn = new Keyf r ameEase(0. 5, 50);
var easeOut = new Keyf r ameEase(0. 75, 85);
var myScal eProper t y = app. proj ect . i tem(1). l ayer(1). proper t y("Scal e")
myScal eProper t y. set Temporal EaseAt Key(2, [easeIn, easeIn, easeIn], [easeOut , easeOut , easeOut ]);
Attributes
KeyframeEase influence attribute
myKe y. i nf l uence
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.
Attribute Reference Description
speed KeyframeEase speed attribute on page 80 The speed setting for a keyframe.
i nf l uence KeyframeEase influence attribute on page 79 The influence setting for a keyframe.
80
After Effects Scripting Guide JavaScript Reference
80
KeyframeEase speed attribute
myKe y. speed
Description
The speed value of the keyframe. The units depend on the type of keyframe, and are displayed in the Keyframe
Velocity dialog box.
Type
Floating-point value; read/write.
81
After Effects Scripting Guide JavaScript Reference
81
Layer object
app. proj ect . i tem(i ndex). l ayer(i ndex)
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.
var f i rst Layer = app. proj ect . i tem(1). l ayer(1);
f i rst Layer. enabl ed = f al se;
f i rst Layer. name = "Di sabl ed Layer";
Attributes
Attribute Reference Description
i ndex Layer index attribute on page 85 The index position of the layer.
name Layer name attribute on page 87 The name of the layer.
parent Layer parent attribute on page 87 The parent of this layer.
t i me Layer time attribute on page 89 The current time of the layer.
st ar t Ti me Layer startTime attribute on page 89 The start time of the layer.
st ret ch Layer stretch attribute on page 89 The time stretch percentage of the layer.
i nPoi nt Layer inPoint attribute on page 85 The in point of the layer.
out Poi nt Layer outPoint attribute on page 87 The out point of the layer.
enabl ed Layer enabled attribute on page 84 When true, the layer is enabled.
sol o Layer solo attribute on page 89 When true, the layer is soloed.
shy Layer shy attribute on page 88 When true, the layer is shy.
l ocked Layer locked attribute on page 85 When true, the layer is locked.
hasVi deo Layer hasVideo attribute on page 84 When true, the layer contains a video component.
act i ve Layer active attribute on page 82 When true, the layer is active at the current time.
nul l Layer Layer nullLayer attribute on page 87 When true, this is a null layer.
sel ect edProper t i es Layer selectedProperties attribute on page 88 All selected AE properties in the layer.
comment Layer comment attribute on page 83 A descriptive comment for the layer.
cont ai ni ngComp Layer containingComp attribute on page 83 The composition that contains this layer.
82
After Effects Scripting Guide JavaScript Reference
82
Methods
Layer active attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). act i ve
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 nPoi nt and out Poi nt values of this layer.
This value is never true in an audio layer; there is a separate audi oAct i ve attribute in the AVLayer object.
Type
Boolean; read-only.
Layer activeAtTime() method
app. proj ect . i tem(i ndex). l ayer(i ndex). act i veAt Ti me(t i me)
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 i nPoi nt and out Poi nt
values of this layer.
i sNameSet Layer isNameSet attribute on page 85 When true, the layers name has been explicitly set.
Method Reference Description
remove() Layer remove() method on page 88 Deletes the layer from the composition.
moveToBegi nni ng() Layer moveToBeginning() method on
page 86
Moves the layer to the top of the composition (makes it the
first layer).
moveToEnd() Layer moveToEnd() method on
page 86
Moves the layer to the bottom of the composition (makes it
the last layer).
moveAf t er() Layer moveAfter() method on page 85 Moves the layer below another layer.
moveBef ore() Layer moveBefore() method on
page 86
Moves the layer above another layer.
dupl i cat e() Layer duplicate() method on page 84 Duplicates the layer.
copyToComp() Layer copyToComp() method on
page 84
Copies the layer to the top (beginning) of another compo-
sition.
act i veAt Ti me() Layer activeAtTime() method on
page 82
Reportes whether this layer will be active at a specified
time.
set Parent Wi t hJump() Layer setParentWithJump() method
on page 88
Sets a new parent for this layer.
appl yPreset s() Layer applyPreset() method on
page 83
Applies a named collection of animation settings to the
layer.
Attribute Reference Description
83
After Effects Scripting Guide JavaScript Reference
83
Parameters
Returns
Boolean.
Layer applyPreset() method
appapp. proj ect . i t em(i ndex). l ayer(i ndex). appl yPreset (pres et Name);
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
Returns
Nothing.
Layer comment attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). comment
Description
A descriptive comment for the layer.
Type
String; read/write.
Layer containingComp attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). cont ai ni ngComp
Description
The composition that contains this layer.
Type
CompItem object; read-only.
t i me The time in seconds, a floating-point value.
preset Name An ExtendScript File object for the file containing the animation preset.
84
After Effects Scripting Guide JavaScript Reference
84
Layer copyToComp() method
app. proj ect . i tem(i ndex). l ayer(i ndex). copyToComp(i nt oComp)
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 ayers collection in the target
CompItem. Retrieve the copy using i nt oComp. l ayer(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
Returns
Nothing.
Layer duplicate() method
app. proj ect . i tem(i ndex). l ayer(i ndex). dupl i cate()
Description
Duplicates the layer. Creates a new Layer object in which all values are the same as in this one. This has the
same effect as selecting a layer in the user interface and choosing Edit > Duplicate, except the selection in the
user interface does not change when you call this method.
Parameters
None.
Returns
Layer object.
Layer enabled attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). enabl 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
app. proj ect . i tem(i ndex). l ayer(i ndex). hasVi deo
Description
When true, the layer has a video switch (the eyeball icon) in the Timeline panel; otherwise false.
i ntoComp The target composition, and CompItem object.
85
After Effects Scripting Guide JavaScript Reference
85
Type
Boolean; read-only.
Layer index attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). i ndex
Description
The index position of the layer.
Type
Integer in the range [1..numLayers]; read-only.
Layer inPoint attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). i nPoi nt
Description
The in point of the layer, expressed in composition time (seconds).
Type
Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.
Layer isNameSet attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). i sNameSet
Description
True if the value of the name attribute has been set explicitly, rather than automatically from the source.
Type
Boolean; read-only.
Layer locked attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). 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
app. proj ect . i tem(i ndex). l ayer(i ndex). moveAf ter(l ayer)
Description
Moves this layer to a position immediately after (below) the specified layer.
86
After Effects Scripting Guide JavaScript Reference
86
Parameters
Returns
Nothing.
Layer moveBefore() method
app. proj ect . i tem(i ndex). l ayer(i ndex). moveBef ore(l ayer)
Description
Moves this layer to a position immediately before (above) the specified layer.
Parameters
Returns
Nothing.
Layer moveToBeginning() method
app. proj ect . i tem(i ndex). l ayer(i ndex). moveToBegi nni ng()
Description
Moves this layer to the topmost position of the layer stack (the first layer).
Parameters
None.
Returns
Nothing.
Layer moveToEnd() method
app. proj ect . i tem(i ndex). l ayer(i ndex). moveToEnd()
Description
Moves this layer to the bottom position of the layer stack (the last layer).
Parameters
None.
Returns
Nothing.
l ayer The target layer, a layer object in the same composition.
l ayer The target layer, a layer object in the same composition.
87
After Effects Scripting Guide JavaScript Reference
87
Layer name attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). name
Description
The name of the layer. By default, this is the same as the Source name (which cannot be changed in the Layer
panel), but you can set it to be different.
Type
String; read/write.
Layer nullLayer attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). nul l Layer
Description
When true, the layer was created as a null object; otherwise false.
Type
Boolean; read-only.
Layer outPoint attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). out Poi nt
Description
The out point of the layer, expressed in composition time (seconds).
Type
Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.
Layer parent attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). parent
Description
The parent of this layer; can be null.
Offset values are calculated to counterbalance any transforms above this layer in the hierarchy, so that when
you set the parent there is no apparent jump in the layer's transform. For example, if the new parent has a
rotation of 30 degrees, the child layer is assigned a rotation of -30 degrees.
To set the parent without changing the child layer's transform values, use the set Parent Wi t hJump method.
Type
Layer object or null; read/write.
88
After Effects Scripting Guide JavaScript Reference
88
Layer remove() method
app. proj ect . i tem(i ndex). l ayer(i ndex). remove()
Description
Deletes the specified layer from the composition.
Parameters
None.
Returns
Nothing.
Layer selectedProperties attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). sel ectedProper t i es
Description
An array containing all of the currently selected Property and PropertyGroup objects in the layer.
Type
Array of PropertyBase objects; read-only.
Layer setParentWithJump() method
app. proj ect . i tem(i ndex). l ayer(i ndex). set Parent Wi t hJump(newParent )
Description
Sets the parent of this layer to the specified layer, without changing the transform values of the child layer.
There may be an apparent jump in the rotation, translation, or scale of the child layer, as this layers transform
values are combined with those of its ancestors.
If you do not want the child layer to jump, set the parent attribute directly. In this case, an offset is calculated
and set in the child layer's transform fields, to prevent the jump from occurring.
Parameters
Returns
Nothing.
Layer shy attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). 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.
newParent A layer object in the same composition.
89
After Effects Scripting Guide JavaScript Reference
89
Type
Boolean; read/write.
Layer solo attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). sol o
Description
When true, the layer is soloed, otherwise false.
Type
Boolean; read/write.
Layer startTime attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). st ar t Ti me
Description
The start time of the layer, expressed in composition time (seconds).
Type
Floating-point value in the range [-10800.0..10800.0] (minus or plus three hours); read/write.
Layer stretch attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). st retch
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
app. proj ect . i tem(i ndex). l ayer(i ndex). t i me
Description
The current time of the layer, expressed in composition time (seconds).
Type
Floating-point value; read-only.
90
After Effects Scripting Guide JavaScript Reference
90
LayerCollection object
app. proj ect . i tem(i ndex). 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.
var f i rst Comp = app. proj ect . i tem(1);
var l ayerCol l ect i on = f i rst Comp. l ayers;
al er t ( "number of l ayers bef ore i s " + l ayerCol l ect i on. l engt h);
var anAVItem = app. proj ect . i t em(2);
l ayerCol l ect i on. add(anAVItem);
al er t ( "number of l ayers af ter i s " + l ayerCol l ect i on. l engt h);
Methods
Method Reference Description
add() LayerCollection add() method on
page 91
Creates a new AVLayer and adds it to this collection.
addNul l () LayerCollection addNull() method on
page 92
Creates a new, null layer and adds it to this collection.
addSol i d() LayerCollection addSolid() method on
page 92
Creates a new layer, a FootageItem with a SolidSource, and adds it
to this collection.
addText () LayerCollection addText() method on
page 93
Creates a new text layer and adds it to this collection.
addCamer a() LayerCollection addCamera() method
on page 91
Creates a new camera layer and adds it to this collection.
addLi ght () LayerCollection addLight() method on
page 91
Creates a new light layer and adds it to this collection.
byName() LayerCollection byName() method on
page 93
Retrieves the layer object with a specified name.
precompose() LayerCollection precompose()
method on page 93
Collects specified layers into a new composition.
91
After Effects Scripting Guide JavaScript Reference
91
LayerCollection add() method
app. proj ect . i tem(i ndex). l ayers. add(i t em, durat i on)
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
Returns
AVLayer object.
LayerCollection addCamera() method
app. proj ect . i tem(i ndex). l ayers. addCamera(name, cent erPoi nt )
Description
Creates a new camera layer and adds the CameraLayer object to this collection.
Parameters
Returns
CameraLayer object.
LayerCollection addLight() method
app. proj ect . i tem(i ndex). l ayers. addLi ght (name, cent erPoi nt )
Description
Creates a new light layer and adds the LightLayer object to this collection.
Parameters
i tem The AVItem object for the item to be added.
durat 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 durat i on value of the new layer. Otherwise, the durat 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 spec-
ify options under Still Footage.
name A string containing the name of the new layer.
centerPoi nt 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.
name A string containing the name of the new layer.
centerPoi nt The center of the new light , a floating-point array [x, y].
92
After Effects Scripting Guide JavaScript Reference
92
Returns
LightLayer object.
LayerCollection addNull() method
app. proj ect . i tem(i ndex). l ayers. addNul l (durat i on)
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
Returns
AVLayer object.
LayerCollection addSolid() method
app. proj ect . i tem(i ndex). l ayers. addSol i d(col or, name, wi dt h, he i ght , pi xel As pect , durat i on)
Description
Creates a new SolidSource object, with values set as specified; sets the new SolidSource as the mai nSource
value of a new FootageItem object, and adds the FootageItem to the project. Creates a new AVLayer object,
sets the new FootageItem as its source, and adds the layer to this collection.
Parameters
Returns
AVLayer object.
durat i on Optional, the length of a still layer in seconds, a floating-point value.
If supplied, sets the durat i on value of the new layer. Otherwise, the durat 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.
col or 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.
wi dt h The width of the solid in pixels, an integer in the range [4..30000].
hei ght The height of the solid in pixels, an integer in the range [4..30000].
pi xel Aspect The pixel aspect ratio of the solid, a floating-point value in the range [0.01..100.0].
durat 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.
93
After Effects Scripting Guide JavaScript Reference
93
LayerCollection addText() method
app. proj ect . i tem(i ndex). l ayers. addText (s ourc eText )
Description
Creates a new text layer and adds the new TextLayer object to this collection.
Parameters
Returns
TextLayer object.
LayerCollection byName() method
app. proj ect . i tem(i ndex). l ayers. byName(name)
Description
Returns the first (topmost) layer found in this collection with the specified name, or null if no layer with the
given name is found.
Parameters
Returns
Layer object or null.
LayerCollection precompose() method
app. proj ect . i tem(i ndex). l ayers. precompose(l ayerIndi c i es , name, moveAl l At t r i but es )
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
Returns
CompItem object.
sourceText Optional; a string containing the source text of the new layer, or a TextDocument object contain-
ing the source text of the new layer. See TextDocument object on page 165.
name A string containing the name.
l ayerIndi ces The position indexes of the layers to be collected. An array of integers.
name The name of the new CompItem object.
moveAl l At t r i butes 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 ayerIndi ces array.
This is the same as selecting the Leave all attributes in option in the Pre-com-
pose dialog box.
94
After Effects Scripting Guide JavaScript Reference
94
LightLayer object
app. proj ect . i tem(i ndex). l ayer(i ndex)
Description
The LightLayer object represents a light layer within a composition. Create it using the LayerCollection
objects addLi ght 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:
Marker
Transf orm
Poi nt of Interest
Posi t i on
Scal e
Ori ent at i on
X Rot at i on
Y Rot at i on
Rot at i on
Opaci t y
Li ght Opt i ons
Intensi t y
Col or
Cone Angl e
Cone Feat her
Cast s Shadows
Shadow Darkness
Shadow Di f f usi on
95
After Effects Scripting Guide JavaScript Reference
95
MarkerValue object
new MarkerVal ue(comment , chapt er, url , f rameTarget )
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 comment 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 Marker AE property of the layer:
l ayerObj ect . proper t y("Marker"). set Val ueAt Ti me(t i me, mar kerVal ueObj ect );
For information on the usage of markers see Using markers in After Effects Help.
Attributes
Examples
To set a marker that says Fade Up at the 2 second mark:
var myMarker = new MarkerVal ue("Fade Up");
myLayer. proper t y("Marker"). set Val ueAt Ti me(2, myMarker);
To get a comment value from a particular marker:
var comment Of Fi rst Marker = app. proj ect . i t em(1). l ayer(1). proper t y("Marker"). keyVal ue(1). comment ;
var comment Of MarkerAt Ti me4 =
app. proj ect . i tem(1). l ayer(1). proper t y("Marker"). val ueAt Ti me(4. 0, TRUE) . comment
var markerProper t y = app. proj ect . i tem(1). l ayer(1). proper t y("Marker");
var markerVal ueAt Ti meCl osest ToTi me4 = markerProper t y
. keyVal ue(markerProper t y. nearest KeyIndex(4. 0));
var comment Of MarkerCl osest ToTi me4 = markerVal ueAt Ti meCl osest ToTi me4. comment ;
MarkerValue chapter attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t y("Marker"). chapter
Description
A text chapter link for this marker. Chapter links initiate a jump to a chapter in a QuickTime movie or in other
formats that support chapter marks.
Type
String; read/write.
Attribute Reference Description
comment MarkerValue comment attribute on
page 96
A comment on the associated layer.
chapt er MarkerValue chapter attribute on
page 95
A chapter link reference point for the associated layer.
url MarkerValue url attribute on page 96 A URL for Web page to be associated with the layer.
f rameTarget MarkerValue frameTarget attribute on
page 96
A specific frame target within the Web page specified by url .
96
After Effects Scripting Guide JavaScript Reference
96
MarkerValue comment attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t y("Marker"). comment
Description
A text comment for this marker. This comment appears in the Timeline panel next to the layer marker.
Type
String; read/write.
MarkerValue frameTarget attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t y("Marker"). f rameTarget
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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t y("Marker"). url
Description
A URL for this marker. This URL is an automatic link to a Web page.
Type
String; read/write.
97
After Effects Scripting Guide JavaScript Reference
97
MaskPropertyGroup object
app. proj ect . i tem(i ndex). l ayer(i ndex). mask
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
MaskPropertyGroup color attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). mask(i ndex). col or
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
app. proj ect . i tem(i ndex). l ayer(i ndex). mask(i ndex). i nver t ed
Description
When true, the mask is inverted; otherwise false.
Type
Boolean; read/write.
Attribute Reference Description
maskMode MaskPropertyGroup maskMode attribute
on page 98
The mask mode.
i nver t ed MaskPropertyGroup inverted attribute on
page 97
When true, the mask is inverted.
rotoBezi er MaskPropertyGroup rotoBezier attribute
on page 98
When true, the shape of the mask is RotoBezier.
maskMot i onBl ur MaskPropertyGroup maskMotionBlur
attribute on page 98
How motion blur is applied to this mask.
l ocked MaskPropertyGroup locked attribute on
page 98
When true, the mask is locked.
col or MaskPropertyGroup color attribute on
page 97
The color used to draw the mask outline in the user
interface.
98
After Effects Scripting Guide JavaScript Reference
98
MaskPropertyGroup locked attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). mask(i ndex). l ocked
Description
When true, the mask is locked and cannot be edited in the user interface; otherwise, false.
Type
Boolean; read/write.
MaskPropertyGroup maskMode attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). mask(i ndex). maskMode
Description
The masking mode for this mask.
Type
A MaskMode enumerated value; read/write. One of:
MaskMode. NONE
MaskMode. ADD
MaskMode. SUBTRACT
MaskMode. INTERSECT
MaskMode. LIGHTEN
MaskMode. DARKEN
MaskMode. DIFFERENCE
MaskPropertyGroup maskMotionBlur attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). mask(i ndex). maskMot i onBl ur
Description
How motion blur is applied to this mask.
Type
A MakMot i onBl ur enumerated value; read/write. One of:
MaskMot i onBl ur. SAME_AS_LAYER
MaskMot i onBl ur. ON
MaskMot i onBl ur. OFF
MaskPropertyGroup rotoBezier attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). mas k(i ndex). rotoBezi er
Description
When true, the mask is a RotoBezier shape; otherwise, false.
Type
Boolean; read/write.
99
After Effects Scripting Guide JavaScript Reference
99
OMCollection object
app. proj ect . renderQueue. i t ems. out put Modul es
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.
100
After Effects Scripting Guide JavaScript Reference
100
OutputModule object
app. proj ect . renderQueue. i t em(i ndex). out put Modul es(i ndex)
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
Methods
OutputModule applyTemplate() method
app. proj ect . renderQueue. i t em(i ndex). out put Modul es[i ndex]. appl yTempl at e(t empl at eName)
Description
Applies the specified existing output-module template.
Parameters
Returns
Nothing.
OutputModule file attribute
app. proj ect . renderQueue. i t em(i ndex). out put Modul es[i ndex]. f i l e
Description
The ExtendScript File object for the file this output module is set to render.
Attribute Reference Description
f i l e OutputModule file attribute on
page 100
The path and name of the file to be rendered.
post RenderAct i on 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.
templ ates OutputModule templates attribute on
page 102
All templates for the output module.
Method Reference Description
remove() OutputModule remove() method on
page 101
Removes this output module from the render-queue items list.
saveAsTempl at e() OutputModule saveAsTemplate()
method on page 101
Saves a new output-module template.
appl yTempl at e() OutputModule applyTemplate()
method on page 100
Applies an output-module template.
templ ateName A string containing the name of the template to be applied.
101
After Effects Scripting Guide JavaScript Reference
101
Type
ExtendScript File object; read/write.
OutputModule name attribute
app. proj ect . renderQueue. i t em(i ndex). out put Modul es[i ndex]. name
Description
The name of the output module, as shown in the user interface.
Type
String; read-only.
OutputModule postRenderAction attribute
app. proj ect . renderQueue. i t em(i ndex). out put Modul es[i ndex]. post RenderAct i on
Description
An action to be performed when the render operation is completed.
Type
A Post RenderAct i on enumerated value (read/write); one of:
post RenderAct i on. NONE
post RenderAct i on. IMPORT
post RenderAct i on. IMPORT_AND_REPLACE_USAGE
post RenderAct i on. SET_PROXY
OutputModule remove() method
app. proj ect . renderQueue. i t em(i ndex). out put Modul es[i ndex]. remove()
Description
Removes this OutputModule object from the collection.
Parameters
None.
Returns
Nothing.
OutputModule saveAsTemplate() method
app. proj ect . renderQueue. i t em(i ndex). out put Modul es[i ndex]. saveAsTempl at e(name)
Description
Saves this output module as a template and adds it to the t empl ates array.
102
After Effects Scripting Guide JavaScript Reference
102
Parameters
Returns
Nothing.
OutputModule templates attribute
app. proj ect . renderQueue. i t em(i ndex). out put Modul es[i ndex]. templ at es
Description
The names of all output-module templates availalbe in the local installation of After Effects.
Type
Array of strings; read-only.
name A string containing the name of the new template.
103
After Effects Scripting Guide JavaScript Reference
103
PlaceholderSource object
app. proj ect . i tem(i ndex). mai nSource
app. proj ect . i tem(i ndex). proxySource
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.
104
After Effects Scripting Guide JavaScript Reference
104
Project object
app. proj ect
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
Methods
Attribute Reference Description
f i l e Project file attribute on page 106 The file for the currently open project.
root Fol der Project rootFolder attribute on
page 109
The folder containing all the contents of the
project; the equivalent of the Project panel
i tems Project items attribute on page 108 All items in the project.
act i veItem Project activeItem attribute on
page 105
The currently active item.
bi t sPerChannel Project bitsPerChannel attribute on
page 105
The color depth of the current project.
t r ansparencyGr i dThumbnai l s Project transparencyGridThumbnails
attribute on page 112
When true, thumbnail views use the transpar-
ency checkerboard pattern.
t i mecodeDi spl ayType Project timecodeDisplayType
attribute on page 111
The way the timecode is displayed.
t i mecodeBaseType Project timecodeBaseType attribute
on page 111
The timecode base project setting.
t i mecodeNTSCDropFrame Project timecodeNTSCDropFrame
attribute on page 112
The drop-frame project setting.
t i mecodeFi l mType Project timecodeFilmType attribute
on page 111
The film type for the Feet + Frames project set-
ting.
numIt ems Project numItems attribute on
page 108
The total number of items contained in the
project.
sel ect i on Project selection attribute on
page 110
All items selected in the Project panel.
renderQueue Project renderQueue attribute on
page 109
The projects render queue.
di spl aySt ar t Frame Project displayStartFrame attribute on
page 106
The frame at which to start numbering when dis-
playing the project.
l i nearBl endi ng Project linearBlending attribute on
page 108
When true, linear blending is used for the project.
Method Reference Description
i tem() Project item() method on page 108 Retrieves an item from the project.
consol i dateFoot age() Project consolidateFootage() method
on page 106
Consolidates all footage in the project.
105
After Effects Scripting Guide JavaScript Reference
105
Project activeItem attribute
app. proj ect . act i veItem
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
app. proj ect . bi t sPerChannel
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
app. proj ect . cl ose(cl os eOpt i ons )
Description
Closes the project with the option of saving changes automatically, prompting the user to save changes or
closing without saving changes.
removeUnusedFoot age() Project removeUnusedFootage()
method on page 109
Removes unused footage from the project.
reduceProj ect () Project reduceProject() method on
page 109
Reduces the project to a specified set of items.
cl ose() Project close() method on page 105 Closes the project with normal save options.
save() Project save() method on page 110 Saves the project.
saveWi t hDi al og() Project saveWithDialog() method on
page 110
Displays a Save dialog box.
i mpor t Pl acehol der() Project importFileWithDialog()
method on page 107
Imports a placeholder into the project.
i mpor t Fi l e() Project importFile() method on
page 107
Imports a file into the project.
i mpor t Fi l eWi t hDi al og() Project importFileWithDialog()
method on page 107
Displays an Import File dialog box.
showWi ndow() Project showWindow() method on
page 110
Shows or hides the Project panel.
Method Reference Description
106
After Effects Scripting Guide JavaScript Reference
106
Parameters
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
app. proj ect . consol i dateFoot age()
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
app. proj ect . di spl aySt ar t Frame
Description
The frame at which to start numbering when displaying the project with a t i mecodeDi spl ayType value of
Ti mecodeDi spl ayType. FRAMES. (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
app. proj ect . f i l e
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.
cl oseOpt i ons Action to be performed on close. A Cl oseOpt i ons enumerated value, one of:
Cl oseOpt i ons. DO_NOT_SAVE_CHANGES: Close without saving.
Cl oseOpt i ons. PROMPT_TO_SAVE_CHANGES: Prompt for whether to save
changes before close.
Cl oseOpt i ons. SAVE_CHANGES: Save automatically on close.
107
After Effects Scripting Guide JavaScript Reference
107
Project importFile() method
app. proj ect . i mpor t Fi l e(i mpor t Opt i ons )
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 tems array.
Parameters
Returns
FootageItem object.
Example
app. proj ect . i mpor t Fi l e(new Impor t Opt i ons( Fi l e( sampl e. psd ) )
Project importFileWithDialog() method
app. proj ect . i mpor t Fi l eWi t hDi al og()
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
app. proj ect . i mpor t Pl acehol der(name, wi dt h, hei ght , f rameRat e, durat i on)
Description
Creates and returns a new PlaceholderItem object and adds it to the projects i tems array. Same as the
File > Import > Placeholder command.
Parameters
Returns
PlaceholderItem object.
i mpor t Opt i ons An ImportOptions object specifying the file to import and the options for the operation. See
ImportOptions object on page 71.
name A string containing the name of the placeholder.
wi dt h The width of the placeholder in pixels, an integer in the range [4..30000].
hei ght The height of the placeholder in pixels, an integer in the range [4..30000].
f rameRate The frame rate of the placeholder, a floating-point value in the range [1.0..99.0]
durat i on The duration of the placeholder in seconds, a floating-point value in the range [0.0..10800.0].
108
After Effects Scripting Guide JavaScript Reference
108
Project item() method
app. proj ect . i tem(i ndex)
Description
Retrieves an item at a specified index position.
Parameters
Returns
Item object.
Project items attribute
app. proj ect . i tems
Description
All of the items in the project.
Type
ItemCollection object; read-only.
Project linearBlending attribute
app. proj ect . l i nearBl endi ng
Description
True if linear blending should be used for this project; othewise false.
Type
Boolean; read/write.
Project numItems attribute
app. proj ect . numIt ems
Description
The total number of items contained in the project, including folders and all types of footage.
Type
Integer; read-only.
Example
n = app. proj ect . numItems;
al er t ("There are " + n + " i tems i n t hi s proj ect . ")
i ndex The index position of the item, an integer. The first item is at index 1.
109
After Effects Scripting Guide JavaScript Reference
109
Project reduceProject() method
app. proj ect . reduceProj ect (ar ray_of _i t ems )
Description
Removes all items from the project except those specified. Same as the File > Reduce Project command.
Parameters
Returns
Integer; the total number of items removed.
Example
var t heItems = new Arr ay();
t heItems[t heItems. l engt h] = app. proj ect . i t em(1);
t heItems[t heItems. l engt h] = app. proj ect . i t em(3);
app. proj ect . reduceProj ect (t heIt ems);
Project removeUnusedFootage() method
app. proj ect . removeUnusedFoot age()
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
app. proj ect . renderQueue
Description
The render queue of the project.
Type
RenderQueue object; read-only.
Project rootFolder attribute
app. proj ect . root Fol der
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.
arr ay_of _i tems An array containing the Item objects that are to be kept.
110
After Effects Scripting Guide JavaScript Reference
110
Type
FolderItem object; read-only.
Project save() method
app. proj ect . save()
app. proj ect . save(f i l e)
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
Returns
None.
Project saveWithDialog() method
app. proj ect . saveWi t hDi al 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
app. proj ect . sel ect 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
app. proj ect . showWi ndow(doShow)
Description
Shows or hides the Project panel.
f i l e Optional. An ExtendScript File object for the file to save.
111
After Effects Scripting Guide JavaScript Reference
111
Parameters
Returns
Nothing.
Project timecodeBaseType attribute
app. proj ect . t i mecodeBaseType
Description
The Timecode Base option, as set in the Project Settings dialog box.
Type
A Ti mecodeBaseType enumerated value; read/write. One of:
Ti mecodeBaseType. AUTO
Ti mecodeBaseType. FPS24
Ti mecodeBaseType. FPS25
Ti mecodeBaseType. FPS30
Ti mecodeBaseType. FPS48
Ti mecodeBaseType. FPS50
Ti mecodeBaseType. FPS60
Ti mecodeBaseType. FPS100
Project timecodeDisplayType attribute
app. proj ect . t i mecodeDi spl ayType
Description
The way in which timecode is set to display, as set in the Project Settings dialog box.
Type
A Ti mecodeDi spl ayType enumerated value; read/write. One of:
Ti mecodeDi spl ayType. TI MECODE
Ti mecodeDi spl ayType. FRAMES
Ti mecodeDi spl ayType. FEET_AND_FRAMES
Project timecodeFilmType attribute
app. proj ect . t i mecodeFi l mType
Description
The film type, as set in the Feet + Frames option in the Project Settings dialog box.
Type
A Ti mecodeFi l mType enumerated value; read/write. One of:
Ti mecodeFi l mType. MM16
Ti mecodeFi l mType. MM35
doShow When true, show the Project panel. When false, hide the Project panel.
112
After Effects Scripting Guide JavaScript Reference
112
Project timecodeNTSCDropFrame attribute
app. proj ect . t i mecodeNTSCDropFrame
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
app. proj ect . t r ansparencyGr i dThumbnai l s
Description
When true, thumbnail views use the transparency checkerboard pattern.
Type
Boolean; read/write.
113
After Effects Scripting Guide JavaScript Reference
113
Property object
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec
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
proper t yVal ueType Property propertyValueType attribute
on page 126
Type of value stored in this property.
val ue Property value attribute on page 133 Current value of the property.
hasMi n Property hasMin attribute on
page 118
When true, there is a minimum permitted value.
hasMax Property hasMax attribute on
page 118
When true, there is a maximum permitted value.
mi nVal ue Property minValue attribute on
page 125
The minimum permitted value.
maxVal ue Property maxValue attribute on
page 125
The maximum permitted value.
i sSpat i al Property isSpatial attribute on
page 119
When true, the property defines a spatial value.
canVar yOverTi me Property canVaryOverTime attribute
on page 117
When true, the property can be keyframed.
i sTi meVar yi ng Property isTimeVarying attribute on
page 119
When true, the property has keyframes or an
expression enabled that can vary its values.
numKeys Property numKeys attribute on
page 126
The number of keyframes on this property.
uni t sText Property unitsText attribute on
page 133
A text description of the units in which the value is
expressed.
expressi on Property expression attribute on
page 117
The expression string for this property.
canSet Expressi on Property canSetExpression attribute
on page 117
When true, the expression can be set by a script.
expressi onEnabl ed Property expressionEnabled attribute
on page 118
When true, the expression is used to generate val-
ues for the property.
expressi onError Property expressionError attribute on
page 118
The error, if any, that occurred when the last expres-
sion was evaluated.
114
After Effects Scripting Guide JavaScript Reference
114
Methods
keyf r ameInterpol at i onType Property keyframeInterpolationType
attribute on page 119
The type of interpolation used at a keyframe.
sel ect edKeys Property selectedKeys attribute on
page 128
All selected keyframes of the property.
proper t yIndex Property propertyIndex attribute on
page 126
The position index of this property.
Method Reference Description
val ueAt Ti me() Property valueAtTime() method on
page 134
Gets the value of the property evalu-
ated at given time.
set Val ue() Property setValue() method on page 132 Sets the static value of the property.
set Val ueAt Ti me() Property setValueAtTime() method on
page 132
Creates a keyframe for the property.
set Val uesAt Ti mes() Property setValuesAtTimes() method on
page 133
Creates a set of keyframes for the prop-
erty.
set Val ueAt Key() Property setValueAtKey() method on
page 132
Finds a keyframe and sets the value of
the property at that keyframe.
nearest KeyIndex() Property nearestKeyIndex() method on
page 126
Gets the keyframe nearest to a specified
time.
keyTi me() Property keyTime() method on page 124 Gets the time at which a condition
occurs.
keyVal ue() Property keyValue() method on page 125 Gets the value of a keyframe at the time
at which a condition occurs.
addKey() Property addKey() method on page 117 Adds a new keyframe to the property at
a given time.
removeKey() Property removeKey() method on
page 127
Removes a keyframe from the property.
i sInt erpol at i onTypeVal i d() Property isInterpolationTypeValid()
method on page 119
When true, this property can be inter-
polated.
set Inter pol at i onTypeAt Key() Property setInterpolationTypeAtKey()
method on page 128
Sets the interpolation type for a key.
keyInInt erpol at i onType() Property keyInInterpolationType() method
on page 120
Gets the 'in' interpolation type for a key.
keyOut Interpol at i onType() Property keyOutInterpolationType()
method on page 121
Gets the 'out' interpolation type for a
key.
set Spat i al Tangent sAt Key() Property setSpatialTangentsAtKey()
method on page 130
Sets the in and out tangent vectors
for a key.
keyInSpat i al Tangent () Property keyInSpatialTangent() method on
page 120
Gets the in spatial tangent for a key.
keyOut Spat i al Tangent () Property keyOutSpatialTangent() method
on page 121
Gets the out spatial tangent for a key.
set Tempor al EaseAt Key() Property setTemporalEaseAtKey() method
on page 131
Sets the in and out temporal ease for
a key.
Attribute Reference Description
115
After Effects Scripting Guide JavaScript Reference
115
Example: Get and set the value of opacity
var myProper t y = myLayer. opaci t y;
/ / opaci t y has proper t yVal ueType of OneD, and i s stored as a f l oat
myProper t y. set Val ue(0. 5);
/ / Vari abl e myOpaci t y i s a f l oat val ue
var myOpaci t y = myProper t y. val ue;
Example: Get and set the value of a position
var myProper t y = myLayer. posi t i on;
/ / posi t i on has proper t yVal ueType of ThreeD_SPATI AL, and i s st ored as an ar ray of 3 f l oat s
myProper t y. set Val ue([10. 0, 30. 0, 0. 0]);
/ / Vari abl e myPosi t i on i s an arr ay of 3 f l oat s
var myPosi t i on = myProper t y. val ue;
Example: Change the value of a mask shape to be open instead of closed
var myMask = myl ayer. mask(1);
var myProper t y = myMask. maskShape;
myShape = myProper t y. val ue;
keyInTemporal Ease() Property keyInTemporalEase() method on
page 121
Gets the in temporal ease for a key.
keyOut Temporal Ease() Property keyOutTemporalEase() method
on page 122
Gets the out temporal ease for a key.
set Tempor al Cont i nuousAt Key() Property setTemporalContinuousAtKey()
method on page 131
Sets whether a keyframe has temporal
continuity.
keyTemporal Cont i nuous() Property keyTemporalContinuous()
method on page 124
Reports whether a keyframe has tem-
poral continuity.
set Tempor al AutoBezi erAt Key() Property setTemporalAutoBezierAtKey()
method on page 130
Sets whether a keyframe has temporal
auto-Bezier.
keyTemporal Aut oBezi er() Property keyTemporalAutoBezier()
method on page 124
Reports whether a keyframe has tem-
poral auto-Bezier.
set Spat i al Cont i nuousAt Key() Property setSpatialContinuousAtKey()
method on page 129
Sets whether a keyframe has spatial
continuity.
keySpat i al Cont i nuous() Property keySpatialContinuous() method
on page 123
Reports whether a keyframe has spatial
continuity.
set Spat i al AutoBezi erAt Key Property setSpatialAutoBezierAtKey()
method on page 129
Sets whether a keyframe has spatial
auto-Bezier.
keySpat i al Aut oBezi er() Property keySpatialAutoBezier() method
on page 123
Reports whether a keyframe has spatial
auto-Bezier.
set Rovi ngAt Key() Property setRovingAtKey() method on
page 128
Sets whether a keyframe is roving.
keyRovi ng() Property keyRoving() method on page 122 Reports whether a keyframe is roving.
set Sel ectedAt Key() Property setSelectedAtKey() method on
page 129
Sets whether a keyframe is selected.
keySel ect ed() Property keySelected() method on
page 123
Reports whether a keyframe is selected.
Method Reference Description
116
After Effects Scripting Guide JavaScript Reference
116
myShape. cl osed = f al se;
myProper t y. set Val ue(myShape);
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:
var myProper t y = myLi ght . col or ;
var col orVal ue = myProper t y. val ueAt Ti me(2, t rue);
col orVal ue[0] = 0. 5 * col orVal ue[0];
myProper t y. set Val ueAt Ti me(4, col orVal ue);
Example: Check that a scale calculated by an expression at time 3.5 is the expected value of [10,50]
var myProper t y = myLayer. scal e;
/ / f al se val ue of preExpressi on means eval uate t he expressi on
var scal eVal ue = myProper t y. val ueAt Ti me(3. 5, f al se);
i f (scal eVal ue[0] == 10 && scal eVal ue[1] == 50) {
al er t ("hur ray");
el se {
al er t ("oops");
}
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.
myProper t y = myLayer. rot at i on;
myProper t y. set Val ueAt Ti me(0, 0);
myProper t y. set Val ueAt Ti me(5, 90);
myProper t y. set Val ueAt Ti me(10, 0);
Example: Change the keyframe values for the first three keyframes of some source text
myProper t y = myText Layer. sourceText ;
i f (myProper t y. numKeys < 3) {
al er t ("er ror, I t hought t here were 3 keyf rames");
}
myProper t y. set Val ueAt Key(1, new Text Document ("key number 1");
myProper t y. set Val ueAt Key(2, new Text Document ("key number 2");
myProper t y. set Val ueAt Key(3, new Text Document ("key number 3");
Example: Set values using the convenience syntax for position, scale, color, or source text
/ / These t wo are equi val ent . The second f i l l s i n a def aul t of 0.
myLayer. posi t i on. set Val ue([ 20, 30, 0]);
myLayer. posi t i on. set Val ue([ 20, 30 ]);
/ / These t wo are equi val ent . The second f i l l s i n a def aul t of 100.
myLayer. scal e. set Val ue([ 50, 50, 100]);
myLayer. scal e. set Val ue([ 50, 50 ]);
/ / These t wo are equi val ent . The second f i l l s i n a def aul t of 1. 0
myLi ght . col or. set Val ue([ . 8, . 3, . 1, 1. 0]);
myLi ght . col or. set Val ue([ . 8, . 3, . 1]);
/ / These t wo are equi val ent . The second creates a Text Document
117
After Effects Scripting Guide JavaScript Reference
117
myText Layer. sourceText . set Val ue(new Text Doc ument ("f oo"));
myText Layer. sourceText . set Val ue("f oo");
Property addKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. addKey(t i me)
Description
Adds a new keyframe or marker to the named property at the specified time and returns the index of the new
keyframe.
Parameters
Returns
Integer; the index of the new keyframe or marker.
Property canSetExpression attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. canSet Expressi on
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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. canVar yOverTi me
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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. expressi on
Description
The expression for the named property. Writeable only when canSet Expressi 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, expressi onEnabl ed becomes true.
t i me The time, in seconds, at which to add the keyframe. A floating-point value. The beginning of the composition is 0.
118
After Effects Scripting Guide JavaScript Reference
118
If the string does not contain a valid expression, an error is generated, and expressi onEnabl ed becomes
false.
If you set the attribute to the empty string, expressi onEnabl ed becomes false, but no error is generated.
Type
String; read/write if canSet Expressi on for the named property is true, otherwise read-only.
Property expressionEnabled attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. expressi onEnabl ed
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 canSet Expressi on
for the named property is true and expressi on contains a valid expression string.
Type
Boolean; read/write.
Property expressionError attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. expressi onEr ror
Description
Contains the error, if any, generated by evaluation of the string most recently set in expressi on. 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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. hasMax
Description
When true, there is a maximum permitted value for the named property; otherwise false.
Type
Boolean; read-only.
Property hasMin attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. hasMi n
Description
When true, there is a minimum permitted value for the named property; otherwise false.
119
After Effects Scripting Guide JavaScript Reference
119
Type
Boolean; read-only.
Property isInterpolationTypeValid() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. i sInter pol at i onTypeVal i d(t ype)
Description
Returns true if the named property can be interpolated using the specified keyframe interpolation type.
Parameters
Returns
Boolean.
Property isSpatial attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. i sSpat 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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. i sTi meVar yi 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 canVar yOverTi me must also be true.
Type
Boolean; read-only.
Property keyframeInterpolationType attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyf rameInter pol at i onType
Description
The type of interpolation used at a keyframe.
Type
A Keyf rameInter pol at i onType enumerated value; read/write. One of:
t ype A Keyf r ameInt er pol at i onType enumerated value; one of:
Keyf r ameInt erpol at i onType. LINEAR
Keyf r ameInt erpol at i onType. BEZIER
Keyf r ameInt erpol at i onType. HOLD
120
After Effects Scripting Guide JavaScript Reference
120
Keyf r ameInt erpol at i onType. LINEAR
Keyf r ameInt erpol at i onType. BEZIER
Keyf r ameInt erpol at i onType. HOLD
Property keyInInterpolationType() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyInInter pol at i onType(ke yIndex)
Description
Returns the 'in' interpolation type for the specified keyframe.
Parameters
Returns
A Keyf rameInter pol at i onType enumerated value; one of:
Keyf r ameInt erpol at i onType. LINEAR
Keyf r ameInt erpol at i onType. BEZIER
Keyf r ameInt erpol at i onType. HOLD
Property keyInSpatialTangent() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyInSpat i al Tangent (ke yIndex)
Description
Returns the incoming spatial tangent for the specified keyframe, if the named property is spacial (that is, the
value type is TwoD_SPATIAL or ThreeD_SPATIAL).
Parameters
Returns
Array of floating-point values:
If the property value type is proper t yVal ueType. TwoD_SPATIAL, the array contains 2 floating-point
values.
If the property value type is proper t yVal ueType. ThreeD_SPATIAL, the array contains 3 floating-point
values.
If the property value type is neither of these types, an exception is generated.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or nearest Key-
Index method.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or nearest Key-
Index method.
121
After Effects Scripting Guide JavaScript Reference
121
Property keyInTemporalEase() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. vkeyInTempor al Ease(ke yIndex)
Description
Returns the incoming temporal ease for the specified keyframe.
Parameters
Returns
Array of KeyframeEase objects:
If the property value type is proper t yVal ueType. TwoD_SPATIAL, the array contains 2 objects.
If the property value type is proper t yVal ueType. ThreeD_SPATIAL, the array contains 3 objects.
For any other value type, the array contains 1 object.
Property keyOutInterpolationType() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyOut Int er pol at i onType(ke yIndex)
Description
Returns the outgoing interpolation type for the specified keyframe.
Parameters
Returns
A Keyf rameInter pol at i onType enumerated value; one of:
Keyf r ameInt erpol at i onType. LINEAR
Keyf r ameInt erpol at i onType. BEZIER
Keyf r ameInt erpol at i onType. HOLD
Property keyOutSpatialTangent() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyOut Spat i al Tangent (ke yIndex)
Description
Returns the outgoing spatial tangent for the specified keyframe.
Parameters
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
122
After Effects Scripting Guide JavaScript Reference
122
Returns
Array of floating-point values:
If the property value type is proper t yVal ueType. TwoD_SPATIAL, the array contains 2 floating-point
values.
If the property value type is proper t yVal ueType. ThreeD_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
app. proj ect . i t em(i ndex). l ayer(i ndex). proper t ySpec. keyOut Temporal Ease(ke yIndex)
Description
Returns the outgoing temporal ease for the specified keyframe.
Parameters
Returns
Array of KeyframeEase objects:
If the property value type is proper t yVal ueType. TwoD_SPATIAL, the array contains 2 objects.
If the property value type is proper t yVal ueType. ThreeD_SPATIAL, the array contains 3 objects.
For any other value type, the array contains 1 object.
Property keyRoving() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyRovi ng(ke yIndex)
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 keyRovi ng() continues to return false.
If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
Returns
Boolean.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
123
After Effects Scripting Guide JavaScript Reference
123
Property keySelected() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keySel ected(ke yIndex)
Description
Returns true if the specified keyframe is selected.
Parameters
Returns
Boolean.
Property keySpatialAutoBezier() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keySpat i al AutoBezi er(ke yIndex)
Description
Returns true if the specified keyframe has spatial auto-Bezier interpolation. (This type of interpolation affects
this keyframe only if keySpat i al Cont i nuous(ke yIndex) is also true.)
If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
Returns
Boolean.
Property keySpatialContinuous() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keySpat i al Cont i nuous(ke yIndex)
Description
Returns true if the specified keyframe has spatial continuity.
If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
Returns
Boolean.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
124
After Effects Scripting Guide JavaScript Reference
124
Property keyTemporalAutoBezier() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyTemporal AutoBezi er(ke yIndex)
Description
Returns true if the specified keyframe has temporal auto-Bezier interpolation.
Temporal auto-Bezier interpolation affects this keyframe only if keyf rameInter pol at i onType is Keyf rameIn-
ter pol at i onType. BEZIER for both keyInInter pol at i on(ke yIndex) and keyOut Inter pol at i on(ke yIndex).
Parameters
Returns
Boolean.
Property keyTemporalContinuous() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyTemporal Cont i nuous(ke yIndex)
Description
Returns true if the specified keyframe has temporal continuity.
Temporal continuity affects this keyframe only if keyf r ameInt er pol at i onType is Keyf rameInter pol a-
t i onType. BEZIER for both keyInInt erpol at i on(ke yIndex) and keyOut Inter pol at i on(ke yIndex).
Parameters
Returns
Boolean.
Property keyTime() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyTi me(ke yIndex)
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyTi me(mar kerComment )
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

keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or
nearest KeyIndex method.
markerComment The comment string attached to a marker (see MarkerValue comment attribute on page 96).
125
After Effects Scripting Guide JavaScript Reference
125
Returns
Floating-point value.
Property keyValue() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyVal ue(ke yIndex)
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. keyVal ue(markerComment )
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

Returns
Floating-point value.
Property maxValue attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. maxVal ue
Description
The maximum permitted value of the named property. If the hasMax attribute is false, an exception occurs,
and an error is generated.
Type
Floating-point value; read-only.
Property minValue attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. mi nVal ue
Description
The minimum permitted value of the named property. If the hasMi n attribute is false, an exception occurs,
and an error is generated.
Type
Floating-point value; read-only.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or
nearest KeyIndex method.
markerComment The comment string attached to a marker (see MarkerValue comment attribute on page 96).
126
After Effects Scripting Guide JavaScript Reference
126
Property nearestKeyIndex() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. nearest KeyIndex(t i me)
Description
Returns the index of the keyframe nearest to the specified time.
Parameters
Returns
Integer.
Property numKeys attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. numKeys
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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. proper 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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. proper t yVal ueType
Description
The type of value stored in the named property. The Proper t yVal ueType 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:
myl ayer. proper t y("posi t i on"). set Val ue([10, 20, 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:
var myShape = new Shape();
t i me The time in seconds; a floating-point value. The beginning of the composition is 0.
127
After Effects Scripting Guide JavaScript Reference
127
myShape. ver t i ces = [[0, 0], [0, 100], [100, 100], [100, 0]];
var myMask = myl ayer. proper t y("ADBE Mask Parade"). proper t y(1);
myMask. proper t y("ADBE Mask Shape"). set Val ue(myShape);
Type
A Proper t yVal ueType enumerated value; read/write. One of:
E
Property removeKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. removeKey(ke yIndex)
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
Returns
Nothing.
Proper t yVal ueType. NO_VALUE Stores no data.
Proper t yVal ueType. ThreeD_SPATIAL Array of three floating-point positional values. For example, an Anchor
Point value might be [10.0, 20.2, 0.0]
Proper t yVal ueType. ThreeD Array of three floating-point quantitative values. For example, a Scale
value might be [100.0, 20.2, 0.0]
Proper t yVal ueType. TwoD_SPATI AL Array of 2 floating-point positional values For example, an Anchor Point
value might be [5.1, 10.0]
Proper t yVal ueType. TwoD Array of 2 floating-point quantitative values. For example, a Scale value
might be [5.1, 100.0]
Proper t yVal ueType. OneD A floating-point value.
Proper t yVal ueType. COLOR 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 yVal ueType. CUSTOM_VALUE Unimplemented type; you cannot get or set values for properties with this
type.
Proper t yVal ueType. MARKER MarkerValue object; see MarkerValue object on page 95.
Proper t yVal ueType. LAYER_INDEX Integer; a value of 0 means no layer.
Proper t yVal ueType. MASK_INDEX Integer; a value of 0 means no mask.
Proper t yVal ueType. SHAPE Shape object; see Shape object on page 159.
Proper t yVal ueType. TEXT_DOCUMENT TextDocument object; see TextDocument object on page 165.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
128
After Effects Scripting Guide JavaScript Reference
128
Property selectedKeys attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. sel ectedKeys
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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Interpol at i onTypeAt Key(i nType, out Type)
Description
Sets the in and out interpolation types for the specified keyframe.
Parameters
Returns
Nothing.
Property setRovingAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Rovi ngAt Key(ke yIndex, newVal )
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 keyRovi ng() continues to return false.
If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
i nType The incoming interpolation type. A Keyf rameInter pol at i onType enumerated value; one
of:
Keyf r ameInt erpol at i onType. LINEAR
Keyf r ameInt erpol at i onType. BEZIER
Keyf r ameInt erpol at i onType. HOLD
out Type (Optional) The outgoing interpolation type. If not supplied, the out type is set to the i nType
value. A Keyf rameInter pol at i onType enumerated value; one of:
Keyf r ameInt erpol at i onType. LINEAR
Keyf r ameInt erpol at i onType. BEZIER
Keyf r ameInt erpol at i onType. HOLD
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or nearest Key-
Index method.
newVal True to turn roving on, false to turn roving off.
129
After Effects Scripting Guide JavaScript Reference
129
Returns
Nothing.
Property setSelectedAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Sel ect edAt Key(ke yIndex, onOf f )
Description
Selects or deselects the specified keyframe.
Parameters
Returns
Nothing.
Property setSpatialAutoBezierAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Spat i al Aut oBezi erAt Key(keyIndex, newVal )
Description
Turns spatial auto-Bezier interpolation on or off for the specified keyframe .
If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
Returns
Nothing.
Property setSpatialContinuousAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Spat i al Cont i nuousAt Key(ke yIndex, newVal )
Description
Turns spatial continuity on or off for the specified keyframe.
If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
onOf f True to select the keyframe, false to deselect it.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
newVal True to turn spatial auto-Bezier on, false to turn it off.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
newVal True to turn spatial continuity on, false to turn it off.
130
After Effects Scripting Guide JavaScript Reference
130
Returns
Nothing.
Property setSpatialTangentsAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Spat i al Tangent sAt Key(ke yIndex, i nTangent ,
out Tangent )
Description
Sets the incoming and outgoing tangent vectors for the specified keyframe.
If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.
Parameters
Returns
Nothing.
Property setTemporalAutoBezierAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Temporal Aut oBezi erAt Key(ke yIndex, newVal )
Description
Turns temporal auto-Bezier interpolation on or off for the specified keyframe. When this is turned on, it
affects this keyframe only if keySpat i al Cont i nuous(ke yIndex) is also true.
Parameters
Returns
Nothing.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
i nTangent The incoming tangent vector. An array of 2 or 3 floating-point values.
If the property value type is proper t yVal ueType. TwoD_SPATIAL, the array contains 2 values.
If the property value type is proper t yVal ueType. ThreeD_SPATIAL, the array contains 3 values.
out Tangent (Optional) The outgoing tangent vector. If not supplied, the out tangent is set to the i nTangent value. An
array of 2 or 3 floating-point values.
If the property value type is proper t yVal ueType. TwoD_SPATIAL, the array contains 2 values.
If the property value type is proper t yVal ueType. ThreeD_SPATIAL, the array contains 3 values.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
newVal True to turn temporal auto-Bezier on, false to turn it off.
131
After Effects Scripting Guide JavaScript Reference
131
Property setTemporalContinuousAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Temporal Cont i nuousAt Key(ke yIndex, newVal )
Description
Turns temporal continuity on or off for the specified keyframe.
When temporal continuity is turned on, it affects this keyframe only if the Keyf rameInter pol at i onType is
Keyf r ameInt erpol at i onType. BEZIER for both keyInInter pol at i on(ke yIndex) and keyOut Inter po-
l at i on(ke yIndex).
Parameters
Returns
Nothing.
Property setTemporalEaseAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Temporal EaseAt Key(ke yIndex, i nTemporal Eas e,
out Temporal Eas e)
Description
Sets the incoming and outgoing temporal ease for the specified keyframe. See KeyframeEase object on
page 79.
Parameters
Returns
Nothing.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
newVal True to turn temporal continuity on, false to turn it off.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or
nearest KeyIndex method.
i nTempor al Ease The incoming temporal ease. An array of 1, 2, or 3 KeyframeEase objects.
If the property value type is proper t yVal ueType. TwoD_SPATIAL, the array contains 2
objects.
If the property value type is proper t yVal ueType. ThreeD_SPATIAL, the array contains 3
objects.
For all other value types, the array contains 1 object.
out Temporal Ease (Optional) The outgoing temporal ease. If not supplied, the outgoing ease is set to the i nTempo-
ral Ease value. An array of 1, 2, or 3 KeyframeEase objects.
If the property value type is proper t yVal ueType. TwoD_SPATIAL, the array contains 2
objects.
If the property value type is proper t yVal ueType. ThreeD_SPATIAL, the array contains 3
objects.
For all other value types, the array contains 1 object.
132
After Effects Scripting Guide JavaScript Reference
132
Property setValue() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Val ue(newVal ue)
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
Returns
Nothing.
Property setValueAtKey() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Val ueAt Key(ke yIndex, newVal ue)
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
Returns
Nothing.
Property setValueAtTime() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Val ueAt Ti me(t i me, newVal ue)
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
newVal ue A value appropriate for the type of property being set; see Property propertyValueType attribute on page 126.
keyIndex The index for the keyframe. An integer in the range [0..numKeys], as returned by the addKey or near-
est KeyIndex method.
newVal ue A value appropriate for the type of property being set; see Property propertyValueType attribute on
page 126.
t i me The time in seconds, a floating-point value. The beginning of the composition is 0.
newVal ue A value appropriate for the type of property being set; see Property propertyValueType
attribute on page 126.
133
After Effects Scripting Guide JavaScript Reference
133
Returns
Nothing.
Property setValuesAtTimes() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. set Val uesAt Ti mes(t i mes , newVal ues )
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
Returns
Nothing.
Property unitsText attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. uni t sText
Description
The text description of the units in which the value is expressed.
Type
String; read-only.
Property value attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. val ue
Description
The value of the named property at the current time.
If expressi onEnabl ed 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.
t i mes An array of times, in seconds. Each time is a floating-point value. The beginning of the compo-
sition is 0.
newVal ues A array of values appropriate for the type of property being set; see Property propertyValue-
Type attribute on page 126.
134
After Effects Scripting Guide JavaScript Reference
134
Property valueAtTime() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. val ueAt Ti me(t i me, preExpres s i on)
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
Returns
A value appropriate for the type of the property (see Property propertyValueType attribute on page 126).
t i me The time in seconds; a floating-point value. The beginning of the composition is 0.
preExpressi on 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.
135
After Effects Scripting Guide JavaScript Reference
135
PropertyBase object
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec
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:
var ef f ect 1 = app. proj ect . i t em(1). l ayer(1). ef f ect ("Add Grai n")("Vi ewi ng Mode");
var ef f ect 1agai n = app. proj ect . i tem(1). l ayer(1). ef f ect . addGr ai n. vi ewi ngMode;
var ef f ect 1agai ntoo = app. proj ect . i tem(1). l ayer(1)("Ef f ect s"). addGrai n. vi ewi ngMode;
var ef f ect 1agai ntoo2 = app. proj ect . i t em(1). l ayer(1)("Ef f ect s")("Add Gr ai n")("Vi ewi ng Mode");
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 refer-
ences 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":
var l ayer1 = app. proj ect . i t em(1). l ayer(1);
l ayer1. remove();
al er t (l ayer1. name); / / i nval i d ref erence to del eted obj ect
Similarly, if you reference an AE property in a deleted object, the warning occurs:
var l ayer1 = app. proj ect . i t em(1). l ayer(1);
var l ayer1posi t i on = l ayer1. t r ansf orm. posi t i on;
l ayer1. remove();
al er t (l ayer1posi t i on. val ue); / / i nval i d ref erence to proper t y i n del ect ed obj ect
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:
var ef f ect 1 = app. proj ect . i t em(1). l ayer(1). ef f ect (1);
var ef f ect 2 = app. proj ect . i t em(1). l ayer(1). ef f ect (2);
var ef f ect 2par am = app. proj ect . i t em(1). l ayer(1). ef f ect (2). bl endWi t hOri gi nal ;
ef f ect 1. remove();
al er t (ef f ect 2. name); / / i nval i d ref erence because group i ndex posi t i ons have changed
Attributes
Attribute Reference Description
name PropertyBase name attribute on
page 139
Name of the property.
matchName PropertyBase matchName attribute
on page 138
A special name for the property used to build unique naming paths.
136
After Effects Scripting Guide JavaScript Reference
136
Methods
PropertyBase active attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. act i ve
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 enabl ed attribute.
Type
Boolean; read/write if canSet Enabl ed is true, read-only if canSet Enabl ed is false.
proper t yIndex PropertyBase propertyIndex attribute
on page 140
Index of this property within its parent group.
proper t yDept h PropertyBase propertyDepth attribute
on page 139
The number of levels of parent groups between this property and
the containing layer.
proper t yType PropertyBase propertyType attribute
on page 140
The property type.
parent Proper t y PropertyBase parentProperty
attribute on page 139
The immediate parent group of this property.
i sModi f i ed PropertyBase isModified attribute on
page 138
When true, the property has been changed since its creation.
canSet Enabl ed PropertyBase canSetEnabled attribute
on page 137
When true, the user interface displays an eyeball icon for this prop-
erty.
enabl ed PropertyBase enabled attribute on
page 138
When true, this property is enabled.
act i ve PropertyBase active attribute on
page 136
When true, this property is active.
el i ded PropertyBase elided attribute on
page 137
When true, this property is not displayed in the user interface.
i sEf f ect PropertyBase isEffect attribute on
page 138
When true, this property is an effect.
i sMask PropertyBase isMask attribute on
page 138
When true, this property is a mask.
sel ect ed PropertyBase selected attribute on
page 141
When true, this property is selected.
Method Reference Description
proper t yGroup() PropertyBase propertyGroup()
method on page 140
Gets the parent group for this property.
remove() PropertyBase remove() method on
page 141
Removes this from the project.
moveTo() PropertyBase moveTo() method on
page 139
Moves this property to a new position in its parent group.
dupl i cat e() PropertyBase duplicate() method on
page 137
Duplicates this property object.
Attribute Reference Description
137
After Effects Scripting Guide JavaScript Reference
137
PropertyBase canSetEnabled attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. canSet Enabl ed
Description
When true, you can set the enabl ed 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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. dupl i cate()
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 Proper t yType. INDEXED_GROUP; see PropertyBase propertyType attribute
on page 140.
Parameters
None.
Returns
PropertyBase object.
PropertyBase elided attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. el i ded
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:
Text
Pat h Opt i ons
More Opt i ons
Ani mator 1
Ani mator 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.
138
After Effects Scripting Guide JavaScript Reference
138
PropertyBase enabled attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. enabl ed
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 canSet Enabl ed is true, read-only if canSet Enabl ed is false.
PropertyBase isEffect attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. i sEf f ect
Description
When true, this property is an effect PropertyGroup.
Type
Boolean; read-only.
PropertyBase isMask attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. i sMask
Description
When true, this property is a mask PropertyGroup.
Type
Boolean; read-only.
PropertyBase isModified attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. i sModi f i ed
Description
When true, this property has been changed since its creation.
Type
Boolean; read-only.
PropertyBase matchName attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. mat chName
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 name attribute value) or any changes to the application.
Unlike the display name, it is not localized.
139
After Effects Scripting Guide JavaScript Reference
139
An indexed group may not have a name value, but always has a matchName value. (An indexed group has the
type Proper t yType. INDEXED_GROUP; see PropertyBase propertyType attribute on page 140.)
Type
String; read-only.
PropertyBase moveTo() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. moveTo(newIndex)
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 Proper-
t yType. INDEXED_GROUP; see PropertyBase propertyType attribute on page 140.)
Parameters
Returns
Nothing.
PropertyBase name attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. name
Description
The display name of the property. (Compare PropertyBase matchName attribute on page 138.)
It is an error to set the name value if the property is not a child of an indexed group (that is, a property group
that has the type Proper t yType. INDEXED_GROUP; see PropertyBase propertyType attribute on page 140).
Type
String; read/write for a child of an indexed group; otherwise read-only.
PropertyBase parentProperty attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. parent Proper 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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. proper t yDept h
newIndex The new index position at which to place this property in its group. An integer.
140
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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. proper t yGroup()
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. proper t yGroup(count Up)
Description
Gets the PropertyGroup object for an ancestor group of this property at a specified level of the parent-child
hierarchy.
Parameters
Returns
PropertyGroup object, or null if the count reaches the containing layer.
PropertyBase propertyIndex attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. proper 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 Proper t yType. INDEXED_GROUP; see PropertyBase propertyType attribute on
page 140).
Type
Integer; read-only.
PropertyBase propertyType attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. proper t yType
Description
The type of this property.
Type
A Proper t yType enumerated value; read/write. One of:
count Up Optional. The number of levels to ascend within the parent-child hierarchy. An integer in the
range [1..proper t yDept h]. Default is 1, w hich gets the immediate parent.
Proper t yType. PROPERTY A single property such as position or zoom.
Proper t yType. INDEXED_GROUP A property group whose members have an editable name and an index. Effects
and masks are indexed groups. For example, the masks property of a layer
refers to a variable number of individual masks by index number.
141
After Effects Scripting Guide JavaScript Reference
141
PropertyBase remove() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. remove()
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 Proper-
t yType. INDEXED_GROUP; 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
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t ySpec. sel ected
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 sel ectedProper t i es attribute of a
Comp or Layer object.
Type
Boolean; read/write for an effect or mask property group, otherwise read-only.
Proper t yType. NAMED_GROUP A property group in which the member names are not editable. Layers are
named groups.
142
After Effects Scripting Guide JavaScript Reference
142
PropertyGroup object
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t yGroupSpec
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
Methods
PropertyGroup addProperty() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t yGroupSpec. addProper t y(name)
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
Proper t yType. INDEXED_GROUP; 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 Proper t yType. NAMED_GROUP).
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 canAddProper t y before calling this method. (See Property-
Group canAddProperty() method on page 143.)
Attribute Reference Description
numProper t i es PropertyGroup numProperties attribute on page 143 The number of indexed properties in the group.
Method Reference Description
proper t y() PropertyGroup property() method on
page 144
Gets a member property or group.
canAddProper t y() PropertyGroup canAddProperty() method
on page 143
Reports whether a property can be added to the group.
addProper t y() PropertyGroup addProperty() method on
page 142
Adds a property to the group.
143
After Effects Scripting Guide JavaScript Reference
143
Parameters
Returns
PropertyBase object.
PropertyGroup canAddProperty() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t yGroupSpec. canAddProper t y(name)
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.
maskGroup. canAddProper t y("mask"); / / ret ur ns t rue
maskGroup. canAddProper t y("ADBE Mask Atom"); / / ret urns t r ue
maskGroup. canAddProper t y("bl end"); / / ret urns f al se
Parameters
Returns
Boolean.
PropertyGroup numProperties attribute
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t yGroupSpec. numProper 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.
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.
name The display name or match name of the property to be checked. (See PropertyGroup addProp-
erty() method on page 142).
144
After Effects Scripting Guide JavaScript Reference
144
PropertyGroup property() method
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t yGroupSpec. proper t y(i ndex)
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t yGroupSpec. proper t y(name)
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:
myl ayer. posi t i on
myl ayer("posi t i on")
myl ayer. proper t y("posi t i on")
myl ayer(1)
myl ayer. proper 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:
myLayer. proper t y("ADBE Masks"). proper t y(1)
Parameters

Returns
PropertyBase object or null if no child property with the specified string name is found.
Properties accessible by name
i ndex The index for the child property, in this is an indexed group. An integer in the range [0..numProper-
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.
From any Layer "ADBE Mask Parade", or Masks
"ADBE Effect Parade", or Effects
"ADBE MTrackers", or Motion Trackers
145
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
146
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:
myLayer. proper t y(Ef f ect s). proper t y(Box Bl ur);
myLayer. proper t y(Ef f ect s). proper t y(boxBl ur);
myLayer. proper t y(Ef f ect s). proper t y(ADBE Box Bl ur);
2 If a layer named myLayer has a mask named Mask 1 you can retrieve it as follows:
myLayer. proper t y(Masks). proper t y(Mask 1);
3 To get a Bulge Center value from a Bulge effect, you can use either of the following:
myLayer. proper t y(Ef f ect s). proper t y(Bul ge). proper t y(Bul ge Cent er);
myLayer. proper t y(Ef f ect s). proper t y(Bul ge). proper t y(bul geCent er);
147
After Effects Scripting Guide JavaScript Reference
147
RenderQueue object
app. proj ect . renderQueue
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 Render-
QueueItem object on page 150.
Attributes
Methods
RenderQueue Item() method
app. proj ect . renderQueue. i t em(i ndex)
Description
Gets a specified item from the i tems collection.
Parameters
Returns
RenderQueueItem object.
Attribute Reference Description
render i ng RenderQueue rendering attribute on page 149 When true, a render is in progress.
numIt ems RenderQueue numItems attribute on page 148 The total number of items in the render queue.
i tems RenderQueue items attribute on page 148 The collection of items in the render queue.
Method Reference Description
showWi ndow() RenderQueue showWindow() method
on page 149
Show or hides the Render Queue panel.
render() RenderQueue render() method on
page 148
Starts the rendering process; does not return until render is
complete.
pauseRender i ng() RenderQueue pauseRendering()
method on page 148
Pauses or restarts the rendering process.
stopRenderi ng() RenderQueue stopRendering()
method on page 149
Stops the rendering process.
i tem() RenderQueue Item() method on
page 147
Gets a render-queue item from the collection.
i ndex The position index of the item. An integer in the range [0..numItems].
148
After Effects Scripting Guide JavaScript Reference
148
RenderQueue items attribute
app. proj ect . renderQueue. i t ems
Description
A collection of all items in the render queue. See RenderQueueItem object on page 150.
Type
RQItemCollection object; read-only.
RenderQueue numItems attribute
app. proj ect . renderQueue. numItems
Description
The total number of items in the render queue.
Type
Integer; read-only.
RenderQueue pauseRendering() method
app. proj ect . renderQueue. pauseRender i ng(paus 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 onSt at usChanged or
onEr ror callback . See RenderQueueItem onStatusChanged attribute on page 152 and Application onError
attribute on page 26.
Parameters
Returns
Nothing.
RenderQueue render() method
app. proj ect . renderQueue. 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 pauseRender i ng()
or stopRender i ng() from an onEr ror or onSt at usChanged callback.
To respond to errors during the rendering process, define a callback function in app. onError ; 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 RenderQueueIt em. onSt at usChanged in the associated RenderQueueItem object; see Render-
QueueItem onStatusChanged attribute on page 152.
pause True to pause a current render process, false to continue a paused render.
149
After Effects Scripting Guide JavaScript Reference
149
Parameters
None.
Returns
Nothing.
RenderQueue rendering attribute
app. proj ect . renderQueue. renderi ng
Description
When true, the rendering process is in progress or paused. When false, it is stopped.
Type
Boolean; read-only.
RenderQueue showWindow() method
app. proj ect . renderQueue. showWi ndow(doShow)
Description
Shows or hides the Render Queue panel.
Parameters
Returns
Nothing.
RenderQueue stopRendering() method
app. proj ect . renderQueue. st opRender i ng()
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 onSt at usChanged or onEr ror callback . See RenderQueueItem onStatus-
Changed attribute on page 152 and Application onError attribute on page 26.
Parameters
None.
Returns
Nothing.
doShow When true, show the Render Queue panel. When false, hide it.
150
After Effects Scripting Guide JavaScript Reference
150
RenderQueueItem object
app. proj ect . renderQueue. i t ems(i ndex)
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
Methods
Attribute Reference Description
numOut put Modul es RenderQueueItem numOutputModules
attribute on page 152
The total number of Output Modules assigned tothe
item.
render RenderQueueItem render attribute on
page 153
When true, this item is rendered when the queue is
started.
st ar t Ti me RenderQueueItem startTime attribute on
page 154
The time when rendering began for the item.
el apsedSeconds RenderQueueItem elapsedSeconds
attribute on page 151
The time elapsed in the current rendering of this item.
t i meSpanSt ar t RenderQueueItem timeSpanStart
attribute on page 155
The start time in the composition to be rendered.
t i meSpanDur at i on RenderQueueItem timeSpanDuration
attribute on page 155
The duration of the composition to be rendered.
ski pFrames RenderQueueItem skipFrames attribute
on page 154
The number of frames to skip when rendering this item.
comp RenderQueueItem comp attribute on
page 151
The composition to be rendered by this item.
out put Modul es RenderQueueItem outputModules
attribute on page 153
The collection of Output Modules for this item.
templ ates RenderQueueItem templates attribute on
page 155
A set of Render Settings templates.
st at us RenderQueueItem status attribute on
page 154
The current rendering status of the item.
onSt at usChanged RenderQueueItem onStatusChanged
attribute on page 152
A callback function that is called during the rendering
process when the status of the item changes.
l ogType RenderQueueItem logType attribute on
page 152
A log type for this item.
Method Reference Description
out put Modul e() RenderQueueItem outputModule() method on
page 153
Gets an Output Module for the item.
remove() RenderQueueItem remove() method on page 153 Removes the item from the render queue.
saveAsTempl at e() RenderQueueItem saveAsTemplate() method on
page 154
Saves a new Render Settings template.
appl yTempl at e() RenderQueueItem applyTemplate() method on
page 151
Applies a Render Settings template.
151
After Effects Scripting Guide JavaScript Reference
151
RenderQueueItem applyTemplate() method
app. proj ect . renderQueue. i t em. appl yTempl at e(t empl at eName)
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
Returns
Nothing.
RenderQueueItem comp attribute
app. proj ect . renderQueue. i t em(i ndex). comp
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
app. proj ect . renderQueue. i t em(i ndex). dupl i cate()
Description
Creates a duplicate of this item and adds it this render queue.
Parameters
None.
Returns
RenderQueueItem object.
RenderQueueItem elapsedSeconds attribute
app. proj ect . renderQueue. i t em(i ndex). el apsedSeconds
Description
The number of seconds spent rendering this item.
dupl i cat e RenderQueueItem duplicate() method on page 151 Duplicates this item.
templ ateName A string containing the name of the template to apply.
Method Reference Description
152
After Effects Scripting Guide JavaScript Reference
152
Type
Integer, or null if item has not been rendered; read-only.
RenderQueueItem logType attribute
app. proj ect . renderQueue. i t em(i ndex). out put Modul e. l ogType
Description
A log type for this item, indicating which events should be logged while this item is being rendered.
Type
A LogType enumerated value; (read/write). One of:
LogType. ERRORS_ONLY
LogType. ERRORS_AND_SETTI NGS
LogType. ERRORS_AND_PER_FRAME_I NFO
RenderQueueItem numOutputModules attribute
app. proj ect . renderQueue. i t em(i ndex). numOut put Modul es
Description
The total number of Output Modules assigned to this item.
Type
Integer; read-only.
RenderQueueItem onStatusChanged attribute
app. proj ect . renderQueue. i t em(i ndex). onSt at usChanged
Description
The name of a callback function that is called whenever the value of the RenderQueueItem. st at us 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 pauseRen-
dering() 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 unct i on mySt at usChanged() {
al er t (app. proj ect . renderQueue. i t em(1). st at us)
}
app. proj ect . renderQueue. i t em(1). onSt at usChanged = mySt at usChanged();
app. proj ect . renderQueue. i t em(1). render = f al se; / / changes st at us and shows di al og
153
After Effects Scripting Guide JavaScript Reference
153
RenderQueueItem outputModules attribute
app. proj ect . renderQueue. i t em(i ndex). out put Modul es
Description
The collection of Output Modules for the item.
Type
OMCollection object; read-only.
RenderQueueItem outputModule() method
app. proj ect . renderQueue. i t em(i ndex). out put Modul e(i ndex)
Description
Gets an output module with the specified index position.
Parameters
Returns
OutputModule object.
RenderQueueItem remove() method
app. proj ect . renderQueue. i t em(i ndex). remove()
Description
Removes this item from the render queue.
Parameters
None.
Returns
Nothing.
RenderQueueItem render attribute
app. proj ect . renderQueue. i t em(i ndex). render
Description
When true, the item will be rendered when the render queue is started. When set to true, the Render-
QueueItem. st at us is set to RQIt emSt at us. QUEUED. When set to false, st at us is set to RQItem-
St at us. UNQUEUED.
Type
Boolean; read/write.
i ndex The position index of the ouptut module. An integer in the range [0..numOut put Modul es].
154
After Effects Scripting Guide JavaScript Reference
154
RenderQueueItem saveAsTemplate() method
app. proj ect . renderQueue. i t em(i ndex). saveAsTempl ate(name)
Description
Saves the items current render settings as a new template with the specified name.
Parameters
Returns
Nothing.
RenderQueueItem skipFrames attribute
app. proj ect . renderQueue. i t em(i ndex). ski pFrames
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
app. proj ect . renderQueue. i t em(i ndex). st ar t Ti me
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
app. proj ect . renderQueue. i t em(i ndex). st at us
Description
The current render status of the item.
name A string containing the name of the new template.
155
After Effects Scripting Guide JavaScript Reference
155
Type
An RQItemSt at us enumerated value; read-only. One of:
RenderQueueItem templates attribute
app. proj ect . renderQueue. i t em(i ndex). templ ates
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
app. proj ect . renderQueue. i t em(i ndex). t i meSpanDurat 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
app. proj ect . renderQueue. i t em(i ndex). t i meSpanSt ar 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.
RQIt emSt at us. WILL_CONTINUE Rendering process has been paused.
RQIt emSt at us. NEEDS_OUTPUT Item lacks a valid output path.
RQIt emSt at us. UNQUEUED Item is listed in the Render Queue panel but composition is not ready to render.
RQIt emSt at us. QUEUED Composition is ready to render.
RQIt emSt at us. RENDERING Composition is rendering
RQIt emSt at us. USER_STOPPED Rendering process was stopped by user or script.
RQIt emSt at us. ERR_STOPPED Rendering process was stopped due to an error.
RQIt emSt at us. DONE Rendering process for the item is complete.
156
After Effects Scripting Guide JavaScript Reference
156
RQItemCollection object
app. proj ect . renderQueue. i t ems
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.
157
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
Settings getSetting() method
app. s et t i ngs . get Set t i ng(s ect i onName, ke yName)
Description
Retrieves a scripting preferences item value from the preferences file.
Parameters
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:
var n = app. set t i ngs. get Set t i ng("Eraser - Pai nt Set t i ngs", "Al i gned Cl one");
al er t ("The set t i ng i s " + n);
Settings haveSetting() method
app. s et t i ngs . haveSet t i ng(s ect i onName, ke yName)
Description
Returns true if the specified scripting preferences item exists and has a value.
Method Reference Description
saveSet t i ng() Settings saveSetting() method on page 158 Saves a default value for a setting.
get Set t i ng() Settings getSetting() method on page 157 Retrieves a setting value.
haveSet t i ng() Settings haveSetting() method on page 157 Reports whether a specified setting is assigned.
sect i onName A string containing the name of a settings section
keyName A string containing the key name of the setting item.
158
After Effects Scripting Guide JavaScript Reference
158
Parameters
Returns
Boolean.
Settings saveSetting() method
app. s et t i ngs . saveSet t i ng(s ect i onName, ke yName, val ue)
Description
Saves a default value for a scripting preferences item.
Parameters
Returns
Nothing.
sect i onName A string containing the name of a settings section
keyName A string containing the key name of the setting item.
sect i onName A string containing the name of a settings section
keyName A string containing the key name of the setting item.
val ue A string containing the new value.
159
After Effects Scripting Guide JavaScript Reference
159
Shape object
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t y(i ndex). proper t y("maskShape"). val ue
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 Shape(), 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 nTangent of [-2,-2] than it does for an i nTangent of
[-1,-1], even though both of these come toward the vertex from the same direction.
If a shape is not closed, the i nTangent for the first vertex and the out Tangent 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 i ces attribute and setting both i nTangent s
and out Tangent s to null. When you access the new shape, its tangent values are filled with the automatically-
calculated tangent values.
Example: Create a square mask
A square is a closed shape with 4 vertices. The i nTangent s and out Tangent s for connected straight-line
segments are 0, the default, and do not need to be explicitly set.
var myShape = new Shape();
myShape. ver t i ces = [ [0, 0], [0, 1], [1, 1], [1, 0] ];
myShape. cl osed = t r ue;
Example: Create a U shaped mask
A "U" is an open shape with the same 4 vertices used in the square:
var myShape = new Shape();
myShape. ver t i ces = [ [0, 0], [0, 1], [1, 1], [1, 0] ];
myShape. cl osed = f al se;
Example: Create an oval
An oval is a closed shape with 4 vertices and with i nTangent and out Tangent values:
var myShape = new Shape();
myShape. ver t i ces = [[300, 50], [200, 150], [300, 250], [400, 150]];
myShape. i nTangent s = [[55. 23, 0], [0, -55. 23], [-55. 23, 0], [0, 55. 23]];
myShape. out Tangent s = [[-55. 23, 0], [0, 55. 23], [55. 23, 0], [0, -55. 23]];
myShape. cl osed = t r ue;
160
After Effects Scripting Guide JavaScript Reference
160
Attributes
Shape closed attribute
. . . proper t y("maskShape"). val ue. cl osed
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
. . . proper t y("maskShape"). val ue. i nTangent 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 i ces 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 calcu-
lated.
Type
Array of floating-point pair arrays; read/write.
Shape outTangents attribute
. . . proper t y("maskShape"). val ue. 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 i ces 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 calcu-
lated.
Attribute Reference Description
cl osed Shape closed attribute on page 160 When true, the shape is a closed curve.
ver t i ces Shape vertices attribute on page 161 The anchor points of the shape.
i nTangent s Shape inTangents attribute on page 160 The tangent vectors coming into the shape vertices.
out Tangent s Shape outTangents attribute on page 160 The tangent vectors coming out of the shape vertices.
161
After Effects Scripting Guide JavaScript Reference
161
Type
Array of floating-point pair arrays; read/write.
Shape vertices attribute
. . . proper t y("maskShape"). val ue. 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:
myShape. ver t i ces = [ [0, 0], [0, 1], [1, 1], [1, 0] ];
Type
Array of floating-point pair arrays; read/write.
162
After Effects Scripting Guide JavaScript Reference
162
SolidSource object
app. proj ect . i tem(i ndex). mai nSource
app. proj ect . i tem(i ndex). proxySource
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
SolidSource color attribute
s ol i dSource. 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.
Attribute Reference Description
col or SolidSource color attribute on page 162 The color of the solid.
163
After Effects Scripting Guide JavaScript Reference
163
System object
system
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 system global variable.
Example
al er t ( "Your OS i s " + syst em. osname + " r unni ng versi on " + system. osversi on);
conf i rm( "You are: " + system. userName + " runni ng on " + syst em. machi neName + ". ");
Attributes
Methods
System callSystem() method
system. cal l System (cmdLi neToExecute);
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
Returns
The output from the command.
System machineName attribute
system. machi neName
Description
The name of the computer on which After Effects is running.
Type
String; read-only.
Attribute Reference Description
userName System userName attribute on page 164 The current user name.
machi neName System machineName attribute on page 163 The name of the host computer.
osName System osName attribute on page 164 The name of the operating system.
osVersi on System osVersion attribute on page 164 The version of the operating system.
Method Reference Description
cal l System() System callSystem() method on page 163 Executes a commandon the systems command line.
cmdLi neToExecute A string containing the command and its parameters.
164
After Effects Scripting Guide JavaScript Reference
164
System osName attribute
system. osName
Description
The name of the operating system on which After Effects is running.
Type
String; read-only.
System osVersion attribute
system. osVersi on
Description
The version of the current local operating system.
Type
String; read-only.
System userName attribute
system. userName
Description
The name of the user currently logged on to the system.
Type
String; read-only.
165
After Effects Scripting Guide JavaScript Reference
165
TextDocument object
new Text Document (docText )
app. proj ect . i tem(i ndex). l ayer(i ndex). proper t y("Source Text "). val ue
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:
var myText Document = new Text Document ("Happy Cake");
myText Layer. proper t y("Source Text "). set Val ue(myText Document );
al er t (myText Layer. proper t y("Source Text "). val ue);
This sets keyframe values for text that show different words over time:
var text Prop = myText Layer. proper t y("Source Text ");
text Prop. set Val ueAt Ti me(0, new Text Document ("Happy"));
text Prop. set Val ueAt Ti me(. 33, new Text Document ("cake"));
text Prop. set Val ueAt Ti me(. 66, new Text Document ("i s"));
text Prop. set Val ueAt Ti me(1, new Text Document ("yummy! "));
Attributes
TextDocument text attribute
t ext Document . text
Description
The text value for the text layers Source Text property.
Type
String; read/write.
Attribute Reference Description
text TextDocument text attribute on page 165 The text layers Source Text value.
166
After Effects Scripting Guide JavaScript Reference
166
TextLayer object
app. proj ect . i tem(i ndex). l ayer(i ndex)
Description
The TextLayer object represents a text layer within a composition. Create it using the LayerCollection objects
addText 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:
Text
Source Text
Pat h Opt i ons
Pat h
Reverse Pat h
Per pendi cul ar To Pat h
Force Al i gnment
Fi rst Margi n
Last Margi n
More Opt i ons
Anchor Poi nt Groupi ng
Groupi ng Al i gnment
Fi l l & St roke
Inter-Character Bl endi ng
Ani mators
Unused Properties and Attributes
The Ti me Remap and Mot i on Tr ackers properties, inherited from AVLayer, are not applicable to text layers,
and their related AVLayer attributes are not used:
canSet Ti meRemapEnabl ed
t i meRemapEnabl ed
t r ackMat teType
i sTrackMat te
hasTrackMat te
167
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
ht t p: / / share. st udi o. adobe. 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.
{
/ / Thi s f unct i on appl i es t he ef f ect to one si ngl e l ayer
f unct i on appl yFast Bl urToLayer(t he_l ayer) {
var addedIt = f al se;
/ / Can onl y add an ef f ect i f t here' s an ef f ect s group i n t he l ayer.
/ / Some l ayers don' t have one, l i ke camera and l i ght l ayers.
i f (t he_l ayer("Ef f ect s") ! = nul l ) {
/ / Al ways best t o check i f i t ' s saf e bef ore addi ng:
i f (t he_l ayer("Ef f ect s"). canAddProper t y("Fast Bl ur")) {
// add a new Fast Bl ur ef f ect to t he ef f ect s group of t he l ayer
var t he_f x = t he_l ayer("Ef f ect s"). addProper t y("Fast Bl ur");
// set t he parameter val ues
t he_f x. bl urr i ness. set Val ue(10);
t he_f x. repeat EdgePi xel s. set Val ue(t rue);
addedIt = t rue;
}
168
After Effects Scripting Guide Examples
168
}
/ / Ret urn a bool ean sayi ng whet her t he ef f ect was added
ret urn addedIt ;
}
/ / St ar t an undo group. By usi ng t hi s wi t h an endUndoGroup(), you
/ / al l ow users t o undo t he whol e scr i pt wi t h one undo oper at i on.
app. begi nUndoGroup("Appl y Fast Bl ur to Sel ect i ons");
/ / If we don' t f i nd any sel ected l ayers, put up an al er t at t he end.
var numLayersChanged = 0;
/ / Get t he act i ve comp
var act i veItem = app. proj ect . act i veItem;
i f (act i veItem ! = nul l && (act i veItem i nst anceof CompIt em)){
var act i veComp = act i veItem;
/ / t r y to appl y t o ever y sel ected l ayer
var sel ect edLayers = act i veComp. sel ectedLayers;
f or (var i = 0; i < sel ectedLayers. l engt h; i ++) {
var curLayer = sel ectedLayers[i ];
/ / The met hod ret urns t r ue i f i t adds t he ef f ect , f al se ot her wi se.
i f (appl yFast Bl urToLayer(curLayer) == t rue) {
numLayersChanged++;
}
}
}
/ / Pri nt a message i f no l ayers were af f ected
i f (numLayersChanged == 0) {
al er t ("Pl ease sel ect an AV l ayer or l ayers and run scri pt agai n");
}
app. endUndoGroup();
}
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.
{
/ / Thi s scri pt repl aces t ext i n al l t he sel ect ed text l ayers.
/ / It f i nds al l i nst ances of t he word "bl ue" and changes t hem to "monday"
/ / Thi s f unct i on t akes t heSt r i ng and repl aces f i rst Word wi t h secondWord.
/ / It repeat s, so i t wi l l repl ace al l i nst ances of f i rst Word i n t heSt r i ng.
169
After Effects Scripting Guide Examples
169
/ / Ret urns t he changed st ri ng.
f unct i on repl aceText InSt r i ng(t heSt r i ng, f i rst Word, secondWord) {
var newSt r i ng = t heSt ri ng;
whi l e(newSt ri ng. i ndexOf (f i rst Word) ! = -1) {
newSt r i ng = newSt r i ng. repl ace(f i rst Word, secondWord);
}
ret urn newSt r i ng;
}
/ / Thi s f unct i on appl i es t he change to one si ngl e l ayer
f unct i on repl aceText InLayer(t heLayer, f i rst Word, secondWord) {
var changedSomet hi ng = f al se;
/ / Get t he sourceText proper t y, i f t here i s one.
var sourceText = t heLayer. sourceText ;
i f (sourceText ! = nul l ) {
i f (sourceText . numKeys == 0) {
/ / text Val ue i s a Text Document . Ret r i eve t he st r i ng i nsi de
var ol dSt r i ng = sourceText . val ue. t ext ;
i f (ol dSt r i ng. i ndexOf (f i rst Word) ! = -1) {
var newSt r i ng = repl aceText InSt r i ng(ol dSt ri ng, f i rst Word, secondWord);
i f (ol dSt r i ng ! = newSt ri ng) {
sourceText . set Val ue(newSt r i ng);
changedSomet hi ng = t rue;
}
}
} el se {
/ / Do i t f or each keyf r ame:
f or (var keyIndex = 1; keyIndex <= sourceText . numKeys; keyIndex++) {
/ / text Val ue i s a Text Document . Ret r i eve t he st r i ng i nsi de
var ol dSt r i ng = sourceText . keyVal ue(keyIndex). text ;
i f (ol dSt r i ng. i ndexOf (f i rst Word) ! = -1) {
var newSt ri ng = repl aceText InSt ri ng(ol dSt r i ng, f i rst Word, secondWord);
i f (ol dSt r i ng ! = newSt r i ng) {
sourceText . set Val ueAt Key(keyIndex, newSt r i ng);
changedSomet hi ng = t rue;
}
}
}
}
}
/ / Ret urn a bool ean sayi ng whet her we repl aced any t ext
ret urn changedSomet hi ng;
}
/ / St ar t an undo group. By usi ng t hi s wi t h an endUndoGroup(), you
/ / al l ow users t o undo t he whol e scr i pt wi t h one undo oper at i on.
app. begi nUndoGroup("Appl y Text Change to Sel ect i ons");
/ / If we don' t make any changes, we' l l put up an al er t at t he end.
var numLayersChanged = 0;
/ / Get t he act i ve comp
var act i veItem = app. proj ect . act i veItem;
i f (act i veItem ! = nul l && (act i veItem i nst anceof CompIt em)){
170
After Effects Scripting Guide Examples
170
var act i veComp = act i veItem;
/ / t r y to appl y t o ever y sel ected l ayer
var sel ect edLayers = act i veComp. sel ectedLayers;
f or (var i = 0; i < sel ectedLayers. l engt h; i ++) {
var curLayer = sel ectedLayers[i ];
/ / The met hod ret urns t r ue i f i t changes any text , f al se ot her wi se.
i f (repl aceText InLayer(curLayer, "bl ue", "monday") == t rue) {
numLayersChanged++;
}
}
}
/ / Pri nt a message i f no l ayers were af f ected
i f (numLayersChanged == 0) {
/ / Note: i f you put quotes i n t he i nter i or of t he st r i ng,
/ / t hey must be preceded by a backsl ash, as i n \ "bl ue\ " bel ow.
al er t ("Pl ease sel ect a text l ayer or l ayers cont ai ni ng t he word \ "bl ue\ " and run scr i pt agai n");
}
app. endUndoGroup();
}
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
save_and_i ncrement . j sx 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, ! app. proj ect . f i l e, 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 (! app. proj ect . f i l e) {
al er t ("Thi s proj ect must be saved bef ore runni ng t hi s scri pt . ");
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 ast IndexOf () 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.
} el se {
var cur rFi l e = app. proj ect . f i l e;
var cur rFi l eName = currFi l e. name;
var ext Pos = currFi l eName. l ast IndexOf (". ");
var ext = "";
Now we set the currFi l eName variable to the current name, before the dot.
i f (ext Pos ! = -1) {
ext = currFi l eName. subst r i ng(ext Pos, cur rFi l eName. l engt h);
cur rFi l eName = currFi l eName. subst r i ng(0, ext Pos);
171
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 cur rFi l eName. If there is, we assume that the incrementer has run
before, as its job is to assign a 3-digit suffix after an underscore incremented one higher than the last suffix. In
that case we set incrementer to the current numerical string and extract the name without this numerical
extension.
var i ncrementer = 0;
i f (cur rFi l eName. charAt (cur rFi l eName. l engt h - 4) == "_") {
i ncrementer = cur rFi l eName. subst r i ng(currFi l eName. l engt h - 3, cur rFi l eName. l engt h);
cur rFi l eName = currFi l eName. subst r i ng(0, cur rFi l eName. l engt 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 ncrementer++;
var i st r i ng = i ncrementer + "";
i f (i ncrementer < 10) {
i st r i ng = "0" + i st ri ng;
}
i f (i ncrementer < 100) {
i st r i ng = "0" + i st ri ng;
}
Finally we create a new file using our updated name and extension, display an alert letting the user know the
new file name being saved, and save the project with the new file name.
var newFi l e = Fi l e(cur rFi l e. pat h + "/ " + cur rFi l eName + "_" + i st r i ng + ext );
al er t (newFi l e. f sName);
app. proj ect . save(newFi 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 sect i onName and keyName for the preferences file along with a place-
holder value for the string that will be entered by the user.
var sect i onName = "AE Exampl e Scri pt s";
var keyName = "Render comps wi t h t hi s st ri ng";
var searchSt ri ng = "";
i f (app. set t i ngs. haveSet t i ng(sect i onName, keyName)) {
searchSt ri ng = app. set t i ngs. get Set t i ng(sect i onName, keyName);
}
Now we display a prompt to the user asking for what text string we should use.
searchSt ri ng = prompt ("What st r i ng to render?", searchSt r i ng);
172
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 (searchSt ri ng) {
app. set t i ngs. saveSet t i ng(sect i onName, keyName, searchSt r i ng);
searchSt ri ng = searchSt r i ng. t oLowerCase();
f or (i = 1; i <= app. proj ect . numItems; ++i ) {
var curItem = app. proj ect . i tem(i );
i f (curItem i nst anceof CompItem) {
i f (curItem. name. toLowerCase(). i ndexOf (searchSt r i ng) ! = -1) {
app. proj ect . renderQueue. i tems. add(curItem);
}
}
}
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.
app. proj ect . renderQueue. showWi ndow(t rue);
}
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.
var newLocat i on = f ol derGet Di al og("Sel ect a render dest i nat i on. . . ");
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.
i f (newLocat i on) { / / bool ean t o see i f t he user cancel l ed
f or (i = 1; i <= app. proj ect . renderQueue. numItems; ++i ) {
var curItem = app. proj ect . renderQueue. i t em(i );
i f (curItem. st at us == RQItemSt at us. QUEUED) {
f or (j = 1; j <= curItem. numOut put Modul es; ++j ) {
var curOM = curItem. out put Modul e(j );
var ol dLocat i on = curOM. f i l e;
curOM. f i l e = new Fi l e(newLocat i on. toSt r i ng() + "/ " + ol dLocat i on. name);
al er t (curOM. f i l e. f sName);
}
}
}
}
173
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.
var t arget Fol der = f ol derGet Di al og("Impor t Items f rom Fol der. . . ");
/ / ret urns a f ol der or nul l
i f (t arget Fol der) {
f unct i on processFi l e (t heFi l e) {
var i mpor t Opt i ons = new Impor t Opt i ons (t heFi l e);
/ / creat e a var i abl e cont ai ni ng Impor t Opt i ons
i mpor t Saf eWi t hEr ror (i mpor t Opt i ons);
}
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 unct i on t est ForSequence (f i l es){
var searcher = new RegExp ("[0-9]+");
var movi eFi l eSearcher = new RegExp ("(mov| avi | mpg)$", "i ");
var parseResul t s = new Ar ray;
f or (x = 0; (x < f i l es. l engt h) & x < 10; x++) {
/ / test t hat we have a sequence, stop parsi ng af ter 10 f i l es
var movi eFi l eResul t = movi eFi l eSearcher. exec(f i l es[x]. name);
i f (! movi eFi l eResul t ) {
var cur rent Resul t = searcher. exec(f i l es[x]. name);
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 (cur rent Resul t ) {
/ / we have a match - t he st ri ng cont ai ns numbers
/ / t he match of t hose numbers i s st ored i n t he arr ay[1]
/ / t ake t hat number and save i t i nto parseResul t s
parseResul t s[parseResul t s. l engt h] = current Resul t [0];
}
el se {
parseResul t s[parseResul t s. l engt h] = nul l ;
}
}
el se {
parseResul t s[parseResul t s. l engt h] = nul l ;
}
174
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.
var resul t = nul l ;
f or (i = 0; i < parseResul t s. l engt h; ++i ) {
i f (parseResul t s[i ]) {
i f (! resul t ) {
resul t = f i l es[i ];
}
} el se {
/ / case i n whi ch a f i l e name di d not cont ai n a number
resul t = nul l ;
break;
}
}
ret urn resul 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 unct i on i mpor t Saf eWi t hError (i mpor t Opt i ons) {
t r y {
app. proj ect . i mpor t Fi l e (i mpor t Opt i ons);
} catch (er ror) {
al er t (er ror. toSt r i ng() + i mpor t Opt i ons. f i l e. f sName);
}
}
Next comes a function to actually import any image sequence that we discover using testForSequence(),
above. Note that there is an option for forcing alphabetical order in sequences, which is commented out in the
script as written. If you want to force alphabetical order, un-comment the line importOptions.forceAlpha-
betical = true by removing the two slashes at the beginning of that line.
f unct i on processFol der(t heFol der) {
var f i l es = t heFol der. get Fi l es();
/ / Get an ar ray of f i l es i n t he t arget f ol der
/ / test whet her t heFol der cont ai ns a sequence
var sequenceSt ar t Fi l e = test ForSequence(f i l es);
/ / i f i t does cont ai n a sequence, i mpor t t he sequence
i f (sequenceSt ar t Fi l e) {
var i mpor t Opt i ons = new Impor t Opt i ons (sequenceSt ar t Fi l e);
/ / creat e a var i abl e cont ai ni ng Impor t Opt i ons
i mpor t Opt i ons. sequence = t rue;
/ / i mpor t Opt i ons. f orceAl phabet i cal = t rue;
/ / un-comment t hi s i f you want to f orce al pha order by def aul t
i mpor t Saf eWi t hEr ror (i mpor t Opt i ons);
}
/ / ot her wi se, i mpor t t he f i l es and recurse
f or (i ndex i n f i l es) {
/ / Go t hrough t he arr ay, set each el ement to si ngl eFi l e, r un t hi s:
175
After Effects Scripting Guide Examples
175
i f (f i l es[i ndex] i nst anceof Fi l e) {
i f (! sequenceSt ar t Fi l e) {
/ / i f f i l e i s al ready par t of a sequence, don' t i mpor t i t i ndi vi dual l y
processFi l e (f i l es[i ndex]);
/ / cal l s t he processFi l e f unct i on above
}
}
i f (f i l es[i ndex] i nst anceof Fol der) {
processFol der (f i l es[i ndex]); / / recursi on
}
}
}
processFol der(t arget Fol der);
}
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.
{
var saf eToRunScr i pt = t rue;
saf eToRunScr i pt = app. proj ect ! = nul l ;
i f (! app. proj ect ) {
al er t ("A proj ect must be open to run t hi s scri pt . ");
}
i f (saf eToRunScr i pt ) {
debugger ;
/ / check t he render queue and make cer t ai n at l east one i t em i s queued
saf eToRunScr i pt = f al se;
f or (i = 1; i <= app. proj ect . renderQueue. numItems; ++i ) {
i f (app. proj ect . renderQueue. i tem(i ). st at us == RQIt emSt at us. QUEUED) {
saf eToRunScr i pt = t rue;
break;
}
}
i f (! saf eToRunScr i pt ) {
al er t ("You do not have any i t ems set 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 emai l _set up. j sx 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 (saf eToRunScr i pt ) {
var set t i ngs = app. set t i ngs;
176
After Effects Scripting Guide Examples
176
i f ( ! set t i ngs. haveSet t i ng("Emai l Set t i ngs", "Mai l Ser ver") | |
! set t i ngs. haveSet t i ng("Emai l Set t i ngs", "Repl y-to Address") | |
! set t i ngs. haveSet t i ng("Emai l Set t i ngs", "Render Repor t Reci pi ent ")){
/ / We don' t have t he set t i ngs yet , so r un emai l _set up. j sx
/ / to prompt f or t hem
var emai l _set upf i l e = new Fi l e("emai l _set up. j sx");
emai l _set upf i l e. open("r");
eval ( emai l _set upf i l e. read() );
emai l _set upf i l e. cl ose();
}
var myQueue = app. proj ect . renderQueue; / / creates a shor tcut f or 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.
myQueue. render();
var proj ect Name = "Unsaved Proj ect ";
i f (app. proj ect . f i l e) {
proj ect Name = app. proj ect . f i l e. name;
}
var myMessage = "Render i ng of " + proj ect Name + " i s compl ete. \ 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 ( ! set t i ngs. haveSet t i ng("Emai l Set t i ngs", "Mai l Ser ver") | |
! set t i ngs. haveSet t i ng("Emai l Set t i ngs", "Repl y-to Address") | |
! set t i ngs. haveSet t i ng("Emai l Set t i ngs", "Render Repor t Reci pi ent ")){
al er t ("Can' t send an emai l , I don' t have al l t he set t i ngs I need. Abor t i ng. ");
} el se {
/ / Load code f rom a f i l e wi t h handy emai l i ng met hods:
var emai l CodeFi l e = new Fi l e("emai l _met hods. j sx");
emai l CodeFi l e. open("r");
eval ( emai l CodeFi l e. read() );
emai l CodeFi l e. cl ose();
Finally, we send an error if for any reason we are unable to send the mail.
var ser verSet t i ng = set t i ngs. get Set t i ng("Emai l Set t i ngs", "Mai l Ser ver");
var f romSet t i ng = set t i ngs. get Set t i ng("Emai l Set t i ngs", "Repl y-to Address");
var toSet t i ng = set t i ngs. get Set t i ng("Emai l Set t i ngs", "Render Repor t Reci pi ent ");
var myMai l = new Emai l Socket (ser verSet t i ng);
i f (! myMai l . send (f romSet t i ng, toSet t i ng, "AE Render Compl et ed", myMessage) ) {
al er t ("Sendi ng mai l f ai l ed");
}
}
}
}
177
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.
/ / Creat e an emai l obj ect . The f unct i on may be cal l ed bot h
/ / as a gl obal f unct i on and as a const ructor. It t akes t he
/ / name of t he emai l ser ver, and an opt i onal Bool ean t hat ,
/ / i f t rue, pr i nt s debuggi ng messages.
/ / Thi s obj ect i s not guarant eed to work f or al l SMTP ser vers,
/ / some of t hem may requi re a di f f erent set of commands.
/ / f unct i ons:
/ / send (f romAddress, toAddress, subj ect , text ) - send an emai l
/ / aut h (name, pass) - do an aut hor i zat i on vi a POP3
/ / bot h f unct i ons ret ur n f al se on er rors
/ / sampl e:
/ / e = new Emai l Socket ("mai l . host . com");
/ / aut hor i ze vi a POP3 (not al l ser vers requi re aut hori zat i on)
/ / e. aut h ("myname", "mypass");
/ / send t he emai l
/ / e. send ("me@my. com", "you@you. com", "My Subj ect ", "Hi t here! ")
/ / Thi s scri pt makes use of t he Socket obj ect , and creates a new cl ass
/ / cal l ed Emai l Socket t hat i s der i ved f rom Socket . For more i nf ormat i on on
/ / creat i ng new cl asses i n t hi s way, consul t chapter 7 of JavaScr i pt , The
/ / Def i ni t i ve Gui de, by Davi d Fl anagan (O' Rei l l y).
/ / Thi s i s t he const ructor f or t he emai l socket . It t akes as argument s:
/ / ser ver - t he address of t he emai l ser ver (i s not checked f or val i di t y here)
/ / dbg - a bool ean, i f t rue, pri nt s addi t i onal er ror i nf ormat i on
f unct i on Emai l Socket (ser ver, dbg) {
var obj = new Socket ;
obj . _host = ser ver ;
obj . _debug = (dbg == t r ue);
obj . __proto__ = Emai l Socket . protot ype;
ret urn obj ;
}
/ / cor rect t he protoype chai n t o poi nt to t he Socket protot ype chai n
/ / - t hi s i s what act ual l y caus es t he der i vat i on f rom Socket .
Emai l Socket . protot ype. __prot o__ = Socket . protot ype;
/ / Thi s set s up t he send() member f unct i on. send() t akes as argument s:
/ / f rom - t he emai l address of t he sender. Thi s i s not val i dat ed.
/ / to - t he emai l address of t he reci pi ent . If t here i s an er ror,
/ / and t he f rom address i s i ncor rect , you wi l l not be not i f i ed.
/ / subj ect - t he content s of t he subj ect f i el d.
/ / text - t he body of t he message.
178
After Effects Scripting Guide Examples
178
/ /
/ / Ret urns t rue i f sendi ng succeeded, f al se ot her wi se (i f t here was an er ror)
/ /
/ / Note t hat t hi s code uses a l ocal f unct i on obj ect to create
/ / t he f unct i on t hat i s assi gned to send.
Emai l Socket . protot ype. send = f unct i on (f rom, to, subj ect , text ) {
/ / open t he socket on por t 25 (SMTP)
i f (! t hi s. open (t hi s. _host + ": 25"))
ret urn f al se;
t r y {
/ / di scard t he greet i ng
var greet i ng = t hi s. read();
i f (t hi s. _debug)
wr i t e ("RECV: " + greet i ng);
/ / i ssue EHLO and ot her commands
t hi s. _SMTP ("EHLO " + f rom);
t hi s. _SMTP ("MAIL FROM: " + f rom);
t hi s. _SMTP ("RCPT TO: " + to);
t hi s. _SMTP ("DATA");
/ / send subj ect and t i me st amp
t hi s. wri tel n ("From: " + f rom);
t hi s. wri tel n ("To: " + to);
t hi s. wri tel n ("Dat e: " + new Date(). toSt r i ng());
i f (t ypeof subj ect ! = undef i ned)
t hi s. wri tel n ("Subj ect : " + subj ect );
t hi s. wri tel n();
/ / send t he text
i f (t ypeof text ! = undef i ned)
t hi s. wri tel n (text );
/ / termi nate wi t h a si ngl e dot and wai t f or response
t hi s. _SMTP (". ");
/ / termi nate t he sessi on
t hi s. _SMTP ("QUI T");
t hi s. cl ose();
ret urn t rue;
}
cat ch (e) {
t hi s. cl ose();
ret urn f al se;
}
}
/ / Aut hori ze vi a POP3. Suppl y name and password.
/ / Ret urns t rue i f sendi ng succeeded, f al se ot her wi se (i f t here was an er ror)
/ / Argument s:
/ / name - t he userName of t he account
/ / pass - t he password
Emai l Socket . protot ype. aut h = f unct i on (name, pass) {
/ / open t he connect i on on por t 110 (POP3)
179
After Effects Scripting Guide Examples
179
i f (! t hi s. open (t hi s. _host + ": 110"))
ret urn f al se;
t r y {
/ / di scard t he greet i ng
var greet i ng = t hi s. read();
i f (t hi s. _debug)
wr i t e ("RECV: " + greet i ng);
/ / i ssue POP3 commands
t hi s. _POP3 ("USER " + name);
t hi s. _POP3 ("PASS " + pass);
t hi s. _POP3 ("QUI T");
t hi s. cl ose();
ret urn t rue;
}
cat ch (e) {
t hi s. cl ose();
ret urn f al se;
}
}
/ / Users of t he Emai l Socket do not need to be concerned wi t h
/ / t he f ol l owi ng met hod. It i s an i mpl ement at i on hel per.
/ / l ocal f unct i on to send a command & check a POP3 repl y
/ / t hrows i n case of er ror
Emai l Socket . protot ype. _POP3 = f unct i on (cmd) {
i f (t hi s. _debug)
wr i t el n ("SEND: " + cmd);
i f (! t hi s. wr i t el n (cmd))
t hrow "Er ror";
var repl y = t hi s. read();
i f (t hi s. _debug)
wr i t e ("RECV: " + repl y);
/ / t he repl y st ar t s by ei t her + or -
i f (repl y [0] == "+")
ret urn;
t hrow "Er ror";
}
/ / Users of t he Emai l Socket do not need to be concerned wi t h
/ / t he f ol l owi ng met hod. It i s an i mpl ement at i on hel per.
/ / l ocal f unct i on to send a command & check a SMTP repl y
/ / t hrows i n case of er ror
Emai l Socket . protot ype. _SMTP = f unct i on (cmd) {
i f (t hi s. _debug)
wr i t el n ("SEND: " + cmd);
i f (! t hi s. wr i t el n (cmd))
t hrow "Er ror";
var repl y = t hi s. read();
i f (t hi s. _debug)
180
After Effects Scripting Guide Examples
180
wr i t e ("RECV: " + repl y);
/ / t he repl y i s a t hree-di gi t code f ol l owed by a space
var match = repl y. mat ch (/^(\ d{3})\ s/ m);
i f (match. l engt h == 2) {
var n = Number (match [1]);
i f (n >= 200 && n <= 399)
ret urn;
}
t hrow "Er ror";
}
/ / ni ce to have: a toSt r i ng()
/ / Thi s f unct i on al l ows t he emai l obj ect t o be pri nt ed.
Emai l Socket . protot ype. toSt r i ng = f unct i on() {
ret urn "[obj ect Emai 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 emai l _set up. j sx 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).
{
/ / Thi s scri pt set s up 3 emai l set t i ngs.
/ / It can be run al l by i t sel f , but i t i s al so cal l ed
/ / wi t hi n "3-Render and Mai l . j sx" i f t he set t i ngs aren' t yet set .
var ser verVal ue = prompt ("Enter name of mai l ser ver : ");
var f romVal ue = prompt ("Enter repl y-t o emai l address: ");
var toVal ue = prompt ("Ent er reci pi ent ' s emai l address");
i f (ser verVal ue ! = nul l && ser verVal ue ! = "") {
app. set t i ngs. saveSet t i ng("Emai l Set t i ngs", "Mai l Ser ver", ser verVal ue);
}
i f (f romVal ue ! = nul l && f romVal ue ! = "") {
app. set t i ngs. saveSet t i ng("Emai l Set t i ngs", "Repl y-to Address", f romVal ue);
}
i f (toVal ue ! = nul l && t oVal ue ! = "") {
app. set t i ngs. saveSet t i ng("Emai l Set t i ngs", "Render Repor t Reci pi ent ", toVal ue);
}
}
181
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 conf i rm() to l et t he user t el l us whet her he can see t he "i nf o" wi ndow.
/ / Dependi ng how t he user cl i cks , t r ue or f al se i s ret urned.
i f (conf i rm("Can you see t he Inf o panel ?")){
/ / St ar t by cl ear i ng t he i nf ormat i on area.
cl earOut put ();
/ / wr i t e and wr i teLn wr i te to t he Inf o panel wi t h or wi t hout a newl i ne at t he end.
wr i t e("Roses are red, ");
wr i t eLn("vi ol et s are bl ue");
wr i t e("Sugar i s sweet , ");
wr i t eLn("and so i s Equal . ");
var repl y = prompt ( "Di d you l i ke my poem?");
i f (repl y == "yes" | | repl y == "YES"){
al er t ("See t he Inf o panel f or a speci al secret f or t une. ");
/ / Thi s get s r i d of t he ol d wr i t i ng on t he i nf o t ab.
cl earOut put ();
wr i t eLn("You have a f ut ure as a l i terar y cr i t i c. ");
}
el se {
al er t ("Hmm, I ' l l t r y once more. . . ");
wr i t eLn(". . . . . . . ");
wr i t eLn("Roses are red, vi ol et s are bl ue, ");
wr i t eLn("I' ve got some gum, on t he sol e of my shoe. ");
}
al er t ("Okay, al l done wi t h t hi s t est . ");
}
el se {
/ / al er t () j ust di spl ays a message i n a di al og box.
al er t ("Bri ng up t he Inf o panel and run t hi s scr i pt agai n");
}
182
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 appli-
cation preference Allow Scripts to Write Files and Access Network must be set.
/ / Fi rst , cl ose any proj ect t hat mi ght be open.
i f (app. proj ect ! = nul l ){
/ / 3 choi ces here, Cl oseOpt i ons. DO_NOT_SAVE_CHANGES,
/ / Cl oseOpt i ons. PROMPT_TO_SAVE_CHANGES, and Cl oseOpt i ons. SAVE_CHANGES
app. proj ect . cl ose(Cl oseOpt i ons. DO_NOT_SAVE_CHANGES);
}
/ / Prompt t he user to pi ck a proj ect f i l e:
/ / Fi rst argument i s a prompt , second i s t he f i l e t ype.
var pf i l e = f i l eGet Di al og("Sel ect a proj ect f i l e to open", "EggP aep");
i f (pf i l e == nul l ){
al er t ("No proj ect f i l e sel ected. Abor t i ng. ");
} el se {
/ / Open t hat f i l e. It becomes t he current proj ect .
var my_proj ect = app. open( pf i l e );
/ / Bui l d a def aul t text f i l e name f rom t he proj ect ' s f i l ename.
/ / Remove t he ". aep" f i l e ext ensi on (i f present ), t hen add
/ / _compnames. t xt .
var def aul t _t ext _f i l ename;
var suf f i x_i ndex = pf i l e. name. l ast IndexOf (". aep");
i f (suf f i x_i ndex ! = -1){
def aul t _t ext _f i l ename = pf i l e. name. subst r i ng(0, suf f i x_i ndex);
} el se {
def aul t _t ext _f i l ename = pf i l e. name;
}
def aul t _t ext _f i l ename += "_compnames. t xt ";
/ / Creat e anot her f i l e obj ect f or t he f i l e we' l l wr i t e out .
/ / Fi rst argument i s t he prompt , second i s a def aul t f i l e name, t hi rd i s
/ / t he f i l e t ype.
var t ext _f i l e = f i l ePut Di al og("Sel ect a f i l e t o out put your resul t s", def aul t _text _f i l ename, "TEXT t xt ");
i f (t ext _f i l e == nul l ){
al er t ("No out put f i l e sel ected. Abor t i ng. ");
} el se {
/ / opens f i l e f or wr i t i ng. Fi rst argument i s mode ("w" f or wr i t i ng),
/ / second argument i s f i l e t ype (f or mac onl y),
/ / t hi rd argument i s creat or (mac onl y, "????" i s no speci f i c app).
text _f i l e. open("w", "TEXT", "????");
/ / Wr i t e t he headi ng of t he f i l e:
text _f i l e. wr i t el n("Here i s a l i st of al l t he comps i n " + pf i l e. name);
text _f i l e. wr i t el n();
f or (var i = 1; i <= app. proj ect . numItems; i ++){
i f (app. proj ect . i tem(i ) i nst anceof CompItem){
text _f i l e. wr i t el n(app. proj ect . i tem(i ). name);
183
After Effects Scripting Guide Examples
183
}
}
text _f i l e. cl ose();
al er t ("Al l done! ");
}
}
184
After Effects Object Summary
This code dump summarizes all public JavaScript objects (instantiable classes) and enumerated types defined
for After Effects 7.0.
=======================================================================
Al phaMode enum
--------------------------------------------------------------------------
Al phaMode. IGNORE
Al phaMode. PREMULTIPLI ED
Al phaMode. STRAIGHT
=======================================================================
Appl i cat i on obj ect
--------------------------------------------------------------------------
act i vate() no ret urn
begi nSuppressDi al ogs() no ret urn
begi nUndoGroup(st ri ng undoName) no ret ur n
bui l dName : st ri ng : readOnl y
bui l dNumber : i nteger : readOnl y
cancel Task(i nt eger t askID) no ret urn
endSuppressDi al ogs(bool ean showAl er t ) no ret urn
endUndoGroup() no ret urn
endWat chFol der() no ret urn
exi t Af terLaunchAndEval : bool ean : read/ wr i te
exi t Code : i nt eger : read/ wr i te
i sProf essi onal Versi on : bool ean : readOnl y
i sRenderEngi ne : bool ean : readOnl y
i sUI Suppressed : bool ean : readOnl y
i sWatchFol der : bool ean : readOnl y
l anguage : Language : readOnl y
newProj ect () no ret ur n
open([Fi l e f i l e]) ret urns Proj ect
pauseWatchFol der(bool ean doPause) no ret ur n
proj ect : Proj ect : readOnl y
purge(PurgeTarget t arget ) no ret urn
qui t () no ret urn
regi steredCompany : st r i ng : readOnl y
regi steredName : st r i ng : readOnl y
saveProj ect OnCrash : bool ean : read/ wr i te
schedul eTask(st r i ngToExecute, f l oat del ay, bool ean repeat ) ret urns t askID
ser i al Number : st r i ng : readOnl y
set Memor yUsageLi mi t s(f l oat i mageCachePercent , f l oat maxi mumMemor yPercent ) no ret urn
set SavePref erencesOnQui t (bool ean doSave) no ret urn
set t i ngs : Set t i ngs : readOnl y
versi on : st r i ng : readOnl y
185
After Effects Scripting Guide After Effects Object Summary
185
watchFol der(Fi l e f i l e) no ret urn
onEr ror(st r i ng errorSt r i ng, st r i ng sever i t y) no ret ur n
======================================================================
AVLayer obj ect
subcl ass of Layer
--------------------------------------------------------------------------
(i nteger proper t yIndex) ret urns Proper t yBase
(st ri ng proper t yName) ret urns Proper t yBase
act i ve : bool ean : readOnl y
act i veAt Ti me(f l oat at Ti me) ret urns bool ean
addProper t y(st r i ng proper t yName) ret urns Proper t yBase
adj ust ment Layer : bool ean : read/ wri te
appl yPreset (Fi l e preset Name) no ret urn
audi oAct i ve : bool ean : readOnl y
audi oAct i veAt Ti me(f l oat at Ti me) ret ur ns bool ean
audi oEnabl ed : bool ean : read/ wr i t e
bl endi ngMode : Bl endi ngMode : read/ wr i te
canAddProper t y(st r i ng proper t yName) ret urns bool ean
canSet Col l apseTr ansf ormat i on : bool ean : readOnl y
canSet Enabl ed : bool ean : readOnl y
canSet Ti meRemapEnabl ed : bool ean : readOnl y
col l apseTransf ormat i on : bool ean : read/ wr i te
comment : st r i ng : read/wr i te
cont ai ni ngComp : CompIt em : readOnl y
copyToComp(CompItem i ntoComp) no ret urn
dupl i cat e() ret ur ns AVLayer
ef f ect sAct i ve : bool ean : read/ wr i t e
el i ded : bool ean : readOnl y
enabl ed : bool ean : read/ wr i te
f rameBl endi ng : bool ean : read/ wr i te
gui deLayer : bool ean : read/ wr i te
hasAudi o : bool ean : readOnl y
hasTrackMat te : bool ean : readOnl y
hasVi deo : bool ean : readOnl y
hei ght : f l oat : readOnl y
i nPoi nt : f l oat : read/ wr i te
i ndex : i nteger : readOnl y
i sEf f ect : bool ean : readOnl y
i sMask : bool ean : readOnl y
i sModi f i ed : bool ean : readOnl y
i sNameFromSource : bool ean : readOnl y
i sNameSet : bool ean : readOnl y
i sTrackMat te : bool ean : readOnl y
l ocked : bool ean : read/ wr i te
matchName : st r i ng : readOnl y
mot i onBl ur : bool ean : read/ wri te
moveAf t er(Layer ot herLayer) no ret urn
moveBef ore(Layer ot herLayer) no ret urn
moveTo(i nteger i ndex) no ret urn
moveToBegi nni ng() no ret urn
moveToEnd() no ret urn
186
After Effects Scripting Guide After Effects Object Summary
186
name : st r i ng : read/ wr i te
nul l Layer : bool ean : readOnl y
numProper t i es : i nteger : readOnl y
out Poi nt : f l oat : read/ wr i te
parent : Layer : read/ wr i t e
parent Proper t y : Proper t yGroup : readOnl y
preser veTransparency : bool ean : read/ wri te
proper t y(i nteger proper t yIndex) ret urns Proper t yBase
proper t y(st r i ng proper t yName) ret urns Proper t yBase
proper t yDept h : i nteger : readOnl y
proper t yGroup([i nteger count Up]) ret urns Proper t yGroup
proper t yType : Proper t yType : readOnl y
qual i t y : LayerQual i t y : read/ wr i te
remove() no ret urn
sel ect ed : bool ean : read/ wri te
sel ect edProper t i es : Arr ay of Proper t yBase: readOnl y
set Parent Wi t hJump(Layer newParent ) no ret urn
shy : bool ean : read/ wri te
sol o : bool ean : read/ wr i t e
source : AVItem : readOnl y
st ar t Ti me : f l oat : read/ wri te
st ret ch : f l oat : read/ wr i te
t hreeDLayer : bool ean : read/ wr i te
t i me : f l oat : readOnl y
t i meRemapEnabl ed : bool ean : read/ wr i t e
t r ackMat teType : TrackMat teType : read/ wr i te
wi dt h : f l oat : readOnl y
=======================================================================
Bl endi ngMode enum
--------------------------------------------------------------------------
Bl endi ngMode. ADD
Bl endi ngMode. ALPHA_ADD
Bl endi ngMode. CLASSI C_COLOR_BURN
Bl endi ngMode. CLASSI C_COLOR_DODGE
Bl endi ngMode. CLASSI C_DI FFERENCE
Bl endi ngMode. COLOR
Bl endi ngMode. COLOR_BURN
Bl endi ngMode. COLOR_DODGE
Bl endi ngMode. DANCI NG_DI SSOLVE
Bl endi ngMode. DARKEN
Bl endi ngMode. DI FFERENCE
Bl endi ngMode. DI SSOLVE
Bl endi ngMode. EXCLUSI ON
Bl endi ngMode. HARD_LI GHT
Bl endi ngMode. HARD_MI X
Bl endi ngMode. HUE
Bl endi ngMode. LI GHTEN
Bl endi ngMode. LI NEAR_BURN
Bl endi ngMode. LI NEAR_DODGE
Bl endi ngMode. LI NEAR_LI GHT
Bl endi ngMode. LUMI NESCENT_PREMUL
187
After Effects Scripting Guide After Effects Object Summary
187
Bl endi ngMode. LUMI NOSI TY
Bl endi ngMode. MULTI PLY
Bl endi ngMode. NORMAL
Bl endi ngMode. OVERLAY
Bl endi ngMode. PI N_LI GHT
Bl endi ngMode. SATURATI ON
Bl endi ngMode. SCREEN
Bl endi ngMode. SILHOUETE_ALPHA
Bl endi ngMode. SI LHOUETTE_LUMA
Bl endi ngMode. SOFT_LI GHT
Bl endi ngMode. STENCI L_ALPHA
Bl endi ngMode. STENCI L_LUMA
Bl endi ngMode. VIVID_LIGHT
=======================================================================
CameraLayer obj ect (subcl ass of Layer, no own met hods or at t ri bues)
--------------------------------------------------------------------------
=======================================================================
Cl oseOpt i ons enum
--------------------------------------------------------------------------
Cl oseOpt i ons. DO_NOT_SAVE_CHANGES
Cl oseOpt i ons. PROMPT_TO_SAVE_CHANGES
Cl oseOpt i ons. SAVE_CHANGES
=======================================================================
CompIt em obj ect (i nher i t s f rom Item and AVIt em, whi ch are not i nst ant i abl e)
--------------------------------------------------------------------------
act i veCamera : Layer : readOnl y
bgCol or : Ar ray of f l oat : read/ wri te
comment : st r i ng : read/wr i te
di spl aySt ar t Ti me : f l oat : read/ wri te
draf t 3d : bool ean : read/ wr i te
dupl i cat e() ret ur ns CompItem
durat i on : f l oat : read/ wr i te
f oot ageMi ssi ng : bool ean : readOnl y
f rameBl endi ng : bool ean : read/ wr i te
f rameDurat i on : f l oat : read/ wri te
f rameRate : f l oat : read/ wri te
hasAudi o : bool ean : readOnl y
hasVi deo : bool ean : readOnl y
hei ght : i nt eger : read/ wri t e
hi deShyLayers : bool ean : read/ wri te
i d : i nteger : readOnl y
l ayer(i nt eger l ayerIndex) ret urns Layer
l ayer(st r i ng l ayerName) ret urns Layer
l ayer(Layer ot herLayer, i nteger rel at i veIndex) ret urns Layer
l ayers : LayerCol l ect i on: readOnl y
mot i onBl ur : bool ean : read/ wri te
name : st r i ng : read/ wr i te
numLayers : i nteger : readOnl y
parent Fol der : Fol derItem : read/ wr i te
pi xel Aspect : f l oat : read/ wr i te
preser veNestedFrameRate : bool ean : read/ wr i te
188
After Effects Scripting Guide After Effects Object Summary
188
preser veNestedResol ut i on : bool ean : read/ wr i te
proxySource : Foot ageSource : readOnl y
remove() no ret urn
renderer : st r i ng : read/ wr i te
renderers : Ar ray of st r i ng: readOnl y
resol ut i onFactor : Arr ay of i nteger : read/ wr i te
sel ect ed : bool ean : read/ wri te
sel ect edLayers : Arr ay of Layer : readOnl y
sel ect edProper t i es : Arr ay of Proper t yBase: readOnl y
set Proxy(Fi l e proxyFi l e) no ret urn
set ProxyToNone() no ret urn
set ProxyWi t hPl acehol der(st r i ng name, i nteger wi dt h, i nt eger hei ght , f l oat f rameRate, f l oat dur at i on)
no ret ur n
set ProxyWi t hSequence(Fi l e proxyFi l e, bool ean f orceAl phabet i cal ) no ret urn
set ProxyWi t hSol i d(Ar rayOf Fl oat col or, st r i ng name, i nteger wi dt h, i nteger hei ght ,
f l oat pi xel Aspect Rat i o) no ret urn
shut terAngl e : i nteger : read/ wri te
shut terPhase : i nteger : read/ wr i te
t i me : f l oat : read/ wr i te
t ypeName : st ri ng : readOnl y
useProxy : bool ean : read/ wr i te
usedIn : Ar ray of CompItem : readOnl y
wi dt h : i nt eger : read/ wr i te
workAreaDurat i on : f l oat : read/ wr i te
workAreaSt ar t : f l oat : read/ wr i te
=======================================================================
Fi el dSepar at i onType enum
--------------------------------------------------------------------------
Fi el dSepar at i onType. LOWER_FIELD_FIRST
Fi el dSepar at i onType. OFF
Fi el dSepar at i onType. UPPER_FI ELD_FI RST
=======================================================================
Fi l eSource obj ect
--------------------------------------------------------------------------
al phaMode : Al phaMode : read/ wri te
conf or mFrameRate : f l oat : read/ wri te
di spl ayFrameRate : f l oat : readOnl y
f i el dSeparat i onType : Fi el dSeparat i onType : readOnl y
f i l e : Fi l e : readOnl y
guessAl phaMode() no ret urn
guessPul l down(Pul l downMet hod pul l downMet hod) no ret urn
hasAl pha : bool ean : readOnl y
hi ghQual i t yFi el dSeparat i on : bool ean : read/ wr i t e
i nver t Al pha : bool ean : read/ wr i te
i sSt i l l : bool ean : readOnl y
l oop : i nteger : read/ wri te
mi ssi ngFoot agePat h : st r i ng : readOnl y
nat i veFrameRate : f l oat : readOnl y
premul Col or : Ar r ay of f l oat : read/ wr i t e
rel oad() no ret urn
removePul l down : Pul l downPhase : readOnl y
189
After Effects Scripting Guide After Effects Object Summary
189
=======================================================================
Fol derItem obj ect (i nher i t s f rom It em, whi ch i s not i nst ant i abl e)
--------------------------------------------------------------------------
comment : st r i ng : read/wr i te
i d : i nteger : readOnl y
i tem(i nteger i temIndex) ret urns It em
i tems : ItemCol l ect i on : readOnl y
name : st r i ng : read/ wr i te
numIt ems : i nt eger : readOnl y
parent Fol der : Fol derItem : read/ wr i te
remove() no ret urn
sel ect ed : bool ean : read/ wri te
t ypeName : st ri ng : readOnl y
=======================================================================
Foot ageItem obj ect (i nheri t s f rom Item, AVIt em, and Foot ageSource, whi ch are not i nst ant i abl e)
--------------------------------------------------------------------------
comment : st r i ng : read/wr i te
durat i on : f l oat : readOnl y
f i l e : Fi l e : readOnl y
f oot ageMi ssi ng : bool ean : readOnl y
f rameDurat i on : f l oat : readOnl y
f rameRate : f l oat : readOnl y
hasAudi o : bool ean : readOnl y
hasVi deo : bool ean : readOnl y
hei ght : i nt eger : read/ wri t e
i d : i nteger : readOnl y
mai nSource : Foot ageSource : readOnl y
name : st r i ng : read/ wr i te
parent Fol der : Fol derItem : read/ wr i te
pi xel Aspect : f l oat : read/ wr i te
proxySource : Foot ageSource : readOnl y
remove() no ret urn
repl ace(Fi l e proxyFi l e) no ret urn
repl aceWi t hPl acehol der(st ri ng name, i nt eger wi dt h, i nteger hei ght , f l oat f r ameRat e, f l oat durat i on)
no ret ur n
repl aceWi t hSequence(Fi l e proxyFi l e, bool ean f orceAl phabet i cal ) no ret urn
repl aceWi t hSol i d(Ar rayOf Fl oat col or, st r i ng name, i nt eger wi dt h, i nteger hei ght , f l oat pi xel Aspect Rat i o)
no ret ur n
sel ect ed : bool ean : read/ wri te
set Proxy(Fi l e proxyFi l e) no ret urn
set ProxyToNone() no ret urn
set ProxyWi t hPl acehol der(st r i ng name, i nteger wi dt h, i nt eger hei ght , f l oat f rameRate, f l oat dur at i on)
no ret ur n
set ProxyWi t hSequence(Fi l e proxyFi l e, bool ean f orceAl phabet i cal ) no ret urn
set ProxyWi t hSol i d(Ar rayOf Fl oat col or, st r i ng name, i nteger wi dt h, i nteger hei ght ,
f l oat pi xel Aspect Rat i o) no ret urn
t i me : f l oat : readOnl y
t ypeName : st ri ng : readOnl y
useProxy : bool ean : read/ wr i te
usedIn : Ar ray of CompItem : readOnl y
wi dt h : i nt eger : read/ wr i te
190
After Effects Scripting Guide After Effects Object Summary
190
=======================================================================
Impor t AsType enum
--------------------------------------------------------------------------
Impor t AsType. COMP
Impor t AsType. COMP_CROPPED_LAYERS
Impor t AsType. FOOTAGE
Impor t AsType. PROJ ECT
=======================================================================
Impor t Opt i ons obj ect
--------------------------------------------------------------------------
new Impor t Opt i ons(Fi l e f i l eToImpor t ) ret urns Impor t Opt i ons
canImpor t As(Impor t AsType asType) ret urns bool ean
f i l e : Fi l e : read/ wr i te
f orceAl phabet i cal : bool ean : read/ wr i te
i mpor t As : Impor t AsType : read/ wr i t e
sequence : bool ean : read/ wr i te
=======================================================================
ItemCol l ect i on obj ect
--------------------------------------------------------------------------
addComp(st ri ng name, i nt eger wi dt h, i nteger hei ght , f l oat pi xel Aspect Rat i o, f l oat dur at i on,
f l oat f r ameRate) ret ur ns CompItem
addFol der(st r i ng name) ret urns Fol derItem
=======================================================================
Keyf r ameEase obj ect
--------------------------------------------------------------------------
new Keyf rameEase(f l oat speed, f l oat i nf l uence) ret urns Keyf rameEase
i nf l uence : f l oat : read/ wr i te
speed : f l oat : read/ wr i te
=======================================================================
Keyf r ameInt erpol at i onType enum
--------------------------------------------------------------------------
Keyf r ameInt erpol at i onType. BEZIER
Keyf r ameInt erpol at i onType. HOLD
Keyf r ameInt erpol at i onType. LINEAR
=======================================================================
Language enum
--------------------------------------------------------------------------
Language. ENGLI SH
Language. FRENCH
Language. GERMAN
Language. JAPANESE
=======================================================================
Layer obj ect (not i nst ant i abl e, but base cl ass of CameraLayer and Li ght Layer)
--------------------------------------------------------------------------
i nteger proper t yIndex) ret urns Proper t yBase
st r i ng proper t yName) ret urns Proper t yBase
act i ve : bool ean : readOnl y
act i veAt Ti me(f l oat at Ti me) ret urns bool ean
addProper t y(st r i ng proper t yName) ret urns Proper t yBase
appl yPreset (FIl e preset Name) no ret urn
canAddProper t y(st r i ng proper t yName) ret urns bool ean
191
After Effects Scripting Guide After Effects Object Summary
191
canSet Enabl ed : bool ean : readOnl y
comment : st r i ng : read/wr i te
cont ai ni ngComp : CompIt em : readOnl y
copyToComp(CompItem i ntoComp) no ret urn
dupl i cat e() ret ur ns Camer aLayer
el i ded : bool ean : readOnl y
enabl ed : bool ean : read/ wr i te
hasVi deo : bool ean : readOnl y
i nPoi nt : f l oat : read/ wr i te
i ndex : i nteger : readOnl y
i sEf f ect : bool ean : readOnl y
i sMask : bool ean : readOnl y
i sModi f i ed : bool ean : readOnl y
i sNameSet : bool ean : readOnl y
l ocked : bool ean : read/ wr i te
matchName : st r i ng : readOnl y
moveAf t er(Layer ot herLayer) no ret urn
moveBef ore(Layer ot herLayer) no ret urn
moveTo(i nteger i ndex) no ret urn
moveToBegi nni ng() no ret urn
moveToEnd() no ret urn
name : st r i ng : read/ wr i te
nul l Layer : bool ean : readOnl y
numProper t i es : i nteger : readOnl y
out Poi nt : f l oat : read/ wr i te
parent : Layer : read/ wr i t e
parent Proper t y : Proper t yGroup : readOnl y
proper t y(i nteger proper t yIndex) ret urns Proper t yBase
proper t y(st r i ng proper t yName) ret urns Proper t yBase
proper t yDept h : i nteger : readOnl y
proper t yGroup([i nteger count Up]) ret urns Proper t yGroup
proper t yType : Proper t yType : readOnl y
remove() no ret urn
sel ect ed : bool ean : read/ wri te
sel ect edProper t i es : Arr ay of Proper t yBase: readOnl y
set Parent Wi t hJump(Layer newParent ) no ret urn
shy : bool ean : read/ wri te
sol o : bool ean : read/ wr i t e
st ar t Ti me : f l oat : read/ wri te
st ret ch : f l oat : read/ wr i te
t i me : f l oat : readOnl y
=======================================================================
LayerCol l ect i on obj ect
--------------------------------------------------------------------------
add(AVItem t heItem,
[f l oat durat i on]) ret ur ns AVLayer
addCamer a(st ri ng name, Ar rayOf Fl oat cent erPoi nt ) ret urns CameraLayer
addLi ght (st r i ng name, Arr ayOf Fl oat centerPoi nt ) ret urns Li ght Layer
addNul l ([f l oat dur at i on]) ret urns AVLayer
addSol i d(Ar rayOf Fl oat col or, st r i ng name, i nteger wi dt h, i nt eger hei ght , f l oat pi xel Aspect Rat i o,
[f l oat durat i on]) ret ur ns AVLayer
192
After Effects Scripting Guide After Effects Object Summary
192
addText ([Text Document text Doc]) ret urns Text Layer
addText (st r i ng text ) ret urns Text Layer
byName(st ri ng name) ret urns Layer
precompose(Ar rayOf Int eger l ayerIndi ces, st ri ng name, [bool ean moveAl l At t ri butes]) ret urns CompItem
=======================================================================
LayerQual i t y enum
--------------------------------------------------------------------------
LayerQual i t y. BEST
LayerQual i t y. DRAFT
LayerQual i t y. WIREFRAME
=======================================================================
Li ght Layer obj ect (subcl ass of Layer, no own met hods or at t r i bues)
--------------------------------------------------------------------------
=======================================================================
LogType enum
--------------------------------------------------------------------------
LogType. ERRORS_AND_PER_FRAME_I NFO
LogType. ERRORS_AND_SETTI NGS
LogType. ERRORS_ONLY
=======================================================================
MarkerVal ue obj ect
--------------------------------------------------------------------------
new MarkerVal ue(st r i ng comment , [st r i ng chapter], [st r i ng url ], [st r i ng f r ameTarget ])
ret urns MarkerVal ue
chapter : st ri ng : read/ wri te
comment : st r i ng : read/wr i te
f rameTarget : st r i ng : read/wr i te
url : st r i ng : read/ wr i te
=======================================================================
MaskMode enum
--------------------------------------------------------------------------
MaskMode. ADD
MaskMode. DARKEN
MaskMode. DIFFERENCE
MaskMode. INTERSECT
MaskMode. LIGHTEN
MaskMode. NONE
MaskMode. SUBTRACT
=======================================================================
MaskMot i onBl ur enum
--------------------------------------------------------------------------
MaskMot i onBl ur. OFF
MaskMot i onBl ur. ON
MaskMot i onBl ur. SAME_AS_LAYER
=======================================================================
MaskProper t yGroup obj ect
--------------------------------------------------------------------------
(i nteger proper t yIndex) ret urns Proper t yBase
(st ri ng proper t yName) ret urns Proper t yBase
act i ve : bool ean : readOnl y
addProper t y(st r i ng proper t yName) ret urns Proper t yBase
193
After Effects Scripting Guide After Effects Object Summary
193
canAddProper t y(st r i ng proper t yName) ret urns bool ean
canSet Enabl ed : bool ean : readOnl y
col or : Ar ray of f l oat : read/ wri te
dupl i cat e() ret ur ns MaskProper t yG
el i ded : bool ean : readOnl y
enabl ed : bool ean : readOnl y
i nver t ed : bool ean : read/ wr i te
i sEf f ect : bool ean : readOnl y
i sMask : bool ean : readOnl y
i sModi f i ed : bool ean : readOnl y
l ocked : bool ean : read/ wr i te
maskMode : MaskMode : read/ wr i te
maskMot i onBl ur : MaskMot i onBl ur : read/ wri t e
matchName : st r i ng : readOnl y
moveTo(i nteger i ndex) no ret urn
name : st r i ng : read/ wr i te
numProper t i es : i nteger : readOnl y
parent Proper t y : Proper t yGroup : readOnl y
proper t y(i nteger proper t yIndex) ret urns Proper t yBase
proper t y(st r i ng proper t yName) ret urns Proper t yBase
proper t yDept h : i nteger : readOnl y
proper t yGroup([i nteger count Up]) ret urns Proper t yGroup
proper t yIndex : i nteger : readOnl y
proper t yType : Proper t yType : readOnl y
remove() no ret urn
rotoBezi er : bool ean : read/ wr i te
sel ect ed : bool ean : read/ wri te
=======================================================================
OMCol l ect i on obj ect
--------------------------------------------------------------------------
add() ret urns Out put Modul e
=======================================================================
Out put Modul e obj ect
--------------------------------------------------------------------------
appl yTempl at e(st ri ng t empl ateName) no ret urn
f i l e : Fi l e : read/ wr i te
name : st r i ng : readOnl y
post RenderAct i on : Post RenderAct i on : read/ wr i te
remove() no ret urn
saveAsTempl at e(st ri ng t empl ateName) no ret urn
templ ates : Ar ray of st r i ng: readOnl y
=======================================================================
Pl acehol derSource obj ect
--------------------------------------------------------------------------
al phaMode : Al phaMode : read/ wri te
conf or mFrameRate : f l oat : read/ wri te
di spl ayFrameRate : f l oat : readOnl y
f i el dSeparat i onType : Fi el dSeparat i onType : read/ wr i te
guessAl phaMode() no ret urn
guessPul l down(Pul l downMet hod pul l downMet hod) no ret urn
hasAl pha : bool ean : readOnl y
194
After Effects Scripting Guide After Effects Object Summary
194
hi ghQual i t yFi el dSeparat i on : bool ean : read/ wr i t e
i nver t Al pha : bool ean : read/ wr i te
i sSt i l l : bool ean : readOnl y
l oop : i nteger : read/ wri te
nat i veFrameRate : f l oat : readOnl y
premul Col or : Ar r ay of f l oat : read/ wr i t e
removePul l down : Pul l downPhase : read/ wr i t e
=======================================================================
Post RenderAct i on enum
--------------------------------------------------------------------------
Post RenderAct i on. IMPORT
Post RenderAct i on. IMPORT_AND_REPLACE_USAGE
Post RenderAct i on. NONE
Post RenderAct i on. SET_PROXY
=======================================================================
Proj ect obj ect
--------------------------------------------------------------------------
act i veIt em : It em : readOnl y
bi t sPerChannel : i nt eger : read/ wr i t e
cl ose(Cl oseOpt i ons cl oseOpt i ons) ret urns bool ean
consol i dateFoot age() ret ur ns i nteger
di spl aySt ar t Frame : i nt eger : read/ wr i t e
f i l e : Fi l e : readOnl y
i mpor t Fi l e(Impor t Opt i ons i mpor t Opt i ons) ret ur ns Item
i mpor t Fi l eWi t hDi al og() ret urns Ar rayOf Item
i mpor t Pl acehol der(st r i ng i temName, i nteger i temWi dt h, i nt eger i t emHei ght , f l oat f r ameRat e,
f l oat durat i on) ret urns Foot ageItem
i tem(i nteger i temIndex) ret urns It em
i tems : ItemCol l ect i on : readOnl y
l i nearBl endi ng : bool ean : read/ wr i te
numIt ems : i nt eger : readOnl y
reduceProj ect (Ar rayOf Item i temsToPreser ve) ret urns i nteger
removeUnusedFoot age() ret ur ns i nt eger
renderQueue : RenderQueue : readOnl y
root Fol der : Fol derItem : readOnl y
save(Fi l e toFi l e) ret urns bool ean
saveWi t hDi al og() ret ur ns bool ean
sel ect i on : Arr ay of Item : readOnl y
showWi ndow(bool ean doShow) no ret urn
t i mecodeBaseType : Ti mecodeBaseType : read/ wr i t e
t i mecodeDi spl ayType : Ti mecodeDi spl ayType : read/ wr i te
t i mecodeFi l mType : Ti mecodeFi l mType : read/ wr i t e
t i mecodeNTSCDropFrame : bool ean : read/ wr i te
t r ansparencyGr i dThumbnai l s : bool ean : read/ wr i te
=======================================================================
Proper t y obj ect (i nheri t s f rom Proper t yBase, whi ch i s not i nst ant i abl e)
--------------------------------------------------------------------------
act i ve : bool ean : readOnl y
addKey(f l oat at Ti me) ret urns i nteger
canSet Enabl ed : bool ean : readOnl y
canSet Expressi on : bool ean : readOnl y
195
After Effects Scripting Guide After Effects Object Summary
195
canVar yOverTi me : bool ean : readOnl y
dupl i cat e() ret ur ns Proper t y
el i ded : bool ean : readOnl y
enabl ed : bool ean : readOnl y
expressi on : st r i ng : read/ wr i t e
expressi onEnabl ed : bool ean : read/ wr i t e
expressi onError : st r i ng : readOnl y
hasMax : bool ean : readOnl y
hasMi n : bool ean : readOnl y
i sEf f ect : bool ean : readOnl y
i sInt erpol at i onTypeVal i d(
Keyf r ameInt erpol at i onType t ype) ret urns bool ean
i sMask : bool ean : readOnl y
i sModi f i ed : bool ean : readOnl y
i sSpat i al : bool ean : readOnl y
i sTi meVar yi ng : bool ean : readOnl y
keyInInt erpol at i onType(i nt eger keyIndex) ret urns Keyf rameInter pol at i onType
keyInSpat i al Tangent (i nteger keyIndex) ret urns Ar rayOf Fl oat
keyInTemporal Ease(i nteger keyIndex) ret urns Ar r ayOf Keyf rame
keyOut Interpol at i onType(i nt eger keyIndex) ret urns Keyf rameInter pol at i onType
keyOut Spat i al Tangent (i nt eger keyIndex) ret urns Ar rayOf Fl oat
keyOut Temporal Ease(i nteger keyIndex) ret ur ns Arr ayOf Keyf rame
keyRovi ng(i nt eger keyIndex) ret urns bool ean
keySel ect ed(i nt eger keyIndex) ret urns bool ean
keySpat i al Aut oBezi er(i nt eger keyIndex) ret urns bool ean
keySpat i al Cont i nuous(i nt eger keyIndex) ret urns bool ean
keyTemporal Aut oBezi er(i nt eger keyIndex) ret urns bool ean
keyTemporal Cont i nuous(i nteger keyIndex) ret urns bool ean
keyTi me(i nteger keyIndex) ret urns f l oat
keyTi me(st r i ng markerName) ret urns f l oat
keyVal ue(i nt eger keyIndex) ret urns t ype-stored-i n-proper t y
keyVal ue(st ri ng markerName) ret ur ns t ype-stored-i n-proper t y
matchName : st r i ng : readOnl y
moveTo(i nteger i ndex) no ret urn
name : st r i ng : readOnl y
nearest KeyIndex(f l oat at Ti me) ret urns i nteger
numKeys : i nt eger : readOnl y
parent Proper t y : Proper t yGroup : readOnl y
proper t yDept h : i nteger : readOnl y
proper t yGroup([i nteger count Up]) ret urns Proper t yGroup
proper t yIndex : i nteger : readOnl y
proper t yType : Proper t yType : readOnl y
proper t yVal ueType : Proper t yVal ueType : readOnl y
remove() no ret urn
removeKey(i nteger keyIndex) no ret urn
sel ect ed : bool ean : read/ wri te
sel ect edKeys : Ar ray of i nteger : readOnl y
set Inter pol at i onTypeAt Key(i nteger keyIndex, Keyf r ameInt erpol at i onType i nType,
[Keyf rameInter pol at i onType out Type]) no ret urn
set Rovi ngAt Key(i nteger keyIndex, bool ean i sRovi ng) no ret ur n
set Sel ectedAt Key(i nteger keyIndex, bool ean i sSel ect ed) no ret urn
196
After Effects Scripting Guide After Effects Object Summary
196
set Spat i al AutoBezi erAt Key(i nteger keyIndex, bool ean i sAut oBezi er) no ret urn
set Spat i al Cont i nuousAt Key(i nteger keyIndex, bool ean i sCont i nuous) no ret urn
set Spat i al Tangent sAt Key(i nt eger keyIndex, Ar rayOf Fl oat i nTangent , [Ar rayOf Fl oat out Tangent ])
no ret ur n
set Tempor al AutoBezi erAt Key(i nteger keyIndex, bool ean i sAut oBezi er) no ret urn
set Tempor al Cont i nuousAt Key(i nteger keyIndex, bool ean i sCont i nuous) no ret urn
set Tempor al EaseAt Key(i nt eger keyIndex, Ar rayOf Keyf r ameEase i nEase,
[Ar rayOf Keyf rameEase out Ease]) no ret urn
set Val ue(t ype-stored-i n-proper t y newVal ue) no ret urn
set Val ueAt Key(i nteger keyIndex, t ype-stored-i n-proper t y newVal ue) no ret urn
set Val ueAt Ti me(f l oat at Ti me, t ype-stored-i n-proper t y newVal ue) no ret ur n
set Val uesAt Ti mes(Ar rayOf Fl oat at Ti mes, Ar rayOf -t ype-stored-i n-proper t y newVal ues) no ret urn
uni t sText : st r i ng : readOnl y
val ue : t ype-stored-i n-proper t y: readOnl y
val ueAt Ti me(f l oat at Ti me, bool preExpressi on) ret urns t ype-stored-i n-proper t y
=======================================================================
Proper t yGroup obj ect (i nher i t s f rom Proper t yBase, whi ch i s not i nst ant i abl e)
--------------------------------------------------------------------------
(i nteger proper t yIndex) ret urns Proper t yBase
(st ri ng proper t yName) ret urns Proper t yBase
act i ve : bool ean : readOnl y
addProper t y(st r i ng proper t yName) ret urns Proper t yBase
canAddProper t y(st r i ng proper t yName) ret urns bool ean
canSet Enabl ed : bool ean : readOnl y
dupl i cat e() ret ur ns Proper t yGroup
el i ded : bool ean : readOnl y
enabl ed : bool ean : readOnl y
i sEf f ect : bool ean : readOnl y
i sMask : bool ean : readOnl y
i sModi f i ed : bool ean : readOnl y
matchName : st r i ng : readOnl y
moveTo(i nteger i ndex) no ret urn
name : st r i ng : readOnl y
numProper t i es : i nteger : readOnl y
parent Proper t y : Proper t yGroup : readOnl y
proper t y(i nteger proper t yIndex) ret urns Proper t yBase
proper t y(st r i ng proper t yName) ret urns Proper t yBase
proper t yDept h : i nteger : readOnl y
proper t yGroup([i nteger count Up]) ret urns Proper t yGroup
proper t yIndex : i nteger : readOnl y
proper t yType : Proper t yType : readOnl y
remove() no ret urn
sel ect ed : bool ean : read/ wri te
=======================================================================
Proper t yType enum
--------------------------------------------------------------------------
Proper t yType. INDEXED_GROUP
Proper t yType. NAMED_GROUP
Proper t yType. PROPERTY
197
After Effects Scripting Guide After Effects Object Summary
197
=======================================================================
Proper t yVal ueType enum
--------------------------------------------------------------------------
Proper t yVal ueType. COLOR
Proper t yVal ueType. CUSTOM_VALUE
Proper t yVal ueType. LAYER_INDEX
Proper t yVal ueType. MARKER
Proper t yVal ueType. MASK_INDEX
Proper t yVal ueType. NO_VALUE
Proper t yVal ueType. OneD
Proper t yVal ueType. SHAPE
Proper t yVal ueType. TEXT_DOCUMENT
Proper t yVal ueType. ThreeD
Proper t yVal ueType. ThreeD_SPATIAL
Proper t yVal ueType. TwoD
Proper t yVal ueType. TwoD_SPATI AL
=======================================================================
Pul l downPhase enum
--------------------------------------------------------------------------
Pul l downPhase. OFF
Pul l downPhase. SSWWW
Pul l downPhase. SWWWS
Pul l downPhase. SWWWW_24P_ADVANCE
Pul l downPhase. WSSWW
Pul l downPhase. WSWWW_24P_ADVANCE
Pul l downPhase. WWSSW
Pul l downPhase. WWSWW_24P_ADVANCE
Pul l downPhase. WWWSS
Pul l downPhase. WWWSW_24P_ADVANCE
Pul l downPhase. WWWWS_24P_ADVANCE
=======================================================================
Pul l downMet hod enum
--------------------------------------------------------------------------
Pul l downMet hod. ADVANCE_24P
Pul l downMet hod. PULLDOWN_3_2
=======================================================================
PurgeTarget enum
--------------------------------------------------------------------------
PurgeTarget . ALL_CACHES
PurgeTarget . IMAGE_CACHES
PurgeTarget . SNAPSHOT_CACHES
PurgeTarget . UNDO_CACHES
=======================================================================
RenderQueue obj ect
--------------------------------------------------------------------------
i tem(i nteger i temIndex) ret urns RenderQueueIt
i tems : RQIt emCol l ect i on : readOnl y
numIt ems : i nt eger : readOnl y
pauseRender i ng(bool ean doPause) no ret urn
render() no ret urn
render i ng : bool ean : readOnl y
198
After Effects Scripting Guide After Effects Object Summary
198
showWi ndow(bool ean doShow) no ret urn
stopRenderi ng() no ret urn
=======================================================================
RenderQueueIt em obj ect
--------------------------------------------------------------------------
appl yTempl at e(st ri ng t empl ateName) no ret urn
comp : CompItem : readOnl y
dupl i cat e() ret ur ns RenderQueueIt
el apsedSeconds : f l oat : readOnl y
l ogType : LogType : read/ wri te
numOut put Modul es : i nteger : readOnl y
out put Modul e(i nt eger out put Modul eIndex) ret urns Out put Modul e
out put Modul es : OMCol l ect i on : readOnl y
remove() no ret urn
render : bool ean : read/ wr i t e
saveAsTempl at e(st ri ng t empl ateName) no ret urn
ski pFrames : i nteger : read/ wri te
st ar t Ti me : f l oat : readOnl y
st at us : RQIt emSt at us : readOnl y
templ ates : Ar ray of st r i ng: readOnl y
t i meSpanDur at i on : f l oat : read/ wr i t e
t i meSpanSt ar t : f l oat : read/ wr i te
onSt at usChanged() no ret urn
=======================================================================
RQIt emCol l ect i on obj ect
--------------------------------------------------------------------------
add(CompItem compToAdd) ret urns RenderQueueIt
=======================================================================
RQIt emSt at us enum
--------------------------------------------------------------------------
RQIt emSt at us. DONE
RQIt emSt at us. ERR_STOPPED
RQIt emSt at us. NEEDS_OUTPUT
RQIt emSt at us. QUEUED
RQIt emSt at us. RENDERING
RQIt emSt at us. UNQUEUED
RQIt emSt at us. USER_STOPPED
RQIt emSt at us. WILL_CONTINUE
=======================================================================
Set t i ngs obj ect
--------------------------------------------------------------------------
get Set t i ng(st r i ng sect i onName,
st r i ng sect i onKey) ret urns st r i ng
haveSet t i ng(st r i ng sect i onName,
st r i ng sect i onKey) ret urns bool ean
saveSet t i ng(st r i ng sect i onName, st r i ng sect i onKey, st r i ng newVal ue) no ret urn
=======================================================================
Shape obj ect
--------------------------------------------------------------------------
new Shape() ret urns Shape
cl osed : bool ean : read/ wr i t e
199
After Effects Scripting Guide After Effects Object Summary
199
i nTangent s : Ar ray of f l oat [2] : read/ wr i te
out Tangent s : Ar ray of f l oat [2] : read/ wr i te
ver t i ces : Ar ray of f l oat [2] : read/ wr i te
=======================================================================
Sol i dSource obj ect
--------------------------------------------------------------------------
al phaMode : Al phaMode : read/ wri te
col or : Ar ray of f l oat : read/ wri te
conf or mFrameRate : f l oat : readOnl y
di spl ayFrameRate : f l oat : readOnl y
f i el dSeparat i onType : Fi el dSeparat i onType : readOnl y
guessAl phaMode() no ret urn
guessPul l down(Pul l downMet hod pul l downMet hod) no ret urn
hasAl pha : bool ean : readOnl y
hi ghQual i t yFi el dSeparat i on : bool ean : readOnl y
i nver t Al pha : bool ean : read/ wr i te
i sSt i l l : bool ean : readOnl y
l oop : i nteger : readOnl y
nat i veFrameRate : f l oat : readOnl y
premul Col or : Ar r ay of f l oat : read/ wr i t e
removePul l down : Pul l downPhase : readOnl y
=======================================================================
System obj ect
--------------------------------------------------------------------------
cal l System(st ri ng cmdLi neToExect ute) ret urns out put Of Command
machi neName : st r i ng : readOnl y
osName : st r i ng : readOnl y
osVersi on : st r i ng : readOnl y
userName : st r i ng : readOnl y
=======================================================================
Text Document obj ect
--------------------------------------------------------------------------
new Text Document (st r i ng text ) ret ur ns Text Document
text : st r i ng : read/ wri te
=======================================================================
Text Layer obj ect (subcl ass of AVLayer, no own met hods or at t r i but es)
--------------------------------------------------------------------------
=======================================================================
Ti mecodeBaseType enum
--------------------------------------------------------------------------
Ti mecodeBaseType. AUTO
Ti mecodeBaseType. FPS100
Ti mecodeBaseType. FPS24
Ti mecodeBaseType. FPS25
Ti mecodeBaseType. FPS30
Ti mecodeBaseType. FPS48
Ti mecodeBaseType. FPS50
Ti mecodeBaseType. FPS60
200
After Effects Scripting Guide After Effects Object Summary
200
=======================================================================
Ti mecodeDi spl ayType enum
--------------------------------------------------------------------------
Ti mecodeDi spl ayType. FEET_AND_FRAMES
Ti mecodeDi spl ayType. FRAMES
Ti mecodeDi spl ayType. TI MECODE
=======================================================================
Ti mecodeFi l mType enum
--------------------------------------------------------------------------
Ti mecodeFi l mType. MM16
Ti mecodeFi l mType. MM35
=======================================================================
TrackMat teType enum
--------------------------------------------------------------------------
TrackMat teType. ALPHA
TrackMat teType. ALPHA_INVERTED
TrackMat teType. LUMA
TrackMat teType. LUMA_INVERTED
TrackMat teType. NO_TRACK_MATTE
201
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.
repl y = "";
conn = new Socket ;
/ / access Adobe' s home page
i f (conn. open ("www. adobe. com: 80")) {
/ / send a HTTP GET request
conn. wr i t e ("GET / i ndex. ht ml HTTP/ 1. 0\ n\ n");
/ / and read t he ser ver' s repl y
repl y = conn. read();
conn. cl ose();
}
After executing this code, the variable repl y 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 connec-
tions and then return immediately. If there is a connection request, the call to poll() would return another
Socket object containing the brand new connection. Use this connection object to talk to the calling client;
when finished, close the connection and discard the connection object.
Before a Socket object is able to check for an incoming connection, it must be told to listen on a specific port,
like port 80 for HTTP requests. Do this by calling the listen() method instead of the open() method.
The following example is a very simple Web server. It listens on port 80, waiting until it detects an incoming
request. The HTTP header is discarded, and a dummy HTML page is transmitted to the caller.
conn = new Socket ;
/ / l i sten on por t 80
i f conn. l i sten (80)) {
202
After Effects Scripting Guide The Socket Object
202
/ / wai t f orever f or a connect i on
var i ncomi ng;
do i ncomi ng = conn. pol l ();
whi l e (i ncomi ng == nul l );
/ / di scard t he request
read();
/ / Repl y wi t h a HTTP header
i ncomi ng. wr i t el n ("HTTP/ 1. 0 200 OK");
i ncomi ng. wr i t el n ("Content -Type: text / ht ml ");
i ncomi ng. wr i t el n();
/ / Transmi t a dummy homepage
i ncomi ng. wr i t el n ("<ht ml ><body><h1>Homepage</ h1></ body></ ht ml >");
/ / done!
i ncomi ng. cl ose();
del ete i ncomi ng;
}
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] Socket ();
Creates a new Socket object.
Returns
Socket object.
Properties
connect ed Boolean When true, the connection is still active. Read only.
eof 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.
host 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 meout Number The timeout in seconds to be applied to read or write operations. Default is 10.
203
After Effects Scripting Guide The Socket Object
203
Methods
Socket object close() method
cl ose();
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 st en ( por t [, encodi ng] );
Instructs the object to start listening for an incoming connection.
The call to open() and the call to l i st en()are mutually exclusive. Call one function or the other, not both.
Parameters
Returns
Boolean
Socket object open() method
open ( host [, encodi ng]);
Opens the connection for subsequent read/write operations. The call to open() and the call to l i sten()are
mutually exclusive. Call one function or the other, not both.
cl ose Terminates the open connection.
l i st en Starts listening on an incoming connection.
open Opens a connection.
pol l Checks a listening object for a new incoming connection.
read Reads characters from a connection.
readl n Reads one line of text from a connection.
wr i t e Writes characters to a connection.
wr i t el n Writes one line of text to a connection.
por t 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.
encodi ng String Optional. The encoding to be used for the connection. Typical values are "ASCII", "binary", or "UTF-8".
Default is ASCII.
204
After Effects Scripting Guide The Socket Object
204
Parameters
Returns
Boolean, true on success.
Socket object poll() method
pol 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
read ([count ]);
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
Returns
String
Socket object readln() method
readl 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
wr i t e ( text , );
host 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".
encodi ng String Optional. The encoding to be used for the connection. Typical values are "ASCII", "binary", or "UTF-8".
Default is ASCII.
count 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.
205
After Effects Scripting Guide The Socket Object
205
Concatenates all arguments into a single string and writes that string to the connection.
Parameters
Returns
Boolean, true on success.
Socket object writeln() method
wr i t el n ( text , );
Concatenates all arguments into a single string, appends a Line Feed character, and writes that string to the
connection.
Parameters
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 unct i on chat Ser ver() {
var tcp = new Socket ;
/ / l i st en on por t 1234
wr i t el n ("Chat ser ver l i steni ng on por t 1234");
i f (tcp. l i st en (1234)) {
f or (; ; ) {
/ / pol l f or a new connect i on
var connect i on = tcp. pol l ();
i f (connect i on ! = nul l ) {
wr i t el n ("Connect i on f rom " + connect i on. host );
/ / we have a new connect i on, so wel come and chat
/ / unt i l cl i ent termi nat es t he sessi on
connect i on. wr i tel n ("Wel come to a l i t t l e chat ! ");
chat (connect i on);
connect i on. wr i tel n ("*** Goodbye ***");
connect i on. cl ose();
del ete connect i on;
wr i t el n ("Connect i on cl osed");
}
}
text String Any number of string values. All arguments are concatenated to form the string to be written.
text String Any number of string values. All arguments are concatenated to form the string to be written.
206
After Effects Scripting Guide The Socket Object
206
}
}
f unct i on chat Cl i ent () {
var connect i on = new Socket ;
/ / connect to sampl e ser ver
i f (connect i on. open ("remote-pc. cor p. adobe. com: 1234")) {
/ / t hen chat wi t h ser ver
chat (connect i on);
connect i on. cl ose();
del ete connect i on;
}
}
f unct i on chat (c) {
/ / sel ect a l ong t i meout
c. t i meout =1000;
whi l e (t rue) {
/ / get one l i ne and echo i t
wr i t el n (c. read());
/ / stop i f t he connect i on i s broken
i f (! c. connected)
break;
/ / read a l i ne of t ext
wr i t e ("chat : ");
var t ext = readl n();
i f (t ext == "bye")
/ / stop conversat i on i f t he user ent ered "bye"
break;
el se
/ / ot her wi se t ransmi t to ser ver
c. wr i tel n (t ext );
}
}
207
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 aerender (aerender. exe in Windows) renders After Effects compositions from the
command line. The command takes a series of optional arguments. Some are simple flags, like "reuse", and
some have one or two parameters, such as "proj ect proj ect _pat h" and
"mem_usage i mage_cache_percent max_mem_percent ". Execute the command with no arguments or with
the hel 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, aerender invokes a new instance of After Effects, even if one is already running. To change
this, specify the "reuse" argument.
Argument Description
hel p Print usage message.
reuse Reuse the currently running instance of After Effects (if found) to perform the render. When
a running instance is used, aerender saves preferences to disk when rendering is com-
pleted, but does not quit After Effects.
If this argument is not supplied, aerender 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.
proj ect proj ect _pat h proj ect _pat h is a file path or URI specifying a project file to open.
If this argument is not provided, aerender works with the currently open project. If no
project is specified and no project is open, an error results.
comp comp_name comp_name 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 ren-
der queue and rendered.
If this argument is not provided, aerender renders the entire render queue as is. In this case,
only the proj ect , l og, out put , v, mem_usage and cl ose arguments are
used. All other arguments are ignored.
RSt empl ate
render_s et t i ngs _t empl at e
render_s et t i ngs _t empl at e is the name of a template to apply to the render queue item.
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.
208
After Effects Scripting Guide Render Automation Command
208
Examples
To render just Comp 1 to a specified file, enter this command:
aerender -proj ect c: \ proj ect s\ proj 1. aep -comp "Comp 1" -out put c: \ out put \ proj 1\ proj 1. avi
To render everything in the render queue as is in the project file, enter this command:
aerender -proj ect c: \ proj ect s\ proj 1. aep
OMtempl at e
out put _modul e_t empl at e
out put _modul e_t empl at e is the name of a template to apply to the output module. If
the template does not exist, an error results.
If this argument is not provided, aerender uses the template already defined for the output
module.
out put out put _pat h out put _pat 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.
l og l og f i l e_pat h l og f i l e_pat h is a file path or URI specifying the location of the log file.
If this argument is not provided, aerender uses stdout .
s s t ar t _f rame s t ar t _f rame is the first frame to render.
If this argument is not provided, aerender uses the start frame in the file.
e end_f rame end_f rame 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 nc rement i nc rement 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.
mem_usage
i mage_cache_percent
max_mem_percent
i mage_cache_percent specifies the maximum percent of memory used to cache already
rendered images/footage.
max_mem_percent 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 per-
centage 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 verbos e_f l ag verbos e_f l ag specifies the type of messages reported. One of:
ERRORS: prints only fatal and problem errors.
ERRORS_AND_PROGRESS (default): prints progress of rendering as well.
cl ose cl os e_f l ag cl os e_f l ag specifies whether or not to close the project when done rendering, and whether
or not to save changes. One of:
DO_NOT_SAVE_CHANGES (default): the project is closed without saving
changes.
SAVE_CHANGES: the project is closed and changes are saved.
DO_NOT_CLOSE: 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).
sound s ound_f l ag s ound_f l ag specifies whether or not to play a sound when rendering is complete. One of
ON or OFF. Default is OFF.
versi on Displays the version number of aerender to the console. Does not render.
Argument Description
209
After Effects Scripting Guide Render Automation Command
209
To render frames 1 through 10 using multi-machine render, enter this command:
aerender -proj ect c: \ proj ect s\ proj 1. aep -comp "Comp 1" -s 1 -e 10
-RStempl ate "Mul t i -Machi ne Set t i ngs" -OMtempl ate "Mul t i -Machi ne Sequence"
-out put c: \ out put \ proj 1\ f rames[####]. psd

También podría gustarte