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

How can I tell if a layer has a layer style by using a script?

Explorer ,
Dec 20, 2019 Dec 20, 2019

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

TOPICS
Actions and scripting

Views

2.0K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Dec 20, 2019 Dec 20, 2019

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
...

Votes

Translate

Translate
Adobe
Guest
Dec 20, 2019 Dec 20, 2019

Copy link to clipboard

Copied

Hi

You can filter the layers by effects

2019-12-20 12_36_05-BALLCHL.jpg @ 100% (RGB_8#) _.png

Votes

Translate

Translate

Report

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
Explorer ,
Dec 20, 2019 Dec 20, 2019

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

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 20, 2019 Dec 20, 2019

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)?

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 20, 2019 Dec 20, 2019

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.

JJMack

Votes

Translate

Translate

Report

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
Explorer ,
Dec 20, 2019 Dec 20, 2019

Copy link to clipboard

Copied

Thank you very much for your answer, it really works and the code is elegant.

Votes

Translate

Translate

Report

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
Explorer ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

LATEST

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();

 

Votes

Translate

Translate

Report

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
Explorer ,
Dec 20, 2019 Dec 20, 2019

Copy link to clipboard

Copied

Thank you very much for your answer, it really works and the code is elegant.

Votes

Translate

Translate

Report

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