Users Online

· Guests Online: 33

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

After Effects Scripting Guide

 

 After Effects Scripting Guide

 

 

 

 

 

 

 

 

Elements of basic JavaScript relevant to After Effects scripting

JavaScript variables

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

Keywords and Statement Syntax

Keyword/Statement

Description

break

Standard JavaScript; exit the currently executing loop.

continue

JavaScript; cease execution of the current loop iteration.

case

Label used in a switch statement.

default

Label used in a switch statement when a case label is not found.

do...while

Standard JavaScript construct. Similar to the while loop, except loop condition evaluation occurs at the end of the loop.

false

Literal representing the Boolean false value.

for

Standard JavaScript loop construct.

for...in

Standard JavaScript construct. Provides a way to easily loop through the properties of an object.

function

Used to define a function.

if/if...else

Standard JavaScript conditional constructs.

new

Standard JavaScript constructor statement.

null

Assigned to a variable, array element, or object property to indicate that it does not contain a legalvalue.

return

Standard JavaScript way of returning a value from a function or exiting a function.

switch

Standard JavaScript way of evaluating a JavaScript expression and attempting to match the expression’s value to a case label.

this

Standard JavaScript method of indicating the current object.

true

Literal representing the Boolean true value.

undefined

Indicates that the variable, array element, or object property has not yet been assigned a value.

var

Standard JavaScript syntax used to declare a local variable.

while

Standard JavaScript construct. Similar to the do…whileloop, except loop condition evaluation occurs at the beginning of the loop.

with

Standard JavaScript construct used to specify an object to use in subsequent statements.

JavaScript operators

The following tables list and describe all operators recognized by the After Effects scripting engine and show the precedence and associativity for all operators.

Description of Operators

Operators

Description

new

Create new object instance.

delete

Delete property from an object.

typeof

Returns data type.

void

Returns undefined value.

.

Object member.

[]

Array element.

()

Function call.

++

Pre- or post-increment.

--

Pre- or post-decrement.

-

Unary negation or subtraction.

~

Bitwise NOT.

!

Logical NOT.

*

Multiply.

/

Divide.

%

Modulo division.

+

Add.

<<

Bitwise left shift.

>>

Bitwise right shift.

>>>

Unsigned bitwise right shift.

<

Less than.

<=

Less than or equal.

>

Greater than.

>=

Greater than or equal.

==

Equal.

!=

Not equal.

&

Bitwise AND.

^

Bitwise XOR.

|

Bitwise OR.

&&

Logical AND.

||

Logical OR.

?:

Conditional (ternary).

=

Assignment.

+=

Assignment with add operation.

-=

Assignment with subtract operation.

*=

Assignment with multiply operation.

/=

Assignment with divide operation.

%=

Assignment with modulo division operation.

<<=

Assignment with bitwise left shift operation.

>>=

Assignment with bitwise right shift operation.

>>>=

Assignment with unsigned bitwise right shift operation.

&=

Assignment with bitwise AND operation.

^=

Assignment with bitwise XOR operation.

|=

Assignment with bitwise OR operation.

,

Multiple evaluation.

Operator Precedence

Operators (highest precedence to lowest)

Associativity

[], (), .

left to right

new, delete, - (unary negation), !, type of, void , ++, –

right to left

*, /, %

left to right

+, - (subtraction)

left to right

<<, >>, >>>

left to right

<, <=, >, >=

left to right

= =, ! =

left to right

&

left to right

^

left to right

|

left to right

&&

left to right

||

left to right

?:

right to left

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

right to left

,

left to right

The After Effects Object Model

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

After Effects Object Model

Hierarchy diagram of the main After Effects scripting objects

Note that the File, Folder, and Socket objects are defined by ExtendScript, and are documented in the JavaScript Tools Guide. ExtendScript also defines the ScriptUI module, a set of window and user-interface control objects, which are available to After Effects scripts. These are also documented in the JavaScript Tools Guide. The hierarchy of objects in scripting corresponds to the hierarchy in the user interface.

After Effects 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 renderqueue contains render-queue items as well as render settings and output modules. All of these entities are represented by objects in scripting.

Note

To avoid ambiguity, this manual uses the term “attribute” to refer to JavaScript object properties, and the term “property” or “AE property” to refer to After Effects layer properties.

Object summary

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

Object

Description

Global functions

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

Application object

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

AVItem object

Represents audio/visual files imported into After Effects.

AVLayer object

Represents those layers that contain AVItem objects (composition layers, footage layers, solid layers, text layers, and sound layers).

