item
Item object
Section titled “Item object”app.project.item(index)
app.project.items[index]
Description
Section titled “Description”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.
Example
Section titled “Example”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(); } } }}Attributes
Section titled “Attributes”Item.comment
Section titled “Item.comment”app.project.item(index).comment
Description
Section titled “Description”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.
Item.dynamicLinkGUID
Section titled “Item.dynamicLinkGUID”app.project.item(index).dynamicLinkGUID
Description
Section titled “Description”A unique and persistent identification number used for the dynamic link, in form of 00000000-0000-0000-0000-000000000000.
String; read-only.
Item.guides
Section titled “Item.guides”app.project.item(index).guides
Description
Section titled “Description”An array of guide objects, containing orientationType, positionType, and position attributes.
Array; read-only.
Item.id
Section titled “Item.id”app.project.item(index).id
Description
Section titled “Description”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.
Item.label
Section titled “Item.label”app.project.item(index).label
Description
Section titled “Description”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.
Item.name
Section titled “Item.name”app.project.item(index).name
Description
Section titled “Description”The name of the item as displayed in the Project panel.
String; read/write.
Item.parentFolder
Section titled “Item.parentFolder”app.project.item(index).parentFolder
Description
Section titled “Description”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.
Example
Section titled “Example”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" folderfor (var i = 1; i <= app.project.numItems; i++){ if (app.project.item(i) instanceof CompItem) { app.project.item(i).parentFolder = compFolder; }}Item.selected
Section titled “Item.selected”app.project.item(index).selected
Description
Section titled “Description”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.
Item.typeName
Section titled “Item.typeName”app.project.item(index).typeName
Description
Section titled “Description”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.
Localized strings
Section titled “Localized strings”| Locale | Composition | Folder | Footage |
|---|---|---|---|
en_US | Composition | Folder | Footage |
de_DE | Komposition | Ordner | Footage |
es_ES | Composición | Carpeta | Material de archivo |
fr_FR | Composition | Dossier | Métrage |
it_IT | Composizione | Cartella | Metraggio |
ja_JP | コンポジション | フォルダー | フッテージ |
ko_KR | 컴포지션 | 폴더 | 푸티지 |
pt_BR | Composição | Pasta | Gravação |
ru_ru | Композиция | Папка | Видеоряд |
zh_CN | 合成 | 文件夹 | 素材 |
Example
Section titled “Example”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}Methods
Section titled “Methods”Item.addGuide()
Section titled “Item.addGuide()”app.project.item(index).addGuide(orientationType, position)
Description
Section titled “Description”Creates a new guide and adds it to the guides object of the Item.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
orientationType | Integer | 0 for a horizontal guide, 1 for a vertical guide. Any other value defaults to horizontal. |
position | Integer | The X or Y coordinate position of the guide in pixels, depending on its orientationType. |
Returns
Section titled “Returns”Integer; the index of the newly-created guide.
Example
Section titled “Example”Adds a vertical guide at 500 pixels on the X axis to the activeItem of a project.
app.project.activeItem.addGuide(1, 500);Item.remove()
Section titled “Item.remove()”app.project.item(index).remove()
Description
Section titled “Description”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.
Parameters
Section titled “Parameters”None.
Returns
Section titled “Returns”Nothing.
Item.removeGuide()
Section titled “Item.removeGuide()”app.project.item(index).removeGuide(guideIndex)
Description
Section titled “Description”Removes an existing guide. Choose the guide based on its index inside the Item.guides object.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
guideIndex | Integer | The index of the guide to be removed. |
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Removes the first guide in activeItem.
app.project.activeItem.removeGuide(0);Removing a guide will cause all higher guide indexes to shift downward.
Item.setGuide()
Section titled “Item.setGuide()”app.project.item(index).setGuide(position,guideIndex)
Description
Section titled “Description”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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
position | Integer | The new X or Y coordinate position of the guide in pixels, depending on its existing orientationType. |
guideIndex | Integer | The index of the guide to be modified. |
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Changes the position of the first guide in activeItem to 1200 pixels.
app.project.activeItem.setGuide(1200, 0);