Footage

This section describes how to work with footage items in the project (Project window). The following topics are covered:

Retrieving all footage items in the project

The Project window contains various types of items, such as compositions, footage, and folders. Footage items are represented as FootageItem objects, which are subclassed (and consist of attributes and methods of) Item objects.

The following code shows how to retrieve all footage items in the project and store them in an array for retrieval or use elsewhere in your code.

// given: // app = Application object representing After Effects // app.project = Project object representing the current project // var items = app.project.items; var allFootage = new Array(); // Store footage items in an array for (var i = 1; i <= items.length; i++) if (items[i].typeName == "Footage") // Retrieve only footage items allFootage[allFootage.length] = items[i]; // The allFootage array now contains the list of footage items // The number of footage items is allFootage.length

Retrieving the selected footage items in the project

If your script needs to operate on the selected footage items in the project, you can either check the selected items (in app.project.selection) for footage items, or check all items (in app.project.items) for selected footage.
Personally, I prefer the first of these options as the script does not need to iterate over unselected items.

Note: There does not seem to be a way to retrieve the selected footage items (or any type of selected item) in selected order.

The following code shows how to iterate over the selected items, and store only footage items in an array for retrieval or use elsewhere in your code.

// given: // app = Application object representing After Effects // app.project = Project object representing the current project // var selectedItems = app.project.selection; // Start with the selected items var selectedFootage = new Array(); // Store footage items in an array for (var i = 0; i < selectedItems.length; i++) if (selectedItems[i].typeName == "Footage") selectedFootage[selectedFootage.length] = selectedItems[i]; // The selectedFootage array now contains the list of selected footage items // The number of selected footage items is selectedFootage.length in top-to-bottom order