Project object

app.project

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.

Attribute List

Attribute Reference Description
file “Project file attribute” on page 117 The file for the currently open project.
rootFolder “Project rootFolder attribute” on page 121 The folder containing all the contents of the project; the equivalent of the Project panel items “Project items attribute” on page 119
activeItem “Project activeItem attribute” on page 115 The currently active item.
bitsPerChannel “Project bitsPerChannel attribute” on page 116 The color depth of the current project.
transparencyGridThumbnails “Project transparencyGridThumbnails attribute” on page 123 When true, thumbnail views use the transparency checkerboard pattern.
numItems “Project numItems attribute” on page 120 The total number of items contained in the project.
selection “Project selection attribute” on page 122 All items selected in the Project panel.
renderQueue “Project renderQueue attribute” on page 121 The project’s render queue.
timeDisplayType “Project timeDisplayType attribute” on page 122 The time display style, corresponding to the Time Display Style section in the Project Settings dialog box.
footageTimecodeDisplayStartType “Project footageTimecodeDisplayStart- Type attribute” on page 117 The Footage Start Time setting in the Project Settings dialog box, which is enabled when Timecode is selected as the time display style.
framesUseFeetFrames “Project framesUseFeetFrames attribute” on page 118 The Use Feet + Frames setting in the Project Settings dialog box.
feetFramesFilmType “Project feetFramesFilmType attribute” on page 117 The Use Feet + Frames menu setting in the Project Settings dialog box.
framesCountType “Project framesCountType attribute” on page 118 The Frame Count menu setting in the Project Settings dialog box.
displayStartFrame “Project displayStartFrame attribute” on page 117 The frame at which to start numbering when displaying the project.
linearBlending “Project linearBlending attribute” on page 120 When true, linear blending is used for the project.
xmpPacket “Project xmpPacket attribute” on page 123 The project’s XMP metadata.

Method List

Method Reference Description
item() “Project item() method” on page 119 Retrieves an item from the project.
consolidateFootage() “Project consolidateFootage() method” on page 116 Consolidates all footage in the project.
removeUnusedFootage() “Project removeUnusedFootage() method” on page 121 Removes unused footage from the project.
reduceProject() “Project reduceProject() method” on page 120 Reduces the project to a specified set of items.
close() “Project close() method” on page 116 Closes the project with normal save options.
save() “Project save() method” on page 121 Saves the project.
saveWithDialog() “Project saveWithDialog() method” on page 122 Displays a Save dialog box.
importPlaceholder() “Project importFileWithDialog() method” on page 119 Imports a placeholder into the project.
importFile() “Project importFile() method” on page 118 Imports a file into the project.
importFileWithDialog() “Project importFileWithDialog() method” on page 119 Displays an Import File dialog box.
showWindow() “Project showWindow() method” on page 122 Shows or hides the Project panel.
autoFixExpressions() “Project autoFixExpressions() method” on page 115 Automatically replaces text in all expressions.

activeItem attribute

app.project.activeItem

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


autoFixExpressions() method

app.project.autoFixExpressions(oldText, newText)

Automatically replaces text found in broken expressions in the project, if the new text causes the expression to evaluate without errors.

Parameters: * oldText The text to replace. * newText The new text.

Returns: Nothing.


bitsPerChannel attribute

app.project.bitsPerChannel

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

Type: Integer (8, 16, or 32 only) read/write


close() method

app.project.close(closeOptions)

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

Parameters: closeOptions Action to be performed on close. A CloseOptions enumerated value, one of:

  • CloseOptions.DO_NOT_SAVE_CHANGES: Close without saving.
  • CloseOptions.PROMPT_TO_SAVE_CHANGES: Prompt for whether to save changes before close.
  • CloseOptions.SAVE_CHANGES: Save automatically on close.

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


consolidateFootage() method

app.project.consolidateFootage()

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.


displayStartFrame attribute

app.project.displayStartFrame

An alternate way of setting the Frame Count menu setting in the Project Settings dialog box to 0 or 1, and is equivalent to using the FramesCountType.FC_START_0 or FramesCountType.FC_START_1 enumerated values for the framesCountType attribute. For more information, see “Project framesCountType attribute”.

Type: Integer (0 or 1); read/write.


feetFramesFilmType attribute

app.project.feetFramesFilmType

The Use Feet + Frames menu setting in the Project Settings dialog box. Use this attribute instead of the old timecodeFilmType attribute.

Type: A FeetFramesFilmType enumerated value read/write One of:

  • FeetFramesFilmType.MM16
  • FeetFramesFilmType.MM35

file attribute

app.project.file

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


footageTimecodeDisplayStartType attribute

app.project.footageTimecodeDisplayStartType

The Footage Start Time setting in the Project Settings dialog box, which is enabled when Timecode is selected as the time display style.

