Skip to content

item

app.project.item(index)

app.project.items[index]

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 object and for FolderItem object, 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.

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 myFolder = app.project.item(2);
if (!(myFolder instanceof FolderItem)) {
alert("error: second item is not a folder");
} else {
var numInFolder = myFolder.numItems;
//Always run loops backwards when deleting things:
for (var i = numInFolder; i >= 1; i--) {
var curItem = myFolder.item(i);
if (curItem.parentFolder !== myFolder) {
alert("error within AE: the parentFolder is not set correctly");
} else {
if (!curItem.selected) {
//found an unselected solid.
curItem.remove();
}
}
}
}

app.project.item(index).comment

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.

String; read/write.


app.project.item(index).dynamicLinkGUID

A unique and persistent identification number used for the dynamic link, in form of 00000000-0000-0000-0000-000000000000.

String; read-only.


app.project.item(index).guides

An array of guide objects, containing orientationType, positionType, and position attributes.

Array; read-only.


app.project.item(index).id

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.

Integer; read-only.


app.project.item(index).label

The label color for the item. Colors are represented by their number (0 for None, or 1 to 16 for one of the preset colors in the Labels preferences).

Integer (0 to 16); read/write.


app.project.item(index).name

The name of the item as displayed in the Project panel.

String; read/write.


app.project.item(index).parentFolder

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.project.rootFolder). You can use ItemCollection.addFolder() to add a new folder, and set this value to put items in the new folder.

FolderItem object; read/write.

This script creates a new FolderItem in the Project panel and moves compositions into it.

//create a new FolderItem in project, with name "comps"
var compFolder = app.project.items.addFolder("comps");
//move all compositions into new folder by setting
//compItem's parentFolder to "comps" folder
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i) instanceof CompItem) {
app.project.item(i).parentFolder = compFolder;
}
}

app.project.item(index).selected

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.

Boolean; read/write.


app.project.item(index).typeName

A user-readable name for the item type; for example, “Folder”, “Footage”, or “Composition”. These names are application locale-dependent, meaning that they are different depending on the application’s interface language.

String; read-only.

LocaleCompositionFolderFootage
en_USCompositionFolderFootage
de_DEKompositionOrdnerFootage
es_ESComposiciónCarpetaMaterial de archivo
fr_FRCompositionDossierMétrage
it_ITComposizioneCartellaMetraggio
ja_JPコンポジションフォルダーフッテージ
ko_KR컴포지션폴더푸티지
pt_BRComposiçãoPastaGravação
ru_ruКомпозицияПапкаВидеоряд
zh_CN合成文件夹素材
if (/Composition|Komposition|Composición|Composizione|コンポジション|컴포지션|Composição|Композиция|合成/.test(app.project.item(index).typeName)) {
// item is a composition
} else if (/Folder|Ordner|Carpeta|Dossier|Cartella|フォルダー|폴더|Pasta|Папка|文件夹/.test(app.project.item(index).typeName)) {
// item is a folder
}

app.project.item(index).addGuide(orientationType, position)

Creates a new guide and adds it to the guides object of the Item.

ParameterTypeDescription
orientationTypeInteger0 for a horizontal guide, 1 for a vertical guide. Any other value defaults to horizontal.
positionIntegerThe X or Y coordinate position of the guide in pixels, depending on its orientationType.

Integer; the index of the newly-created guide.

Adds a vertical guide at 500 pixels on the X axis to the activeItem of a project.

app.project.activeItem.addGuide(1, 500);

app.project.item(index).remove()

Deletes this item from the project and 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 the disk.

None.

Nothing.


app.project.item(index).removeGuide(guideIndex)

Removes an existing guide. Choose the guide based on its index inside the Item.guides object.

ParameterTypeDescription
guideIndexIntegerThe index of the guide to be removed.

Nothing.

Removes the first guide in activeItem.

app.project.activeItem.removeGuide(0);

Removing a guide will cause all higher guide indexes to shift downward.


app.project.item(index).setGuide(position,guideIndex)

Modifies the position of an existing guide. Choose the guide based on its guideIndex inside the Item.guides array.

A guide’s orientationType may not be changed after it is created.

ParameterTypeDescription
positionIntegerThe new X or Y coordinate position of the guide in pixels, depending on its existing orientationType.
guideIndexIntegerThe index of the guide to be modified.

Nothing.

Changes the position of the first guide in activeItem to 1200 pixels.

app.project.activeItem.setGuide(1200, 0);