CameraLayer object

Represents a camera layer within a composition.

Collection object

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

CompItem object

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

FileSource object

Describes footage that comes from a file.

FolderItem object

Represents a folder in the Project panel.

FootageItem object

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

FootageSource object

Describes the file source of some footage.

ImportOptions object

Encapsulates options for importing files into After Effects.

Item object

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

ItemCollection object

Collects items in a project.

KeyframeEase object

Encapsulates keyframe ease values in an After Effects property.

Layer object

A base class for layer classes.

LayerCollection object

Collects layers in a project.

LightLayer object

Represents a light layer within a composition.

MarkerValue object

Encapsulates marker values in an After Effects property.

MaskPropertyGroup object

Encapsulates mask attributes in a layer.

OMCollection object

Collects output modules in a render queue.

OutputModule object

Represents an output module for a render queue.

PlaceholderSource object

Describes a placeholder for footage.

Project object

Represents an After Effects project.

Property object

Represents an After Effects property.

PropertyBase object

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

PropertyGroup object

Represents an After Effects property group.

RenderQueue object

Represents the After Effects render queue.

RenderQueueItem object

Represents a renderable item in a render queue.

RenderQueueItem object

Collects render-queue items in a render queue.

RQItemCollection object

Provides access to application settings and preferences.

Shape object

Encapsulates the outline shape information for a mask.

ShapeLayer object

Represents a shape layer within a composition.

SolidSource object

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

System object

Provides access to the operating system from the application.

TextDocument object

Encapsulates the text in a text layer.

TextLayer object

Represents a text layer within a composition.

Viewer object

Represents a Composition, Layer, or Footage panel.

 

 

 

 

 

 

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, to convert numeric time values to and from string values, or to generate a random number.

Global function

Description

clearOutput()

Clears text from the Info panel.

currentFormatToTime()

Converts string time value to a numeric time value.

generateRandomNumber()

Generates a random number.

timeToCurrentFormat()

Converts a numeric time value to a string time value.

write()

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

writeLn()

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

isValid()

When true, the specified object exists.

Additional global functions for standard user I/O (alertconfirm , and prompt) and static functions for file I/O, are defined by ExtendScript; for detailed reference information, see the JavaScript Tools Guide.


clearOutput()

clearOutput()

Description

Clears the output in the Info panel.

Parameters

None.

Returns

Nothing.


currentFormatToTime()

currentFormatToTime(formattedTime, fps[, isDuration])

Description

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

Parameters

formattedTime

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

fps

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

isDuration

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

Returns

Floating-point value, the number of seconds.


generateRandomNumber()

generateRandomNumber()

Note

This functionality was added in After Effects 13.6 (CC 2015)

Description

Generates random numbers. This function is recommended instead of Math.random for generating random numbers that will be applied as values in a project (e.g., when using setValue).

This method avoids a problem where Math.random would not return random values in After Effects CC 2015 (13.5.x) due to a concurrency issue with multiple CPU threads.

Returns

Floating-point, pseudo-random number in the range [0, 1].

Example

// change the position X of all layers with random number

var myComp = app.project.activeItem;
var x = 0;

for (var i = 1; i <= myComp.numLayers; i++) {
  // If you use Math.random(), this does not work
  // x = 400 * (Math.random()) – 200;
  // use new generateRandomNumber() instead

  x = 400 * generateRandomNumber() – 200;
  var currentPos = myComp.layer(i).property("Position").value;
  myComp.layer(i).property("Position").setValue([currentPos[0] + x, currentPos[1]]);
}

isValid()

isValid(obj)

Description

Determines if the specified After Effects object (e.g., composition, layer, mask, etc.) still exists. Some operations, such as PropertyBase.moveTo(), might invalidate existing variable assignments to related objects. This function allows you to test whether those assignments are still valid before attempting to access them.

Parameters

obj

The After Effects object to check for validity.

Returns

Boolean.

Example

var layer = app.project.activeItem.layer(1); // assume layer has three masks
alert(isValid(layer)); // displays "true"
var mask1 = layer.mask(1);
var mask2 = layer.mask(2);
var mask3 = layer.mask(3);
mask3.moveTo(1); // move the third mask to the top of the mask stack
alert(isValid(mask1)); // displays "false"; mask2 and mask3 do as well

timeToCurrentFormat()

timeToCurrentFormat(time, fps[, isDuration])

Description

