I’m attempting to map my actions to buttons in my UXP plugin. When setting the button to run the patch play function on-click it doesn’t work. However, when I reload the plugin it registers a click and runs the function. I’m brand new at UXP and only started learning Javascript to create a plugin for my company. Anyone that can help with a more comprehensive explanation would be my hero.
document
.getElementById("play-action")
.addEventListener("click", playAction('Wine Glass LASER'));
async function playAction(actionName){
const batchPlay = require("photoshop").action.batchPlay;
console.log("playing?")
const result = await batchPlay(
[
{
_obj: "play",
_target: [
{
_ref: "action",
_name: actionName
},
{
_ref: "actionSet",
_name: "Mockup Maker"
}
],
_options: {
dialogOptions: "dontDisplay"
}
}
],{
synchronousExecution: false,
modalBehavior: "wait"
});
}