Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Plugin and Companion App SDK
Viewing all articles
Browse latest Browse all 54282

Array of selected layers - how to get it

$
0
0

Hello Everybody

 

I'm looking for a way to get all the selected layers as array.

 

With app.activeDocument.activeLayer i can select only the top-most of the selected layers.

 

 

There is a way to achieve this in ExtendScript:

 

function getSelectedLayers() {   var layerArray = new Array;      var desc = new ActionDescriptor();         var ref = new ActionReference();         ref.putClass( stringIDToTypeID('layerSection') );      desc.putReference( charIDToTypeID('null'), ref );         var layerRef = new ActionReference();         layerRef.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );      desc.putReference( charIDToTypeID('From'), layerRef );      executeAction( charIDToTypeID('Mk  '), desc, DialogModes.NO );   var tempLayerSet = app.activeDocument.activeLayer.layers;   for ( var layerIndex = 0; layerIndex < tempLayerSet.length; layerIndex++ ) {      layerArray.push( tempLayerSet[layerIndex] );   }   executeAction( charIDToTypeID('undo'), undefined, DialogModes.NO );   return layerArray;
};

 

 

How can i do that using Photoshop SDK?

 

 

Thanks in advance.


Viewing all articles
Browse latest Browse all 54282

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>