Why can only selected layers be moved in Photoshop UXP.
const app = require(‘photoshop’).app;
const doc = app.activeDocument;
let lays= Array.from(doc.layers);
await lays[2].translate(0,110);
await lays[3].translate(0,220);
await lays[4].translate(100,330);
If a layer is not selected, this movement is invalid. If a layer is selected, all movement methods will apply to the selected layer.
How to write another operation using action descriptors,
Is the code below invalid?
const { batchPlay } = require(“photoshop”).action;
const { executeAsModal } = require(“photoshop”).core;
const command1 =[{
“_obj”: “move”,
“_target”: [{
“_ref”: “layer”
}],
“layerID”: 98,
“to”: {
“_obj”: “offset”,
“horizontal”: {
“_unit”: “pixelsUnit”,
“_value”: -105
},
“vertical”: {
“_unit”: “pixelsUnit”,
“_value”: 0
}
}
}]
await executeAsModal(() => {
batchPlay(command, {});
}, {
commandName: “moveLay”
});