How to run and action in UXP plugin

Hi,
I am trying to run an action in batch play.
I don’t know how to get an action by name but after some trial and error I got the correct action like this:

async function convertToLink(){
   const { app, core, action } = require("photoshop");
   act = app.actionTree[3].actions[10];
   console.log("running " + act.name);
   await act.play();
}

The log prints the right action but the play() does not run it.
What am I doing wrong?

if you do a quick search in the forum you will find some similar issues and solution by others
check this link, it may help you.
cheers:

http://forums.creativeclouddeveloper.com/t/execute-a-script-via-a-button/3699/9?u=wanokuni

Thanks, it is more or less what I am doing.
I copied the solution in the post you pointed to, and it is still not working.
I debugged it till I got to this part:
if (setFound == true && actionFound == true) { await actionToPlay.play(); }
Both conditions are true but it does not play the action.
Which is the same problem which occurred in my function.
What can prevent from playing the action?
I am using latest version of PS (23).

Does your action contain a script? Like JSX or something? If so, it won’t work. But I think it also should show an error. Do you get anything in console?

Yes, it contains a jsx script.
I am trying to get a list of all layercomps in a doc.
This API is still missing and I cant get it via batch play either.
In ExtendedScript it is very easy.

I just tried to change it and use s different action, one without jsx script.
It does not run either

@karpiyon Check my update on that thread, hope this can help you.
http://forums.creativeclouddeveloper.com/t/execute-a-script-via-a-button/3699/16?u=wanokuni

It’s working now and running the JSX script.
Nice workaround.
Perhaps you could also solve this one…