After Effects project methods
Members
# static settings
The Settings of the current project, an object similar to
DuSettings
except that it saves in the Project XMP
Methods
# static autoFixExpressions(oldText, newText)
Reimplements
Automatically replaces text found in broken expressions in the project, if the new text causes the expression to evaluate without errors.
app.project.autoFixExpressions()
because it does not work with some special characters.Automatically replaces text found in broken expressions in the project, if the new text causes the expression to evaluate without errors.
Parameters:
Name | Type | Description |
---|---|---|
oldText |
string
|
The text to replace. |
newText |
string
|
The new text. |
# static bakeCompositions(modeopt, frameStepopt)
Bakes the expressions to keyframes
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mode |
DuAEExpression.BakeAlgorithm
|
<optional> |
DuAEExpression.BakeAlgorithm.SMART | The algorithm to use for baking the expressions. |
frameStep |
float
|
<optional> |
1.0 | By default, checks one value per keyframe. A lower value increases the precision and allows for sub-frame sampling. A higher value is faster but less precise. |
# static bakeExpressions(modeopt, frameStepopt)
Bakes the expressions to keyframes
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mode |
DuAEExpression.BakeAlgorithm
|
<optional> |
DuAEExpression.BakeAlgorithm.SMART | The algorithm to use for baking the expressions. |
frameStep |
float
|
<optional> |
1.0 | By default, checks one value per keyframe. A lower value increases the precision and allows for sub-frame sampling. A higher value is faster but less precise. |
# static checkCompNames() → {Object}
Checks if all comps have a different name.
The list of names used several times. Check the length attribute to know how many duplicates were found, loop through the keys to get the names. Eech key is an array containing the list of comps with that name.
Object
Example
var dupes = DuAEProject.checkCompNames();
if (dupes.length != 0) {
for (name in dupes)
{
if (dupes.hasOwnProperty(name)) alert(dupes[name]); //dupes[name] is an array of Layer
}
}
# static collectFiles(destinationopt, overwriteopt, zipopt, createProjectFolderopt)
Collects all dependencies in a folder
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
destination |
Folder
|
<optional> |
The folder where to save the files. The project files will be collected in a subfolder called "project name.aep.archive" or "project name.aep.zip". If not provided, will use the current folder. | |
overwrite |
boolean
|
<optional> |
false | Whether to overwrite existing footage in the destination. |
zip |
boolean
|
<optional> |
false | Set to true to automatically zip the archive. |
createProjectFolder |
boolean
|
<optional> |
true | Whether to create a folder for this project or use the destination as is. |
# static doComps(func, selectedOnlyopt)
Runs a function on all comps of the project
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
func |
function
|
The function, which must take a CompItem as its single argument. | ||
selectedOnly |
Boolean
|
<optional> |
false | Runs only on selected compositions |
# static expressionEngine() → {string}
The Expressions Engine setting in the Project Settings dialog box, as a string.
One of: "extendscript", "javascript-1.0"
string
# static getActiveComp() → {CompItem|null}
Gets the After Effects current composition
The current composition or null if there's no current comp
CompItem
|
null
# static getComps(rootOnlyopt) → {Array.<CompItem>}
Gets all compositions in the project (or only the root of the project, ignoring subfolders)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
rootOnly |
boolean
|
<optional> |
false | Set to true to get only comps from the root of the project |
The compositions
Array.<CompItem>
# static getFolderItem(folderName) → {FolderItem|null}
Gets a folder with its name. If name is "Project Root" or empty, returns the root of the project.
Parameters:
Name | Type | Description |
---|---|---|
folderName |
string
|
The name of the folder |
The folder or null if not found.
FolderItem
|
null
# static getItemByName() → {Item|null}
Retrieves the first item with the given name
The item
Item
|
null
# static getPrecompsAtRoot() → {Array.<CompItem>}
Gets all the precompositions located at the root of the project.
Array.<CompItem>
# static getSelectedComp() → {CompItem|null}
Gets either the active comp or the first selected one
The composition
CompItem
|
null
# static getSelectedComps() → {Array.<CompItem>}
Gets all selected compositions in the project
The compositions
Array.<CompItem>
# static getSize() → {int}
Gets the size of the current project file
the size in Bytes. -1 if it has not been saved yet.
int
# static getUnusedComps(folderopt) → {Array.<CompItem>}
Gets the unused compositions, except the ones in the given folder.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
folder |
FolderItem
|
<optional> |
The folder to exclude. |
The unused compositions
Array.<CompItem>
# static getUnusedFootages() → {Array.<FootageItem>}
Gets the unused footages.
The list of unused items.
Array.<FootageItem>
# static name() → {string}
Gets the project name (i.e. the file name without extension)
The project name.
string
# static newUniqueCompName(newName, comp, incrementopt) → {string}
Generates a new unique name for a composition
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
newName |
string
|
The wanted new name | ||
comp |
CompItem
|
The comp | ||
increment |
boolean
|
<optional> |
true | true to automatically increment the new name if it already ends with a digit |
The unique name, with a new number at the end if needed.
string
# static reduce(compsopt, keepExpressionOnlyopt)
Reduces the project, the same way the native command does it, but being able to keep comps used only by expressions.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
comps |
CompItem
|
Array.<CompItem>
|
<optional> |
The name or the id of the comp(s) to keep. If omitted, it will use all comps at the root of the project (the ones not in a subfolder). | |
keepExpressionOnly |
boolean
|
<optional> |
true | Set to false to ignore comps used only by expressions (same as the native command) |
# static reduceSelected(keepExpressionOnlyopt)
Reduces the project using the selected compositions, the same way the native command does it, but being able to keep comps used only by expressions. If there's no comp selected, will use all comps at the root of the project.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
keepExpressionOnly |
boolean
|
<optional> |
true | Set to false to ignore comps used only by expressions (same as the native command) |
# static replaceInExpressions(oldString, newString, caseSensitiveopt)
Replaces text in Expressions
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
oldString |
string
|
The string to replace | ||
newString |
string
|
The new string | ||
caseSensitive |
boolean
|
<optional> |
true | Whether the search has to be case sensitive |
# static setProgressMode(inProgressopt, showProgressBaropt, askToHideLayerControlsopt, eventCoordinatesopt) → {Boolean}
Sets the project in "waiting mode" to speed up things.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
inProgress |
Boolean
|
<optional> |
true | True to set progress mode, false to stop it. |
showProgressBar |
Boolean
|
<optional> |
true | Will show a nice progress bar if true |
askToHideLayerControls |
Boolean
|
<optional> |
false | Will prompt the user to hide layer controls to improve performance. |
eventCoordinates |
Array.<int>
|
<optional> |
Provide the screen coordinates to center the progress bar and dialogs on the corresponding screen. |
false if the user cancelled the process, true otherwise
Boolean
# static setUniqueCompNames(compsopt)
Makes sure all compositions in the project have unique names, renaming them if needed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
comps |
Array
|
ItemCollection
|
<optional> |
A list of comps, all of them by default |