Skip to main content
Known Participant
January 16, 2018
Question

Test for Layer Effects applied to a layer

  • January 16, 2018
  • 3 replies
  • 604 views

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.

This topic has been closed for replies.

3 replies

Jarda Bereza
Inspiring
January 17, 2018

You can check my script "clear hidden effects" Magic scripts for Photoshop

There is a lot things about effects.

Kukurykus
Legend
January 17, 2018

function sTT(v) {return stringIDToTypeID(v)}

(ref = new ActionReference()).putEnumerated(sTT('layer'), sTT('ordinal'),

sTT('targetEnum')), executeActionGet(ref).hasKey(sTT('layerEffects'))

Legend
January 17, 2018

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; }

    }

Known Participant
January 17, 2018

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?