Photoshop quick export occasionally doesn't work

Hi all :wave:

I have been developing a plug in for quite some time. For a few weeks I have used the export as png batch-play command to then load in a preview. A dirty solution, tbh.

Recently it has been failing to export and even the right-click and “Quick export as PNG” also no longer opens the file explorer. I have no way, aside from hard restarting, to fix the issue.

The command used:

 const exportCommand = {
          _obj: 'exportSelectionAsFileTypePressed',
          _target: { _ref: 'layer', _enum: 'ordinal', _value: 'targetEnum', _id: id },
          fileType: 'png',
          quality: 32,
          metadata: 0,
          destFolder: destFolder.nativePath,
          sRGB: true,
          openWindow: false,
          _options: { dialogOptions: 'dontDisplay' },
};
const commands = [selectCommand, exportCommand];

await action.batchPlay(commands, { modalBehavior: 'execute', synchronousExecution: true });

Sometimes the fix is to restart my laptop or forget cache or close, sometimes neither.

Thank you.

Another issue kept on popping up as well as the aforementioned one.


This error also shows after the export.

@OliverOBrien Did you figure out a solution? I am also hitting this issue very regularly (multiple times a day). It seems to be related to the amount of time the ‘exportSelectionAsFileTypePressed’ BatchPlay action is called.
When this bug happens, then even the native PS “quick export as PNG” will not work anymore either. The only solution I have found is the one described here: Quick Export as PNG not working after Photoshop 22… - Adobe Support Community - 12237643. But this requires all users of my plugin to restart PS multiple times a day…

Wondering if anyone knows a better fix, or alternatively another way to export a layer without going through ‘exportSelectionAsFileTypePressed’ ?

Thanks!

I have not found a solution to this.

Hello. Here are a couple of things to try.

It’s preferred to not use synchronousExecution. The replacement mechanism is executeAsModal. You can wrap the relevant script in it. This will require the use and/or migration to apiVersion 2, as outlined here.

I see that in @OliverOBrien’s sample that layers are being perhaps select’ed before attempting to export them. The _target is also invalid, as it contains both _enum and _id.

I would suggest retrieving the id of the relevant layer and updating the exportCommand with the following simplified _target.

_target: { _ref: 'layer', _id: id },
1 Like

This is indeed an internal bug with Photoshop. The only fix is to restart Photoshop and do a “File > Quick export to PNG” right after, before doing anything else. It will work then for about half an hour, until it breaks again.