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
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.
Copy link to clipboard
Copied
Adobe forgot to create new typename for frame tool.
Copy link to clipboard
Copied
You mean Frame tool by Action Manager? But it can be accessed by proper number?
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.
Copy link to clipboard
Copied
What are you talking about?
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"));
}
Copy link to clipboard
Copied
Does not work in CS6.
No one-to-one correspondence with layer.typename
Copy link to clipboard
Copied
as far as I tested that, the values for
pixellayers = 1
adjustmentlayers = 2
smartobjects = 5
groups = 7
Copy link to clipboard
Copied
There is also a single background, text, shape.
Your first script with LayerSection is more suitable.