Hi,
With Photoshop 23 I am upgrading my Tools plugin to API 2.
Many of my “get” functions are rejected reading result[0].xxxxxx as undefined.
I have included an example which worked with API 1.
So, what did I miss?
const batchPlay = require("photoshop").action.batchPlay;
const app = require('photoshop').app;
const UXP = require("uxp");
const fs = require('fs');
const fs1 = require("uxp").storage.localFileSystem;
var exeModal = require('photoshop').core.executeAsModal;
async function getActiveLayeritemIndex (myName) {
await exeModal(() => {
const result = batchPlay(
[
{
"_obj": "get",
"_target": [
{
"_property": "itemIndex"
},
{
"_ref": "layer",
"_name" : myName
},
{
"_ref": "layer",
"_enum": "ordinal",
"_value": "targetEnum"
}
],
"_options": {
"dialogOptions": "dontDisplay"
}
}
],{
"synchronousExecution": true,
"modalBehavior": "execute"
});})
const myItemIndex = result[0].itemIndex;
console.log(myItemIndex);
return myItemIndex;
}