I get almost all my batchPlay from Alchemist also. You can also get it from “Copy as Javascript” in the Photoshop actions fly-out menu to convert actions to batchPlay.
I don’t think many UXP developers (except for maybe some at Adobe) write it from scratch. I’ve also not seen a comprehensive catalog of batchPlay code. That said, sometimes people have parameters for it that I don’t know where they got it either.
The technology underlying batchPlay (Action Descriptor?) seems to have maintained a similar structure for quite a long time. Thus, the following resources may be of interest to you.
Photoshop Actions Guide.pdf from the Photoshop SDK, which can be downloaded from the Adobe Developer Console
According to the link you provided, PNG24 is saved as export and PNG8 is saved as save for web. This part is translatable to batchPlay because it uses Action Descriptor instead of ExtendScript commands.
Both use syntaxes like new File(path), which is the type that UXP basically blocks. With the right permissions and getEntryWithUrl it might be possible to achieve this.
It seems to limit export to one layer by showing the target layer and hiding the other layers.
I saw some old plugin does that or maybe Photoshop itself does it back to idk 2,4,6 years ago?
This is the worked batchPlay code I got and modified the path a bit so It can export all the layers with prefix and groups as folders…
I’ve to add a 100ms delay in for … of loop so it can be done. Faster than the script in the link I provided ( Which creates a new document and idk…)
Idk, why it didn’t work yesterday but now It seems to work.
And does the .jsx script in the link? Does it ExtendScript or Action Descriptor? Is it similar to the UXP Plugins? Thank you for helping!!
The script jsx in the link you provided is ExtendScript. However, it uses Action Descriptor for some of the processing, such as exporting.
The Action Descriptor used in ExtendScript is superficially different from the one used in the UXP Plugin’s batchPlay, but essentially the same. This means that they can be cross-translated.
You are right. I re-read the code again and seems like it does copy to the new document, select the exporting layer and hide others then use the saveAs function for duplicate documents close it then repeat. It seems like the code is similar so I can look up the document https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes
Doing that seems like it opens another ability to do more with the layer like scale, padding… or more export file types.
But I just want to export it as png and it already trimmed the layer so it’s fine for me now. Thank you!