New Error in Photoshop Latest Version: "Action Commands" pop-up?

Plugin with a button to Place Embedded… Randomly, when I try this function to Place Embedded, using a CommandID, about 5/10 times, I get an error and a pop-up, with the title Action Commands, and I can’t continue…unless I click the layer I was on before. But this just started with Photoshop 24.1.1 and not resolved in 24.5.

Anyone know about this, or a fix? I can’t be the only one. Ugh.

async function addPhoto() {
const psCore = require(‘photoshop’).core;
psCore.performMenuCommand({ “commandID”: 1032 });
}

async function addPhotoClick() {
await require(“photoshop”).core.executeAsModal(addPhoto, {“commandName”: “Action Commands”});
}

Reliance on UI state is not good practice. But sometimes it is the only way. But for placing layers as smart objects there is an alternative and would recommend using it instead.

If you don’t want to… there are some commands to check menu item availability or force the PS document to redraw/update. Giving PS a bit more time to update menus could make the command available.

Thank you. What would be the alternative to File > Place Embedded… as opposed to my “commandID” above?

Basically, there are a few other steps, but it gets caught on Place Embedded… What I need is for the button to open a Window for the user to be able to select an image to place… we don’t have a specific image, so I can’t set a path. So the button creates layers, and then Place Embedded pops up the window and the user selects the image and it’s placed. This all worked prior to 24.1.1 … Now it works about 60% of the time without the error.

What would be a work around?

You could use Alchemist to record “place” event. And also UXP file picker to generate token to be used in action descriptor. Or maybe you could set dialogMode in “place” action descriptor to show dialog too.