Hello!
I would like to create a script in javascript for Photoshop CC that does the following:
1) Check each layer in the current document
2) If the layer is named "fillMe" then color it in a specific color but lock the transparent pixels (in German it's called "Transparente Pixel fixieren")
I imagine that there might be several ways to go about this. Maybe applying a "Color Overlay" layer style with the desired color would work.
I have tried to find a good solution but cannot find any information on how to lock the pixel transparency with code. Also I would like to access a color picker window for the color selection.
Could you kindly direct me to the right tutorials/resources?
Thank you in advance!
Edit: So far I have got this with the help of the Script Listener, but it won't run as "this function might not be available in the new version of Photoshop"
function showBounds(layerNode) {
for (var i=0; i<layerNode.length; i++) {
showBounds(layerNode[i].layerSets);
for(var layerIndex=0; layerIndex < layerNode[i].artLayers.length; layerIndex++) {
var layer=layerNode[i].artLayers[layerIndex];
if (layer.name == "fillMe") {
layer.visible = 1;
layer.transparentPixelsLocked = 1;
var idFl = charIDToTypeID( "Fl " );
var desc8 = new ActionDescriptor();
var idUsng = charIDToTypeID( "Usng" );
var idFlCn = charIDToTypeID( "FlCn" );
var idFrgC = charIDToTypeID( "FrgC" );
desc8.putEnumerated( idUsng, idFlCn, idFrgC );
executeAction( idFl, desc8, DialogModes.NO );
}
}
}
}
showBounds(app.activeDocument.layerSets);