ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

select all the layers with the same name

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Israel Diaz
select all the layers with the same name
on Dec 20, 2017 at 10:10:50 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


Return to posts index

Dan Ebberts
Re: select all the layers with the same name
on Dec 20, 2017 at 2:20:45 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



Return to posts index

Nick Smith
Re: select all the layers with the same name
on Nov 30, 2018 at 2:59:50 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.


Return to posts index


Dan Ebberts
Re: select all the layers with the same name
on Nov 30, 2018 at 4:58:37 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



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]