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

Get Layer - typename with AM

Explorer ,
Feb 04, 2019 Feb 04, 2019

Hi,

is there a way to get the layer typename via the AM? 

Here's the code as far as I already have it. All I need is the typename.

getMinInfoByIdx = function (idx) {

    try {

        var ref = new ActionReference();

        //Ebene anhand des Indexes auswählen

        ref.putIndex(cTID('Lyr '), idx);

        var desc = executeActionGet(ref);

        //Abrufen um was es sich bei der Ebene handelt ("layerSectionStart" ist eine Gruppe)

        var layerSection = typeIDToStringID(desc.getEnumerationValue(sTID('layerSection')));

        //Alle Informationen zusammenfassen

        var info = {

            name: desc.getString(cTID('Nm  ')),

            visible: desc.getBoolean(cTID("Vsbl")),

            id: desc.getInteger(sTID("layerID")),

            layerSection: layerSection,

        };

        return info;

    }

    catch (e) {

        alert(e + "\n" + e.line);

    }

};

Thanks in advance for the help

Joe

TOPICS
Actions and scripting
2.0K
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
LEGEND ,
Feb 04, 2019 Feb 04, 2019

Layer typename is easier to get by dom, since by AM you're getting numbers you must find what layer kind they stand for.

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 ,
Feb 04, 2019 Feb 04, 2019

Adobe forgot to create new typename for frame tool.

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 ,
Feb 04, 2019 Feb 04, 2019

You mean Frame tool by Action Manager? But it can be accessed by proper number?

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 ,
Feb 04, 2019 Feb 04, 2019

It just looks like a group in AM and DOM. Not very easy to find what is group and what is frame 😄

Maybe they fixed it but I guess they didn't.

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 ,
Feb 04, 2019 Feb 04, 2019

What are you talking about?

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
Explorer ,
Feb 05, 2019 Feb 05, 2019

I have found a workaround and use the "layerKind" property.

That solves my problem. I just need to know if it is a Pixellayer or Smartobject

function getLayerKindByIdx(idx) {

    var ref = new ActionReference();

    //Ebene anhand des Indexes auswählen

    ref.putIndex(charIDToTypeID('Lyr '), idx);

    return executeActionGet(ref).getInteger(stringIDToTypeID("layerKind"));

}

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 ,
Feb 05, 2019 Feb 05, 2019

Does not work in CS6.

No one-to-one correspondence with layer.typename

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
Explorer ,
Feb 05, 2019 Feb 05, 2019

as far as I tested that, the values for

     pixellayers = 1

     adjustmentlayers =  2

     smartobjects = 5

     groups = 7

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 ,
Feb 05, 2019 Feb 05, 2019
LATEST

There is also a single background, text, shape.

Your first script with LayerSection is more suitable.

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