Questions about api2

Because of my work, I haven’t paid attention to uxp for several months. Recently, I found that uxp has api2 version, and some contents of API1 are deleted. I want to know where I can learn the details of api2?

You’re not the only one having this question. I’m also following this topic:
https://forums.creativeclouddeveloper.com/t/converting-uxp-plugin-to-api-2/3719/4

1 Like

Yes, I just want to know what functions api2 has deleted, but I haven’t found the relevant information. Now I have suspended the development of my new plug-in.

I think this page has the documention that you need but it is giving a 404 error right now. The Adobe “stage” documents have lots of intermittent 404 error issues.

https://developer-stage.adobe.com/photoshop/uxp/2022/ps_reference/media/executeasmodal/

The main thing with API 2 is running the execute as modal. See this post here.

Also, if you want to see a basic working example of using executeAsModal in API 2 then download this sample plugin. Just change the .ccx to .zip and you can view the files. I made this for a bug report to give to Adobe for a text resizing bug. However, the executeAsModal part works as it should.

https://damonbell.com/downloads/text-resize-bug_PS.ccx

2 Likes

@ddbell
Thank you very much for sharing the sample. It is very helpful.
I verified my code is working with executeAsModal.

So it looks like following for batchPlay() part.

API 1:
async function test(){
await require(‘photoshop’).action.batchPlay([
{…JSON…}
], {})
}

API 2:
async function test(){
await require(‘photoshop’).core.executeAsModal(async function(){
await require(‘photoshop’).action.batchPlay([
{…JSON…}
], {})
});
}