Apologies if this stuff is super obvious but I haven’t found any documentation that explains how to get around the newly added executeAsModal.
The code below worked as expected in API1 but after adding the await exeModal(() => {} around the batchplay i’m not sure how get feed the result to the if statement after
const exeModal = require('photoshop').core.executeAsModal;
//Checks to see if the layer has a mask
async function checkMask(layer) {
layer = app.activeDocument.activeLayers[0].name
await exeModal(() => {
const result = batchPlay(
[
{
"_obj": "get",
"_target": [
{
"_property": "hasUserMask"
},
{
"_ref": "layer",
"_name": layer
},
],
}
], {
});
console.log(result[0].hasUserMask)
}) //<-- how to get result outside the exeModal?
if (result[0].hasUserMask == true) {
await deleteUserMask();
} else {
return
}
}