Copy link to clipboard
Copied
I want to use a script to find out which layers have layer styles, but I haven't found relevant information. Does anyone know how to do this?
Subject modified by Moderator
If you use Google Search you can find code to do that on this site. You will find code like this. Test if activeLayer has a layer effect.
alert(haslayerEffects());
function haslayerEffects() {
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var options = executeActionGet(r);
return options.hasKey(stringIDToType
...
Copy link to clipboard
Copied
Hi
You can filter the layers by effects
Copy link to clipboard
Copied
Thank you for your answer. Unfortunately, it's not what I want. I mean to use script to judge whether a layer has a style
Copy link to clipboard
Copied
Do you mean when a layer style has been applied but is now rasterized so it can't be separated into its own layer, and there's no way (other than eyeballing it and guessing) to tell what it was (i.e. inner shadow, inner glow, etc as in the dropdown shown in Ged's reply)?
Copy link to clipboard
Copied
If you use Google Search you can find code to do that on this site. You will find code like this. Test if activeLayer has a layer effect.
alert(haslayerEffects());
function haslayerEffects() {
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var options = executeActionGet(r);
return options.hasKey(stringIDToTypeID("layerEffects"))
}
catch (e) {alert(e) }
}
I extracted that from script to remove all layer effects
You often need to use Action manager code which I do not know how to code I can hack on the action manager code Adobe scriplistener plug-in records. However, for the executeActionGet code required the get information I need to use search and find. It would be better if this web site search was useable.
Copy link to clipboard
Copied
Thank you very much for your answer, it really works and the code is elegant.
Copy link to clipboard
Copied
I'll add another thanks since I'm using this 🙂
The following line can be removed since the rest of the function only uses the action reference object (tested).
var d = new ActionDescriptor();
Copy link to clipboard
Copied
Thank you very much for your answer, it really works and the code is elegant.