Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

How to access smartobjects within for-loop?

$
0
0

Hi everybody,

 

I am working on a script that that changes the color of all the layers in a psd-document called "Fill". This works fine. However, now I would like to expand the functionality and make it check through all my smart-objects and check whether they have any layers called "Fill". If yes, then change their color as well.

So far I could only find script-listener code which doesn't work for me. It always gives the same error. It's in German, but roughly translates to "General Photoshop error. This functionality might not be available in this version of Photoshop..."

I tested it in CS5 and the newest CC version, both with the same results.

 

Are there any other ways?

 

Here is the code I used:

 

function openSmart(layerNode) {   

    for (var i=0; i<layerNode.length; i++) {

 

 

        openSmart(layerNode[i].layerSets);

 

 

        for(var layerIndex=0; layerIndex < layerNode[i].artLayers.length; layerIndex++) {

            var layer=layerNode[i].artLayers[layerIndex];

            if (layer.kind == LayerKind.SMARTOBJECT) {

                layer.visible = 1;

                var idAction = stringIDToTypeID( "placedLayerEditContents" );

                var idDesc = new ActionDescriptor();

                executeAction(idAction, idDesc, DialogModes.NO);

            }

        }

    }

}

 

 

openSmart(app.activeDocument.layerSets);


Viewing all articles
Browse latest Browse all 12244

Trending Articles



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