Expressions/Scripts/Presets

Moderator: byronnash

 
deusex
Topic Author
Posts: 1
Joined: Sat Jun 28, 2014 1:02 pm

layer - select all from source

Sun Jun 29, 2014 8:56 am

Here is a copy of my mail to adobe, but I doubt they will pay any attention. I think such a function can easily be implemented by script and I hope it will be useful!

"layer - select all from source"

I want to be able to select all layers that originate from the same source in the project. For example, when I cut 1 video file 98 times, all of these 98 layers originate from the same source file, no matter their layer name or label color.
 
Iaenic
Posts: 14
Joined: Thu Aug 09, 2012 11:29 am

Re: layer - select all from source

Wed Aug 13, 2014 10:49 am

Sorry it took so long to get a reply. The code below should work for selecting items with the same source, just select an item and run the script.

EDIT: Fixed the bugs!

{

    var myComp = app.project.activeItem;
   
    if (myComp.selectedLayers.length != 0) {
       
    var myLayers = myComp.selectedLayers;
    var myNumLayers = myComp.numLayers;
   
    y=1;
             while (y <= myNumLayers) {     
                 
                 if (myComp.layers[y].source == null) { y++ }
                 
    if ( myComp.layers[y].source.name == myLayers[0].source.name ) {
   myComp.layers[y].selected = true;
   }
else {
       myComp.layers[y].selected = false;
       }
y++;

    }
   
}
   

else {
    alert("Please select a layer");
    }

}

Who is online

Users browsing this forum: No registered users and 3 guests