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

Get Layer - typename with AM

Explorer ,
Feb 04, 2019 Feb 04, 2019

Copy link to clipboard

Copied

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

Views

1.7K

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

Adobe forgot to create new typename for frame tool.

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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.

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
People's Champ ,
Feb 04, 2019 Feb 04, 2019

Copy link to clipboard

Copied

What are you talking about?

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

Copy link to clipboard

Copied

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

}

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
People's Champ ,
Feb 05, 2019 Feb 05, 2019

Copy link to clipboard

Copied

Does not work in CS6.

No one-to-one correspondence with layer.typename

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

Copy link to clipboard

Copied

as far as I tested that, the values for

     pixellayers = 1

     adjustmentlayers =  2

     smartobjects = 5

     groups = 7

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
People's Champ ,
Feb 05, 2019 Feb 05, 2019

Copy link to clipboard

Copied

LATEST

There is also a single background, text, shape.

Your first script with LayerSection is more suitable.

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