# Move Layer to Front through batch-play works differently in PS 23.4.1

**URL:** <https://forums.creativeclouddeveloper.com/t/move-layer-to-front-through-batch-play-works-differently-in-ps-23-4-1/4814>\
**Category:** UXP Plugin API\
**Tags:** batch-play\
**Created:** [June 17, 2022, 1:56pm UTC](https://forums.creativeclouddeveloper.com/t/move-layer-to-front-through-batch-play-works-differently-in-ps-23-4-1/4814 "2022-06-17T13:56:16Z")\
**Posts on this page:** 1\
**Showing post:** 36

<div class="post-metadata">

**Author:** ![MrL](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@MrL](https://forums.creativeclouddeveloper.com/u/MrL)\
**Post date:** [June 23, 2022, 6:14pm UTC](https://forums.creativeclouddeveloper.com/t/move-layer-to-front-through-batch-play-works-differently-in-ps-23-4-1/4814/36 "2022-06-23T18:14:09Z")

</div>

This is my code. It can activate layers. Maybe it can help you.

```auto
    await ActiveLayer()
    async function ActiveLayer() {

        let cl = await app.activeDocument.activeLayers[0];

        if (cl == undefined) {
            let layers = await require("photoshop").app.activeDocument.layers;
            await require("photoshop").core.executeAsModal(async () => {
                try {

                    await require("photoshop").action.batchPlay([{
                        "_obj": "select",
                        "_target": [{
                            "_ref": "layer",
                            "_id": layers[0]._id
                        }],
                        "_isCommand": true
                    }, ], {
                        "synchronousExecution": false
                    });
                } catch (e) {
                    console.error(e);
                }
            }, {
                commandName: "Test"
            });
        }
    }

```

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/move-layer-to-front-through-batch-play-works-differently-in-ps-23-4-1/4814)._
