I managed to get it to work, without it throwing the “Unsupported type in descriptorToObject”.
I commented all the other options that might be causing the issue hoping that they would have a default value, and it seems as though they do. Also, I am saving the a folder which UXP allows me to write to: const dataFolder = (await UXP.storage.localFileSystem.getDataFolder()).nativePath.replace(/\\/g, "\\\\")
I have yet to try if it works in .getTemporaryFolder() too.
This code is helping me a lot. I modified to javascript. It works nicely when exporting only one layer. But I want to modify the function to get an array of layers as an input. It doesn’t quite work, photoshop is overwriting the files on top of each other, instead of exporting every layer with different names. My file has unique layer naming.
Do you see where is the error on my logic?
async function exportLayerAsPngTestMultipleCommands(layers, path){
try {
Btw I tried to run your original function inside a for loop, and I get also the issue of the files being overwritten. I guess I’m using BatchPlay in the wrong way. Is difficul to find official documentation of batchplay, how did you find keywords like ‘exportSelectionAsFileTypePressed’? This post seems to be the only place on the internet where that is mentioned
For my case, I only run one pairs of selectCommand and exportCommand in action.batchPlay. It means for multiple layers, l did multiple batchPlays in a loop, it would be slower compared to single call of batchPlay, but I need to do it to get through all the layers in one psd.