Interesting! @ddbell Your code actually works well for me. for either run normal actions or a JSX script.
const app = require("photoshop").app;
const batchPlay = require("photoshop").action.batchPlay;
const ExecuteAsModal = require("photoshop").core.executeAsModal;
async function playAction(setName, actionName) {
let setFound = false;
let actionFound = false;
const actionSets = require("photoshop").app.actionTree;
// check for action set name to exist
for (let i = 0; i < actionSets.length; i++) {
if (actionSets[i].name == setName) {
var setToPlay = actionSets[i];
setFound = true;
}
}
//check for action name to exist
if (setFound == true) {
for (let i = 0; i < setToPlay.actions.length; i++) {
if (setToPlay.actions[i].name == actionName) {
var actionToPlay = setToPlay.actions[i];
actionFound = true;
}
}
}
//play if action set/action both exist
if (setFound == true && actionFound == true) {
await actionToPlay.play();
}
}
document
.getElementById("action1")
.addEventListener("click", async function () {
await ExecuteAsModal(() => playAction("Actions set Name", "Action 1"));
});
but I have notice different behaviour based on how I run the JSX.
if I have the JSX play like this
It won’t work And I get this error:
but if I set it to play an action from another set that contain JSX file it works
btw: I am in Photoshop 23.4.1 api 2 manifest 5