Converts a numeric time value (a number of seconds) to a frame time value; that is, a formatted string thatshows which frame corresponds to that time, at the specified rate. For example, if the time is 0.5 seconds, andthe frame rate is 24 fps, the frame would be 0:00:12 (when the project is set to display as timecode). If the framerate is 30 fps, the frame would be 0:00:15. The format of the timecode string is determined by a project setting. If the time is a duration, the frames are counted from 0. Otherwise, the frames are counted from the project’s starting frame (see Project displayStartFrame attribute).

Parameters

time

The number of seconds, a floating-point value.

fps

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

isDuration

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

Returns

String in the project’s current time display format.


write()

write(text)

Description

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

Parameters

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

Returns

Nothing.

Example

write("This text appears in Info panel ");
write("with more on same line.");

writeLn()

writeLn(text)

Description

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

Parameters

text The string to display.

Returns

Nothing.

Example

writeLn("This text appears on first line");
writeLn("This text appears on second line");











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

app.activeViewer

app.activeViewer

Description

The Viewer object for the currently focused or active-focused viewer (Composition, Layer, or Footage) panel. Returns null if no viewers are open.

Type

Viewer object; read-only.


app.availableGPUAccelTypes

app.availableGPUAccelTypes

Note

This functionality was added in After Effects 14.0 (CC 2017)

Description

The Viewer object for the currently focused or active-focused viewer (Composition, Layer, or Footage) panel.

Use this in conjunction with app.project.gpuAccelType to set the value for Project Settings > Video Rendering and Effects > Use.

Type

Array of GpuAccelType enums, or null if no viewers are open; read-only. One of:

  • CUDA

  • Metal

  • OPENCL

  • SOFTWARE

Example The following sample code checks the current computer’s available GPU acceleration types, and sets it to Metal if available.

// app.availableGPUAccelTypes returns GPU acceleration types available on the current system.
// You can use this to check before setting the GPU acceleration type.
var newType = GpuAccelType.METAL;

// Before trying to set, check which GPU acceleration types are available on the current system.
var canSet = false;
var currentOptions = app.availableGPUAccelTypes;
for (var op in currentOptions) {
    if (currentOptions[op] === newType) {
        canSet = true;
    }
}

if (canSet) {
    // Set the GPU acceleration type.
    app.project.gpuAccelType = newType;
} else {
    alert("Metal is not available on this OS.");
}

app.buildName

app.buildName

Description

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

Type

String; read-only.


app.buildNumber

app.buildNumber

Description

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

Type

Integer; read-only.


app.disableRendering

app.disableRendering

Note

This functionality was added in After Effects 16.0 (CC 2019)

Description

When false (the default), rendering proceeds as normal. Set to true to disable rendering as if Caps Lock were turned on.

Type

Boolean; read/write.


app.effects

app.effects

Description

The effects available in the application.

Type

Array, with each element containing the following properties; read-only:

displayName

String representing the localized display name of the effect as seen in the Effect menu.

category

String representing the localized category label as seen in the Effect menu. This can be “” for synthetic effects that aren’t normally shown to the user.

matchName

String representing the internal unique name for the effect. This name does not change between versions of After Effects. Use this value to apply the effect.

version

Effect’s internal version string. This value might be different than the version number the plug-in vendor decides to show in the effect’s about box.

Example

var effectName = app.effects[12].displayName;

app.exitAfterLaunchAndEval

app.exitAfterLaunchAndEval

Description

This attribute is used only when executing a script from a command line on Windows. When the application is launched from the command line, the –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.


app.exitCode

app.exitCode

Description

A numeric status code used when executing a script externally (that is, from a command line or AppleScript).

  • In Windows, the value is returned on the command line when After Effects was launched on the command line (using the afterfx or afterfx –m command), and a script was specified with the –r or –s option.

  • in Mac OS, the value is returned as the AppleScript DoScript result for each script.

In both Mac OS and Windows, the value is set to 0 (EXIT_SUCCESS) at the beginning of each script evaluation. In the event of an error while the script is running, the script can set this to a positive integer that indicates what error occurred.

Type

Integer; read/write.

Example

app.exitCode = 2; // on quit, if value is 2, an error has occurred

app.isoLanguage

app.isoLanguage

Description

A string indicating the locale (language and regional designations) After Effects is running.

Note

$.locale returns the operating system language, not the language of the After Effects application.

Type

String; read-only. Some common values include:

  • en_US for English (United States)

  • de_DE for German (Germany)

  • es_ES for Spanish (Spain)

  • fr_FR for French (France)

  • it_IT for Italian (Italy)

  • ja_JP for Japanese (Japan)

  • ko_KR for Korean (Korea)