Type: A FootageTimecodeDisplayStartType enumerated value. read/write One of:

  • FootageTimecodeDisplayStartType.FTCS_START_0
  • FootageTimecodeDisplayStartType.FTCS_USE_SOURCE_MEDIA

framesCountType attribute

app.project.framesCountType

The Frame Count menu setting in the Project Settings dialog box.

Type: A FramesCountType enumerated value read/write One of:

  • FramesCountType.FC_START_1
  • FramesCountType.FC_START_0
  • FramesCountType.FC_TIMECODE_CONVERSION

NOTE: Setting this attribute to FramesCountType.FC_TIMECODE_CONVERSION resets the displayStart-Frame attribute to 0.


framesUseFeetFrames attribute

app.project.framesUseFeetFrames

The Use Feet + Frames setting in the Project Settings dialog box. True if using Feet + Frames; false if using Frames.

Type: Boolean read/write


importFile() method

app.project.importFile(importOptions)

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 project’s items array.

Parameters:

  • importOptions An ImportOptions object specifying the file to import and the options for the operation. See “ImportOptions object” on page 75.

Returns: FootageItem object.

Example

app.project.importFile(new ImportOptions(File(“sample.psd”))

importFileWithDialog() method

app.project.importFileWithDialog()

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 box.


importPlaceholder() method

app.project.importPlaceholder(name, width, height, frameRate, duration)

Creates and returns a new PlaceholderItem object and adds it to the project’s items array. Same as the File > Import > Placeholder command.

Parameters:

  • name A string containing the name of the placeholder.
  • width The width of the placeholder in pixels, an integer in the range [4..30000].
  • height The height of the placeholder in pixels, an integer in the range [4..30000].
  • frameRate The frame rate of the placeholder, a floating-point value in the range [1.0..99.0]
  • duration The duration of the placeholder in seconds, a floating-point value in the range [0.0..10800.0].

Returns: PlaceholderItem object.


item() method

app.project.item(index)

Retrieves an item at a specified index position.

Parameters:

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

Returns: Item object.


items attribute

app.project.items

All of the items in the project.

Type: ItemCollection object; read-only.


linearBlending attribute

app.project.linearBlending

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

Type: Boolean read/write


numItems attribute

app.project.numItems

The total number of items contained in the project, including folders and all types of footage.

Type: Integer read-only

Example:

n = app.project.numItems;
alert("There are " + n + " items in this project.")

reduceProject() method

app.project.reduceProject(array_of_items)

Removes all items from the project except those specified. Same as the File > Reduce Project command.

Parameters:

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

Returns: Integer the total number of items removed.

Example:

var theItems = new Array();
theItems[theItems.length] = app.project.item(1);
theItems[theItems.length] = app.project.item(3);
app.project.reduceProject(theItems);

removeUnusedFootage() method

app.project.removeUnusedFootage()

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.


renderQueue attribute

app.project.renderQueue

The render queue of the project.

Type: RenderQueue object; read-only.


rootFolder attribute

app.project.rootFolder

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.

Type: FolderItem object; read-only.


save() method

app.project.save()
app.project.save(file)

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

Parameters:

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

Returns: None.


saveWithDialog() method

app.project.saveWithDialog()

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 box.

Parameters: None.

Returns: Boolean true if the project was saved.


selection attribute

app.project.selection

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

Type: Array of Item objects read-only


showWindow() method

app.project.showWindow(doShow)

Shows or hides the Project panel.

Parameters:

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

Returns: Nothing.


timeDisplayType attribute

app.project.timeDisplayType

The time display style, corresponding to the Time Display Style section in the Project Settings dialog box.

Type: A TimeDisplay Type enumerated value read/write One of:

  • TimeDisplaType.FRAMES
  • TimeDisplayType.TIMECODE

transparencyGridThumbnails attribute

app.project.transparencyGridThumbnails

When true, thumbnail views use the transparency checkerboard pattern.

Type: Boolean read/write


xmpPacket attribute

app.project.xmpPacket

The project’s XMP metadata, stored as RDF (XML-based). For more information on XMP, see the JavaScript ToolsGuide.

Type: String read/write

Example:

The following example code accesses the XMP metadata of the current project, and modifies the Label project metadata field.

var proj = app.project;
// load the XMP library as an ExtendScript ExternalObject
if (ExternalObject.AdobeXMPScript == undefined) {
    ExternalObject.AdobeXMPScript = new
    ExternalObject('lib:AdobeXMPScript');
}
var mdata = new XMPMeta(app.project.xmpPacket); // get the project’s XMP metadata
// update the Label project metadata’s value
var schemaNS = XMPMeta.getNamespaceURI("xmp");
var propName = "xmp:Label";
try {
    mdata.setProperty(schemaNS, propName, "final version...no, really!");
}
catch(e) {
    alert(e);
}
app.project.xmpPacket = mdata.serialize();