Skip to main content

Ae Project Items

The blocks in this section allow you to do all kinds of things with project items - i.e. all the footage, compositions, solids, bins etc that are listed in the project panel (and its sub-bins). Note that if a project item is a composition, you can also use the blocks in the section Ae Comp with it, which gives you access to functionality that is specific to comps only.

Accessing a Particular Project Item

Automation Blocks represents project items with a text - like a path indicating where the item can be found. You can specify a particular project item as follows:

  • Project Item and Project Bin blocks. The Project Item Block and the Project Bin Block are the easiest way to specify an item path, if the item already exists in your project. Just select the item in your project, click the block's refresh button and it will generate the item path for you.

  • Name: If the project item has a unique name, just use a text block with the name my item name

  • Path: You can also give a path to where the item can be found, like /bin/subbin/my item name. If you provide the full path instead of a name, Automation Blocks does not need to search your entire project, which makes the script faster. Also. you'll avoid getting into trouble if multiple project items have the same name. Note that a string Comp 1 searches for a project item in all bins of the project panel, whereas /Comp 1 only looks for it in the root bin.

  • Layer or Property If you have a layer or property of a layer you can use it as argument of any block that expects a project item. Automation Blocks will convert it to the project item of the layer's source automatically. If the layer has no corresponding project item (i.e. is a text, shape, camera or light layer, for example) the project item of the comp is used instead. You can also use the layer's source item attribute.

  • Compostions Since compositions are project items, you can use compositions (like the Active Comp block, for example) as arguments for any blocks which expect a project item.

Project Item

Block ae_item_path

This block is used inside other blocks whenever you need to specify a particular project item. Just select a project item in the project panel and click the block's refresh icon to choose it.

Project Item vs Text

Technically, a Project Item block is a simple Text block which allows you to create the texts of project item paths very conveniently.

Say you have a project item "myVideo.mp4" inside the project bin "footage" - you can simply reference it with a Text block and enter the text footage/myVideo.mp4. But instead of a Text block, it is much more convenient to use a Project Item block. With the Project Item block you don't need to type the path manually, and instead just use the refresh button to generate it automatically.

Project Bin

Block ae_itembin_path

This block is identical to the Project Item Block, except that it only allows you to select project bins and no other items. By default, this block is empty, which represents the root bin of the project.

The Only Selected Project Item

Block block_ae_get_only_selected_item

In situations where you expect the user to have selected exactly one item in the project panel, you can use this block to access this selected item. The block will stop with an error message if you have no or multiple project items selected.

Item vs Bin

In the dropdown list you can set an option to accept

  • only items
  • only bins
  • both items and bins

In the first case, the block also stops with an error if the only selected project item is a bin and in the second case it stops with an error if it is not a bin.

For Each Project Item

Block block_ae_for_all_items_in_bin

The block is a loop which allows you to do something with all project items (or all selected project items). The blocks you plug into this block are executed many times - names one time for each of the project items.

Parameters

my item variable

The block creates a variable my item. Each time the blocks you plug into the loop are executed, this variable has a different value - namely the Project Item that the loop is processing at that time.

project bin

Here you can choose a bin of your project to only loop over the items contained in that bin. If you leave this control empty, the root bin of the project panel will be used. Using the dropdown before the parameter, you can choose to process only the items in the project bin, or also the ones contained in subbins.

only selected items

With this checkbox you can limit the block to only loop over project items which are selected in the project panel. If you want to loop over all selected items of the project, make sure to set the option project bin to project bin and sub-bins, because otherwise only the selected items in the root bin of the project are considered.

allowed types

With these checkboxes you can limit the block to only loop over items of specific types. To loop over all comps in the project, for example, just keep the composition checkbox checked and uncheck all others.

Example

This example shows one alert message for each project item in the root bin of the project panel. In the message box, the name of the respective item is shown.

Example: Looping over project items

List of Project Items

Block block_ae_get_items_in_bin

This block is similar to the block For Each Project Item, but instead of looping over the project items, it creates a list of them. The parameters are exactly the same as the parameters of the For Each Project Item block.

Example

This script uses the List of Project Items in combination with the Select Project Items block, to select all footage items in the project bin with the name "scene 1". Note that we have chosen in bin and sub-bins so that items included in sub-bins of the bin "scene 1" will also be selected.

Example: Looping over project items

For Each Layer with Source Item

Block block_ae_for_all_layers_with_source_item

This block is a loop which allows you to do something with all the layers (in the entire project) which use a particular project item as source. If the project item is a composition, it will loop over all layers which are precomps using exactly that composition, for example. And if the project item is a video clip, it will loop over all layers which contain this video clip as source.

my layer

This block executes the blocks you plug into it many times, namely once for each layer that has the given item as source. Before those blocks are executed, the variable my layer is set to the layer that is considered in this repetition of the loop. If the project item is used in three layers, for example, then the blocks are executed three times and each time the variable my layer is one of these three layers.

item(s)

Here you can either specify a single project item or an entire list (array) of project items. The block will then loop over all layers which use one of these project items as their source.

Get Attribute of Project Item

Block ae_item_get_attribute

Returns one of the attributes of the given project item, like its file, framerate, or label color. For a description of all available attributes, see Set Attribute of Project Item. Note that compositions are also project items. To access properties that are specific to compositions you need to use the block Get Attribute of Comp (which also accepts a project item as argument, if this project item is a comp).

Set Attribute of Project Item

Block ae_item_set_attribute

Sets any of the available attributes of a project item. After you choose an attribute, the inputs of the block change as needed for that attribute. Note that compositions are also project items. To set properties that are specific to compositions, you need to use the block Get Attribute of Comp (which also accepts a project item as argument, if this project item is a comp).

The available attributes of project items are listed below. If an attribute is marked as read-only, you can only get but not set this attribute.

alpha mode

The alpha mode of After Effects' Interpret Footage dialog. If you get this value, it will be one of the following texts

  1. IGNORE
  2. STRAIGHT
  3. PREMULTIPLIED

If you set this value, you can either set it to one of the texts above, or to one of the numbers 1-3. Upper/lower case is ignored. So, instead of the text IGNORE, you can also use the number 1, or the text ignore.

You can get and set this attribute for items of type FootageNoSolidItem, for other items it will produce an error.

comment

The comment text for a project item. To see the comments in the project panel, right-click on the title row of the project panel and choose Columns->Comment from the menu. This will reveal an extra column in the project panel which shows the item comment.

duration (read-only, except for comp items)

The duration of the project item in seconds. For details on time values see Ae Time.

file

The file of the project item. If you set this value, the result is the same as if you right click the item in the project panel and choose Replace Footage->File....

footage missing (read-only)

A logic value true or false indicating if the file of the project item is missing on the hard-drive.

frame duration

The duration of a single frame in seconds. If the frame rate of the comp is 25fps, for example, the duration is 1/25s = 0.04s. Don't use this value for items which have no video (like bins or still images).

frame rate

The number of frames per second of the project item. Don't use this value for items which have no video (like bins or still images).

You can get and set this attribute for items of type FootageNoSolidItem and CompItem, for other items it will produce an error.

Setting the frame rate attribute on footage items has the same effect as the "conform to frame rate" option of Ae's Interpret Footage dialog

frame rate (native)

Same as the frame rate attribute, unless you change the frame rate of a footage item using the "conform to frame rate" option of Ae's Interpret Footage dialog (or by setting the frame rate attribute with Automation Blocks). In that case, the frame rate (native) still contains the original frame rate of the footage file, whereas frame rate contains the conformed frame rate.

has alpha (read-only)

Alogic value true or false indicating if the item has an alpha channel. This value is only relevant for items of type FootageNoSolidItem. For comps it is always true and for bins and solids it is always false.

has audio (read-only)

A logic value true or false indicating if the project item has audio contents.

has video (read-only)

A logic value true or false indicating if the project item has video contents (this is also true for still images).

height

The height of the video in pixels. Only use this if the attribute has video is true. See also the attributes width and size.

id (read-only)

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.

invert alpha

Alogic value true or false which corresponds to the "Invert Alpha" option of Ae's Interpret Footage dialog. You can get and set this attribute for items of type FootageNoSolidItem, for other items it will produce an error.

is still

Alogic value true or false indicating if this item is a still image. This value is only relevant for items of type FootageNoSolidItem.It is always false for comps, bins and solid items.

label color HexCode (read-only)

