Copy link to clipboard
Copied
I have a pretty complicated script I've been working on but coming up against an issue.
There is a portion of it I want to run only if a selected layer has Layer Effects applied to it. I have been searching all over this forum and haven't found the answer other than someone stating that it's possible. How does one detect Layer Effects?
Any help would be greatly appreciated.
Copy link to clipboard
Copied
I know there is a command to Copy Layer Effects "CpFX" that will fail the JS if the layer has no Effects applied to it. Is there some way to just test if the command is available?
Copy link to clipboard
Copied
function sTT(v) {return stringIDToTypeID(v)}
(ref = new ActionReference()).putEnumerated(sTT('layer'), sTT('ordinal'),
sTT('targetEnum')), executeActionGet(ref).hasKey(sTT('layerEffects'))
Copy link to clipboard
Copied
The presence of the layerEffects key is possible even when the layer does not have standard blending options, but there are no effects. The following function can help. It checks the availability of the scaleEffectsEvent command.
function has_visible_effects()
{
try {
executeAction( stringIDToTypeID( "scaleEffectsEvent" ), undefined, DialogModes.NO );
return true;
}
catch (e) { return false; }
}
Copy link to clipboard
Copied
You can check my script "clear hidden effects" Magic scripts for Photoshop
There is a lot things about effects.