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

**URL:** <https://forums.creativeclouddeveloper.com/t/batchplay-select-layer-doesnt-work-when-multiple-layers-have-the-same-name/2416>\
**Category:** UXP Plugin API\
**Created:** [January 6, 2021, 3:22pm UTC](https://forums.creativeclouddeveloper.com/t/batchplay-select-layer-doesnt-work-when-multiple-layers-have-the-same-name/2416 "2021-01-06T15:22:09Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [July 3, 2022, 4:49pm UTC](https://forums.creativeclouddeveloper.com/t/batchplay-select-layer-doesnt-work-when-multiple-layers-have-the-same-name/2416/15 "2022-07-03T16:49:55Z")

</div>

@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:

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

```

Full function to get descriptors:

```auto
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"}
            }
        ))
    ];
};

```

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/batchplay-select-layer-doesnt-work-when-multiple-layers-have-the-same-name/2416)._
