Copy link to clipboard
Copied
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.layerSets);
for(var layerIndex=0; layerIndex < layerNode.artLayers.length; layerIndex++) {
var layer=layerNode.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);
The "This functionality might not be available in this version of Photoshop"-error is pretty common that is often caused by either having wrong doc active or wrong layer selected or otherwise trying to execute something that does not apply to that object at the moment (e.g. wrong layer type, locked layer). Like that action or then changing the fill might require layer to be selected.
Copy link to clipboard
Copied
The "This functionality might not be available in this version of Photoshop"-error is pretty common that is often caused by either having wrong doc active or wrong layer selected or otherwise trying to execute something that does not apply to that object at the moment (e.g. wrong layer type, locked layer). Like that action or then changing the fill might require layer to be selected.
Copy link to clipboard
Copied
Oh, thank you so much. Now I get it... So I can just set the selected/active layer to the current layer in the loop, then it works.
Copy link to clipboard
Copied
That might be the issue. Like said, that error is pretty generic "you did something that happened to fail this time". Many functions/actions require the layer/document in question to be the active/selected so worth a try.