Skip to main content
Participant
May 22, 2020
Question

Photoshop Script Count Group Name

  • May 22, 2020
  • 1 reply
  • 1822 views

Hi,

I'm currently trying to export my count groups into a seperate file so that they can also be seen with simple image viewers.

This already works quite good, but I would like to use the name of the count group as part of my export filename.

Is there a way to get the count group name in my script? What would also be nice (but not necessarily required for my use case) is to get the color of the dots?

 

Thanks,

Lukas

 

What I already have:

 

    var ref = new ActionReference();
    ref.putProperty(charIDToTypeID('Prpr'), stringIDToTypeID("countClass"));
    ref.putEnumerated(charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var Count = executeActionGet(ref).getList(stringIDToTypeID("countClass")).count

    for (var groupNum = 0; groupNum < 10; groupNum++) {
        var layer = undefined;
        for (var z = 0; z < Count; z++) {
            var Group = executeActionGet(ref).getList(stringIDToTypeID("countClass")).getObjectValue(z).getUnitDoubleValue(stringIDToTypeID("group"));
            if (Group == groupNum) {
                if (layer == undefined) {
                    layer = createLayer("count " + Group);
                }
                var X = executeActionGet(ref).getList(stringIDToTypeID("countClass")).getObjectValue(z).getUnitDoubleValue(stringIDToTypeID("x"));
                var Y = executeActionGet(ref).getList(stringIDToTypeID("countClass")).getObjectValue(z).getUnitDoubleValue(stringIDToTypeID("y"));
                // TODO extract color of dot to draw new circle
                my_circle(X, Y);
            }
        }
        if (layer != undefined) {
            // TODO use group name instead of groupNum for saveAs
            saveAs(groupNum);
            layer.remove();
        }
    }

 

 

This topic has been closed for replies.

1 reply

Kukurykus
Legend
May 22, 2020
activeDocument.layerSets.length
lukhasAuthor
Participant
May 22, 2020

This is 0 in my case.

Kukurykus
Legend
May 22, 2020

The code I provided shows how many top level 'groups' you have in document.