Skip to main content
Participant
October 20, 2025
Question

How to move a lyer INTO a group with UXP

  • October 20, 2025
  • 0 replies
  • 41 views

Hi everyone  ! 
I am trying to do an uxp plugin for photoshop, and in that project I a m trying to recreate a script I made as an extended script to automate some actions. One of them I do pretty often is to move a layer inside a group once I made some changes. 
Such as : 

 
if (cameraLayer.parent !== infoATCGroup) {
            cameraLayer.move(infoATCGroup, ElementPlacement.INSIDE);
But I do not see any of this in the documentation for uxp and when I use what I see in the plugin Alchemist while moving a layer intoy a group, it does not work and occurs an error  when I try to use the same syntax in my uxp plugin. 
Here is an exemple of what I see with Alchemist : 
const {executeAsModal} = require("photoshop").core;
const {batchPlay} = require("photoshop").action;

async function actionCommands() {
   const result = await batchPlay(
      [
         {
            _obj: "move",
            _target: [
               {
                  _ref: "layer",
                  _enum: "ordinal",
                  _value: "targetEnum"}],
            to: {
               _ref: "layer",
               _index: 6 },
            adjustment: false,
            version: 5,
            layerID: [6],
            _options: {
               dialogOptions: "dontDisplay"
            }
         }
      ],
      {}
   );
}

async function runModalFunction() {
   await executeAsModal(actionCommands, {"commandName": "Action Commands"});
}

await runModalFunction();
​


Can anyone helpe me please ?