Example

var lang = app.isoLanguage;
if (lang === "en_US") {
  alert("After Effects is running in English.");
} else if (lang === "fr_FR") {
  alert("After Effects is running in French.");
} else {
  alert("After Effects is running not in English or French.");
}

app.isRenderEngine

app.isRenderEngine

Description

True if After Effects is running as a render engine.

Type

Boolean; read-only.


app.isWatchFolder

app.isWatchFolder

Description

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

Type

Boolean; read-only.


app.memoryInUse

app.memoryInUse

Description

The number of bytes of memory currently used by this application.

Type

Number; read-only.


app.onError

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(). The callback function is passed the error string and a severity string. It should not return any value.

Type

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

Example

function err(errString) {
  alert(errString) ;
}
app.onError = err;

app.preferences

app.preferences

Description

The currently loaded AE app preferences. See Preferences object.

Type

Preferences object; read-only.


app.project

app.project

Description

The project that is currently loaded. See Project object.

Type

Project object; read-only.


app.saveProjectOnCrash

app.saveProjectOnCrash

Description

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

Type

Boolean; read/write.


app.settings

app.settings

Description

The currently loaded settings. See Settings object.

Type

Settings object; read-only.


app.version

app.version

Note

This functionality was added in After Effects 12.0 (CC)

Description

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

Type

String; read-only.

Example

var ver = app.version;
alert("This machine is running version " + ver + " of AfterEffects.");

Methods

app.activate()

app.activate()

Description

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

Parameters

None.

Returns

Nothing.


app.beginSuppressDialogs()

app.beginSuppressDialogs()

Description

Begins suppression of script error dialog boxes in the user interface. Use app.endSuppressDialogs() to resume the display of error dialogs.

Parameters

None.

Returns

Nothing.


app.beginUndoGroup()

app.beginUndoGroup(undoString)

Description

Marks the beginning of an undo group, which allows a script to logically group all of its actions as a single undoable action (for use with the Edit > Undo/Redo menu items). Use the app.endUndoGroup() method to mark the end of the group.

beginUndoGroup() and endUndoGroup() pairs can be nested. Groups within groups become part of the larger group, and will undo correctly. In this case, the names of inner groups are ignored.

Parameters

undoString

The text that will appear for the Undo command in the Edit menu (that is, “Undo “)

Returns

Nothing.


app.cancelTask()

app.cancelTask(taskID)

Description

Removes the specified task from the queue of tasks scheduled for delayed execution.

Parameters

taskID

An integer that identifies the task, as returned by app.scheduleTask().

Returns

Nothing.


app.endSuppressDialogs()

app.endSuppressDialogs(alert)

Description

Ends the suppression of script error dialog boxes in the user interface. Error dialogs are displayed by default;call this method only if app.beginSuppressDialogs() has previously been called.

Parameters

alert

Boolean;

when true, errors that have occurred following the call to beginSuppressDialogs() are displayed in adialog box.

Returns

Nothing.


app.endUndoGroup()

app.endUndoGroup()

Description

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

Parameters

None.

Returns

Nothing.


app.endWatchFolder()

app.endWatchFolder()

Description

Ends Watch Folder mode.

Parameters

None.

Returns

Nothing.

See also


app.executeCommand()

app.executeCommand(id)

Description

Menu Commands in the GUI application have an individual ID number, which can be used as the parameter for this method. For some functions not included in the API this is the only way to access them.

The app.findMenuCommandId() method can be used to find the ID number for a command.

These web sites have more information and lists of the known numbers:

Parameters

id

The ID number of the command.

Returns

None.

Example

// calls the Convert to Bezier Path command
app.executeCommand(4162);

app.findMenuCommandId()

app.findMenuCommandId(Command)

Description

Menu Commands in the GUI application have an individual ID number, which can be used as a parameter for the app.executeCommand() command. For some functions not included in the API this is the only way to access them.

It should be noted that this method is not reliable across different language packages of AE, so you’ll likely want to find the command ID number during development and then call it directly using the number in production.

These web sites have more information and lists of the known numbers:

Parameters

Command

The text of the menu command, exactly as it is shown in the UI.

Returns

Integer, the ID number of the menu command.

Example

app.findMenuCommandId("Convert To Bezier Path")

app.newProject()

app.newProject()

Description

Creates a new project in After Effects, replicating the File > New > New Project menu command. If the current project has been edited, the user is prompted to save it. If the user cancels out of the Save dialog box, the new project is not created and the method returns null. Use app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES) to close the current project before opening a new one. See Project.close()

