Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Find selected Layers with part of name.

  • Find selected Layers with part of name.

  • Fabian Brugger

    February 6, 2023 at 10:29 am

    Is it possible to get to all selected layers that have, for example, the name scale in its name.

    So the layer would be called something like: Frame1_Icon1_Scale

    And i want to find all layers with the ending Scale or with Scale in its name anywhere (whatever is possible) to animate it through a script.

    I write this but it just finds the exact name:

    var comp = app.project.activeItem;

    var layers = comp.selectedLayers;

    for (var i = 0; i < layers.length; i++) {

    if (layers[i].name = “scale”) {

    var scalelayerkeys = layers[i].property(“Transform”).property(“Scale”)






  • Filip Vandueren

    February 6, 2023 at 1:28 pm


    if (layers[i].name.indexOf("scale")>-1) {

    or for case insensitive matching:

    if (layers[i].name.match(/scale/gi)!==null) {
  • Fabian Brugger

    February 6, 2023 at 1:45 pm

    The .indexOf version does exactly what i want.

    But will use the one with case insensitive matching so it has less possibilities for errors

    Thank you!

Viewing 1 - 3 of 3 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy