BatchPlay: Select layer doesn't work when multiple layers have the same name

@karpiyon, this is not really related to original topic and IMO should be as a separate one, but here’s how you should do it… You should select first layer as usual and then each consecutive descriptor must have:

"selectionModifier": {"_enum": "selectionModifierType", "_value": "addToSelection"}

Full function to get descriptors:

const getSelectIdsActions = function (ids) {
    return [
        {
            "_obj": "select",
            "_target": [{"_ref": "layer", "_id": parseInt(ids[0])}],
            "makeVisible": false
        },
        ...ids.slice(1).map(id => (
            {
                "_obj": "select",
                "_target": [{"_ref": "layer", "_id": parseInt(id)}],
                "makeVisible": false,
                "selectionModifier": {"_enum": "selectionModifierType", "_value": "addToSelection"}
            }
        ))
    ];
};
2 Likes