(Again) Create Layer on top of every other layer through pure batchPlay

I think so too (or it’s a weird logic). Anyway this change in 23.4.1 made me change hundreds lines of code :confused:

At least you found what works for you :slight_smile: Part of my plugin is still broken and no solution yet

Sorry man, I hope that you’ll find the solution soon. I’m not so happy because I’m fully aware that after next update everything can brake again. As I’m not a pro developer, it’s so hard for me to keep up with all the changes…

I don’t think it’s a bug. Layer > Arrange > Bring to Front has always moved the layer to the top of the group, or if it’s already at the top, to the top of the next outer group.

The fact that first / last doesn’t do anything rather shows that those enum values aren’t anything Photoshop expects for the move event.

These are the ordinal enums:
image

But not every event in Photoshop can handle all of them (or in some contexts they just don’t make sense)

Where did you find this?


My first suggestion was for the move action. But anyway… It doesn’t make sense to me when creating a new layer with nothing selected.

  • If there’re no groups, it’s created on top
  • If there’s a group, it’s created inside that group
  • If there’s a nested group, it’s created in top level of that group

If it were consistent, shouldn’t it create in the deepest level in 3rd case? Or if it moves layer to the top level of the group, why not move it to the very top outside the group? It just doesn’t make sense :man_shrugging:

Some documentation about actions / events from the Photoshop SDK (c/c++).
If you’re curious: Go to Loading... | Adobe Developer Console, search for “photoshop” and download the SDK there. The PDF I mentioned is under

pluginsdk/documentation/Photoshop Actions Guide.pdf

1 Like

I found that I had solved this problem before. In the process of making a new project, I found this code in an old project. This may be the simplest way.

await app.activeDocument.activeLayers[0].moveAbove(await app.activeDocument.layers[0]);

1 Like

Hi @MrL,

I can confirm that it works, thank you!

For anyone interested that’ the code with adding the layer:

  const newlayer = await doc.createLayer({})
  await app.activeDocument.activeLayers[0].moveAbove(await app.activeDocument.layers[0]);
2 Likes

Is Layer.moveAbove() a new or deprecated method? The API docs only mention Layer.move() which takes an insertLocation parameter.

https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/layer/#move