When minVersion is 23.0.0. Below code to get selection bounds does not work.
const core = require("photoshop").core;
await core.executeAsModal(() => {
bounds = getSelectionBounds(activeDoc._id);
})
async function getSelectionBounds(documentId) {
try {
await core.executeAsModal(() => {
const result = batchPlay(
[
{
"_obj": "get",
"_target": [
{
"_property": "selection"
},
{
"_ref": "document",
"_id": documentId
}
],
"_options": {
"dialogOptions": "dontDisplay"
}
}
], {});
})
var x1 = result[0].selection.left._value;
var y1 = result[0].selection.top._value;
var x2 = result[0].selection.right._value;
var y2 = result[0].selection.bottom._value;
return [x1, y1, x2, y2];
} catch (error) {
return false;
}
}
Can you please help ?