Hello, i have a task to get all solidFill effects by layer, get color from each and put it to layer name. I test it with one “Color Overlay” effect and its work. But that shld i do for execute several “Color Overlay” effects?
I need to put each color from each “Color Overlay” effect to name by hex. My code for one effect:
if (BridgeTalk.appName == "photoshop")
{
var doc = app.activeDocument;
var layers = activeDocument.artLayers;
for (var i=0; i<layers.length; i++)
{
doc.activeLayer = layers[i];
solidFill();
}
}
function solidFill()
{
var fxDesc = getFxDesc();
doc.activeLayer.name = fxDesc.p
var solidDesc = getSolidFillDesc(fxDesc);
}
function modifyLayerName(desc)
{
var colObj = desc.getObjectValue(stringIDToTypeID("color"));
var redHex = (0 + colObj.getDouble(charIDToTypeID("Rd ")).toString(16)).slice(-2);
var grnHex = (0 + colObj.getDouble(charIDToTypeID("Grn ")).toString(16)).slice(-2);
var blHex = (0 + colObj.getDouble(charIDToTypeID("Bl ")).toString(16)).slice(-2);
doc.activeLayer.name = '#' + redHex + grnHex + blHex;
}
function getFxDesc(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
if(desc.hasKey(stringIDToTypeID('layerEffects'))){
var fxDesc = desc.getObjectValue(stringIDToTypeID('layerEffects'));
}
if(undefined != fxDesc) return fxDesc;
else doc.activeLayer.name = "nothing";
};
function getSolidFillDesc(desc)
{
if(desc.hasKey(stringIDToTypeID('solidFill'))){
var solidFillDesc = desc.getObjectValue(stringIDToTypeID('solidFill'));
}
if(undefined != solidFillDesc) return solidFillDesc;
}
plz help me: how should i get all “Color Overlay” effect by layer?