Parameters

None.

Returns

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

Example

app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
app.newProject();

app.open()

app.open()
app.open(file)

Description

Opens a project.

Parameters

file

Optional

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

Returns

A new Project object for the specified project, or null if the user cancels the Open dialog box.

Example

var my_file = new File("../my_folder/my_test.aep");
if (my_file.exists) {
  var new_project = app.open(my_file);
  if (new_project) {
    alert(new_project.file.name);
  }
}

app.parseSwatchFile()

app.parseSwatchFile(file)

Description

Loads color swatch data from an Adobe Swatch Exchange (ASE) file.

Parameters

file

The file specification, an Extendscript File object.

Returns

The swatch data, in this format:

data.majorVersion data.minorVersion

The ASE version number.

data.values

An array of Swatch Value.

SwatchValue.type

One of “RGB”, “CMYK”, “LAB”, “Gray”

SwatchValue.r

SwatchValue.g SwatchValue.b

When type = "RGB", the color values in the range [0.0..1.0]. 0, 0, 0 is Black.

SwatchValue.c

SwatchValue.m SwatchValue.y SwatchValue.k

When type = “CMYK”, the color values in the range [0.0..1.0]. 0, 0, 0, 0 is White.

SwatchValue.L SwatchValue.a

SwatchValue.b SwatchValue.value

When type = "LAB", the color values. L is in the range [0.0..1.0]. a and b are in the range [-128.0..+128.0] 0, 0, 0 is Black. When type = "Gray", the value range is [0.0..1.0]. 0.0 is Black.


app.pauseWatchFolder()

app.pauseWatchFolder(pause)

Description

Pauses or resumes the search of the target watch folder for items to render.

Parameters

pause

True to pause, false to resume.

Returns

Nothing.

See also


app.purge()

app.purge(target)

Description

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

Parameters

target

The type of elements to purge from memory; a PurgeTarget enumerated value, one of:

  • PurgeTarget.ALL_CACHES: Purges all data that After Effects has cached to physical memory.

  • PurgeTarget.UNDO_CACHES: Purges all data saved in the undo cache.

  • PurgeTarget.SNAPSHOT_CACHES: Purges all data cached as composition/layer snapshots.

  • PurgeTarget.IMAGE_CACHES : Purges all saved image data.

Returns

Nothing.


app.quit()

app.quit()

Description

Quits the After Effects application.

Parameters

None.

Returns

Nothing.


app.scheduleTask()

app.scheduleTask(stringToExecute, delay, repeat)

Description

Schedules the specified JavaScript for delayed execution.

Parameters

stringToExecute

A string containing JavaScript to be executed.

delay

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.

Returns

Integer, a unique identifier for this task, which can be used to cancel it with app.cancelTask().


app.setMemoryUsageLimits()

app.setMemoryUsageLimits(imageCachePercentage, maximumMemoryPercentage)

Description

Sets memory usage limits as in the Memory & Cache preferences area. For both values, if installed RAM is less than a given amount (n gigabytes), the value is a percentage of the installed RAM, and is otherwise a percentage of n. The value of n is: 2 GB for 32-bit Windows, 4 GB for 64-bit Windows, 3.5 GB for Mac OS.

Parameters

imageCachePercentage

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

maximumMemoryPercentage

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

Returns

Nothing.


app.setMultiFrameRenderingConfig()

app.setMultiFrameRenderingConfig(mfr_on, max_cpu_perc)

Note

This functionality was added in After Effects 22.0 (2022)

Description

Calling this function from a script will set the Multi-Frame Rendering configuration for the next render. After execution of the script is complete, these settings will be reset to what was previously set in the UI.

Parameters

mfr_on

Boolean value. Set to true to enable Multi-Frame Rendering.

max_cpu_perc

Value from 1-100 representing the maximum CPU percentage Multi-Frame Rendering should utilize. If mfr_on is set to false, pass in 100.

Returns

Nothing.


app.setSavePreferencesOnQuit()

app.setSavePreferencesOnQuit(doSave)

Description

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

Parameters

doSave

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

Returns

Nothing.


app.watchFolder()

app.watchFolder(folder_object_to_watch)

Description

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

Parameters

folder_object_to_watch

The Folder object for the folder to watch.

Returns

Nothing.

Example

var theFolder = new Folder("c:/tool");
app.watchFolder(theFolder);

See also


 

 

 

 

 

 

 

 

 

 

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.79 seconds
10,800,055 unique visits