Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions select all the layers with the same name

  • select all the layers with the same name

    Posted by Israel Diaz on December 20, 2017 at 10:10 am

    Hello.

    I will like select all the layer with the same name..

    var aDoc = app.project.activeItem.layer(“Blackmagic Production Camera 4K”).selected = true;

    If you dont mind help me.

    Thank you

    Dan Ebberts
    replied 7 years, 5 months ago
    3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    December 20, 2017 at 2:20 pm

    Try this:


    var myComp = app.project.activeItem;
    for (var i = 1; i <= myComp.numLayers; i++){
    myComp.layer(i).selected = (myComp.layer(i).name == "Blackmagic Production Camera 4K");
    }

    Dan

  • Nick Smith

    November 30, 2018 at 2:59 pm

    Hi.

    Hope it’s okay to add one more question here. Ist there a way to use this script to select layers that have the partly the same name? Let’s say I’ve got this layers:

    rendering_1
    Video
    rendering_2
    rendering_blue
    Picture

    How can I select all the layers that share the ‘rendering’ part in their name by using a script like yours?

    Thank you.

  • Dan Ebberts

    November 30, 2018 at 4:58 pm

    You could do something like this:


    var myComp = app.project.activeItem;
    for (var i = 1; i <= myComp.numLayers; i++){
    myComp.layer(i).selected = (myComp.layer(i).name.indexOf("rendering") > -1);
    }

    Dan

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