The label color of the project item as hex color string (like #ff0000 for 100% red, for example).

label color id

The ID of the label color (0 for None, or 1 to 16 for one of the preset colors in the Labels preferences)

label color name

The label color name of the project item as configured in the Labels preferences (like Red, Sea Foam, or None).

By default, the block to set the label color name shows a convenient dropdown where you can pick any of the default label colors. Note that this dropdown does not update when you have configured custom label color names. If you have configured custom label colors in the preferences, you can either drag a Text block on top of the dropdown and enter the custom label name manually, or you set the label color using the color id.

loop

A number corresponding to the loop option of Ae's Interpret Footage dialog. You can set this attribute for items of type FootageNoSolidItem, for other items it will produce an error.

name

The name of the project item as shown in the project panel.

Renaming breaks variables

Note that project items are accessed in Automation Blocks by name or path. If you have stored in a variable the path footage/myVideo.mp4, for example, and you then rename the project item to new name, the old variable cannot access the project item anymore, since there is no item with the name myVideo.mp4 in the bin footage anymore.

Workaround: Usually it works best to only rename a project item after you've done all the other things you might want to do with it (so you don't need to access it anymore). Alternatively, you can update the variable to footage/new name (for example with the block Replace in Text).

parent bin

The bin of the project panel, in which the project item is located. Set this value to move the item to another project bin. If you enter a path of a project bin, which does not yet exist, the block creates the bin for you.

This example moves the project item Comp 1 from the folder work in progress to the folder final:

pixel aspect

The pixel aspect ratio of the video (1 for the default, square pixels).

proxy

The proxy file of this item or null if the item has no proxy. When you set a proxy, it is enabled automatically. To enable/disable it later, use the attribute user proxy.

To remove existing proxies, set this value to null.

selected

A logic value true or false indicating whether the item is selected in the project panel. Note that setting this attribute for an item does not change the selection of any other items (i.e. keeps everything else selected that has been selected before).

To change the selection in the project panel, you can either set this attribute or use the block Select Project Items .

size [w,h]

A list (array) containing the width and height of the video in pixels. Only use this if the attribute has video is true. If you only need one of the two values, use the attributes width and height instead.

time

The current time of the item when it is being previewed directly from the Project panel (in seconds). For details on time values see Ae Time.

tree path (read-only)

The full path of the project item in the project panel. For the item myVideo.mp4 in the bin footage the tree path would be footage/myVideo.mp4. To move the item into a different project bin, set the parent bin attribute.

If you need the path of the corresponding footage file instead of the path of the item itself, use the attribute file instead.

type (read-only)

One of the following text values:

  • CompItem if the project item is a Composition
  • FootageNoSolidItem if the video is a footage file (video or audio or image) but not a solid (which would technically also be footage).
  • SolidItem if the project item is a solid
  • FolderItem if the project item is a project bin

type name (localized)

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. Note that Footage can also be a solid item. To distinguish between solid and other footage, and get language-independent values, use the attribute Type instead.

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合成文件夹素材

use proxy

A logic value true or false. When true, a proxy is used for the item.

You can set this value if you want to enable or disable an already configured proxy for this project item. To set a new proxy (or remove it) use the attribute proxy instead.

used in (comp list) (read-only)

A list (array) of the compositions which uses this footage item.

width

The width of the video in pixels. Only use this if the attribute has video is true. See also the attributes height and size.

Select Project Items

Block block_ae_item_select

Use this block to control which items are selected in the project panel. As an argument you can either give a single Project Item or a list (array) of project items.

Parameters

  • select project items selects all the given project items and deselects everything else that has been selected before.
  • add to project selection selects all the given project items and also keeps everything selected that has been selected before.
  • remove from project selection deselects all given project items (and ignores the ones that are not selected).

Example

If you select some footage layers in the active composition and then run this script, it will select their corresponding project items in the project panel, too:

Example: select the project items of selected layers

To retrieve a list of the selected footage layer, we use the block List of Layers. Also note that Automation Blocks notices that the Select Project Items block expects project items, but you can give it layers instead. Therefore, according to the rules outlined here, Automation Blocks converts the list of layers into a list of their corresponding project items automatically.

Another example for the Select Project Items block can be found here.

Get/Set Selected Attribute

With the blocks Get Attribute of Project Item and Set Attribute of Project Item, you can also retrieve and change the selection status of an individual project item (by choosing the attribute Selected).

Delete Project Items

Block block_ae_item_delete

This block deletes project items from the project panel. You can give either a single Project Item or a List of Project Items as an argument.

Example

This script deletes all project items which are currently selected in the project panel. To create a list of all selected project items, it uses the block List of Project Items.

Example:Delete all selected items from project panel

Project Item Exists

Block ae_item_exists

This block returns a logic value which is true if the given project item exists.

See also the Property Exists block.