Page 1 of 1

• Select all "Smart Objects" layers

Posted: Sat Jan 12, 2019 3:40 pm
by dimitric
Hello -

I would like to create an action for a colleague of mine.
In the "process" I need to select ONLY the "smart object" layers.
To do this I'm using the filtering option in the "layers" palette.
Unfortunately it works perfectly manually, but t isn't not recorded into the action.

Someone on Adobe's forum made a script but apparently we can only activate one "Smart Object" layer at a time.
So this script works, but it only activate 1 "Smart Object" layer.
Is there a way to modify the script that it activate ALL "Smart Object" layer present in the active document?
 
Thank you,
 
 

- Dimitri 
 
- - - - - - - - - - - - - - - - -
Here is the script:
 

Code: Select all

smartObjectLayerSelect();

function smartObjectLayerSelect() {
var docRef = activeDocument;
// var idlayersFiltered = stringIDToTypeID( "layersFiltered" );

for (var i = 0; i < docRef.artLayers.length; i++) {
var LayerRef = docRef.artLayers[i];
if (LayerRef.kind == LayerKind.SMARTOBJECT) {
docRef.activeLayer = LayerRef;
// Do stuff in here
// docRef.activeLayer.opacity = 50;
// docRef.activeHistoryState;
alert ("I am an alert box!  " + i);
}
}
}