Wiki

Clone wiki

aequery / Selector

aeq( selector, context )

aeq( string ) aeq( string, object ) aeq( string, array )

  • Description:
    • Gets objects by looking at a string and finding objects in After Effects matching the description. The context is used to determine a starting point for where the function starts looking for elements.
  • Parameters:
    • selector: A string containing a selector expression
    • context: The object to start looking from, on of:
      • CompItem
      • FolderItem
      • Layer
      • PropertyGroup
      • Array containing any of the above
  • Returns:
    • ArrayEx object of the elements

The selector has 3 expression types:

  • type
  • props
  • pseudo

Type

The type of object to find, one of:

  • comp / composition: finds CompItems
  • layer: find Layers
  • prop / property: finds properties
  • effect: finds effects
  • key: finds keyframes on properties. Returns aeq.Key objects

The types can be chained after each other. But must be in the order above, but all of them are optional. Only the objects of the last specified type will be returned.

Type is the only expression type that is required. All other expression types are optional.

Props

written right after the type, without a space, and inside square brackes ( [ ] ). The props are a list attribute names and values, separated by =. The objects must have an attribute with the specified value to qualify as a match. Attributes are separated by a space.

If the value should be true, only the attribute name is required.

Examples:

Get all comps with width and height of 1920x1080:

aeq("comp[width=1920 heigth=1080]");

Get all properties of layers that are selected and does not have audio:

aeq("layer[selected hasAudio=false] prop");

Props are optional, but cannot come after pseudo selectors.

pseudo

Psoudo are a bit like props but start with a colon, :, followed by a keyword specifying how the attributes should match. The attributes are places inside parenthesis, ( ). The keywords that are currently supported are:

  • :is(): all attributes must match.
  • :not(): objects should not have any attributes matching the props.

Psoudo selectors can be chained.

Examples:

Get properties that have PropertyValueType.OneD and are not selected.

aeq("prop[propertyValueType=" + PropertyValueType.OneD + "]:not(selected)");

Get layers that do not have audio inside comps that are selected:

aeq("comp:is(selected) layer:not(hasAudio)");

Updated