Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Test for Layer Effects applied to a layer

Community Beginner ,
Jan 16, 2018 Jan 16, 2018

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.

TOPICS
Actions and scripting
574
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Beginner ,
Jan 16, 2018 Jan 16, 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 16, 2018 Jan 16, 2018

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

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 17, 2018 Jan 17, 2018
LATEST

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

    }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 16, 2018 Jan 16, 2018

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

There is a lot things about effects.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines