Skip to main content
Joachim Hiller
Known Participant
February 4, 2019
Question

Get Layer - typename with AM

  • February 4, 2019
  • 2 replies
  • 2051 views

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

This topic has been closed for replies.

2 replies

Joachim Hiller
Known Participant
February 5, 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"));

}

Brainiac
February 5, 2019

Does not work in CS6.

No one-to-one correspondence with layer.typename

Joachim Hiller
Known Participant
February 5, 2019

as far as I tested that, the values for

     pixellayers = 1

     adjustmentlayers =  2

     smartobjects = 5

     groups = 7

Kukurykus
Brainiac
February 4, 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.

Jarda Bereza
Inspiring
February 4, 2019

Adobe forgot to create new typename for frame tool.

Kukurykus
Brainiac
February 5, 2019

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