get only the 'targetLayers' key from 'Dcmn' descriptor
Hi I'm working with very big documents, with a lot of layers, and I have a problem when trying to get the 'targetLayers' key from the 'Dcmn' descriptor Photoshop it's Building Histograms and this takes a lot of time, only for getting the selected layers...:( I know that there is the putProperty method, which works fine for Layers('Lyr ') or the Application('capp') but doesn't seam to work with documents
Does anyone has any idea on how to get only the 'targetLayers' key?
This is the code to get the selected layers indexes:
function getSelectedLayersIdx(){// get the selected layers index( positon in layer editor)
var selectedLayers = new Array;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var desc = executeActionGet(ref);
var add = 1;
if(hasBackground()){add = 0}
if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
var c = desc.count
var selectedLayers = new Array();
for(var i=0;i<c;i++){
selectedLayers.push( (desc.getReference( i ).getIndex()) + add);
}
}else{
var ref = new ActionReference();
ref.putProperty( charIDToTypeID('Prpr') , charIDToTypeID( 'ItmI' ));
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
srs = hasBackground()?executeActionGet(ref).getInteger(charIDToTypeID( 'ItmI' ))-1:executeActionGet(ref).getInteger(charIDToTypeID( 'ItmI' ));
selectedLayers.push( srs);
}
return selectedLayers;
}
and if I put this:
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
ref.putProperty(charIDToTypeID('Prpr'), stringIDToTypeID('targetLayers'));
var desc = executeActionGet(ref);
I get the error saying that "- The command "Get" is not currently available."