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

Where can I find the numeric list of layerKind?

Participant ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

I have this function which get some layers data and then do some stuff. If you see at line 24, there is an if condition "if (lyr.type == layerType" and for example, if I want to choose shape layers I have to put the number 4 using a prompt. My question is, where does this number come from? Why 4? What is 3 or 5? Where can I find a list of what is what?

Thank you for your time!!!

function getLayersData()

    {

        var lyrs = [];

        var layers = 1;

        while (true)

        {

            ref = new ActionReference();

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

           

            try

            {

                var desc = executeActionGet(ref);

            }

            catch (err)

            {

                break;               

            }

           

            var lyr = {};

            lyr.type = desc.getInteger(stringIDToTypeID("layerKind"));

            lyr.name = desc.getString(charIDToTypeID("Nm  "));

            lyr.id = desc.getInteger(stringIDToTypeID("layerID"));

           

            if (lyr.type == layerType && lyr.name.match(layerName))

            {

                var adj = desc.getList(stringIDToTypeID("adjustment")).getObjectValue(0);

                if (adj.hasKey(stringIDToTypeID("color")))

                {

                    var curColor = new SolidColor();

                    curColor.rgb.red = adj.getObjectValue(stringIDToTypeID("color")).getUnitDoubleValue(stringIDToTypeID("red"));

                    curColor.rgb.green = adj.getObjectValue(stringIDToTypeID("color")).getUnitDoubleValue(stringIDToTypeID("grain"));

                    curColor.rgb.blue = adj.getObjectValue(stringIDToTypeID("color")).getUnitDoubleValue(stringIDToTypeID("blue"));

                    lyr.color = curColor;

                    if (lyr.color.rgb.hexValue == currentColor[0])

                    {

                        lyrs.push(lyr);                                       

                    }                     

                }               

            }

            layers++;           

        }

        return lyrs       

    };

TOPICS
Actions and scripting

Views

885

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

People's Champ , Jul 05, 2019 Jul 05, 2019

Votes

Translate

Translate
Adobe
LEGEND ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

You can't without trying. In Domestic Oriented Model they are specified but not by Action Manager.

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
Participant ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

I am not sure if I get what you mean...

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

Copy link to clipboard

Copied

DOM is based on AM, and thanks to favour or creators in that first there are used names instead of numbers.

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
Guide ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

Create various types of layer and run this against each layer.

You should find that some types have the same number I.E Curves and Levels are 2

alert(getAdjType());

function getAdjType(){

var ref = new ActionReference();

ref.putIdentifier(charIDToTypeID( "Lyr " ), activeDocument.activeLayer.id );

var desc =  executeActionGet(ref);

var kind = desc.getInteger(stringIDToTypeID("layerKind"));

if( desc.hasKey( stringIDToTypeID( "adjustment" ) ) ){

return "Kind = " + kind + " Name = " + typeIDToStringID(desc.getList (stringIDToTypeID("adjustment")).getClass (0));

}else{

    return "Kind = " + kind;

    }

};

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
Participant ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

Thank you very much my friend, this is what I was looking 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
Participant ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

I found these six basic types of layers. I leave them here if someone else need them and if I found more I'll post them...

1 for pixel layers.
2 for adjustment layers.
3 for text layers (or type layers).

4 for shape layers.

5 for smart object.

7 for groups or artboards.

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

Copy link to clipboard

Copied

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
Participant ,
Jul 06, 2019 Jul 06, 2019

Copy link to clipboard

Copied

LATEST

r-bin Thank you very much for the link!!!

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