layer - select all from source

What type of scripts do you need?

Moderator: byronnash

Post Reply
deusex
Posts: 1
Joined: June 28th, 2014, 1:02 pm

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: August 9th, 2012, 11:29 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!

Code: Select all

{

    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");
    }

}
Post Reply