Problem with invoking "Export As" via batchplay in the latest version of Photoshop

Hi,

I’m having a problem with opening File/ Export/ “Export As…” function.
It did work in one of the previous releases of PS.

I was trying to record an Action, add Menu item and then convert it to Batch Play via Occultist but it doesn’t work.

This is what Action records:
Screenshot 2022-02-10 at 12.37.33

This is what Occultist gets:

   {
      _obj: "select",
      _target: [
         {
            _ref: "menuItemClass",
            _enum: "menuItemType",
            _value: "exportDocumentAsDialog"
         }
      ],
      _options: {
         dialogOptions: "dontDisplay"
      }
   }

I was also trying to use Alchemist to record event but it also doesn’t work:

   {
      _obj: "invokeCommand",
      commandID: 3443,
      kcanDispatchWhileModal: true,
      _options: {
         dialogOptions: "dontDisplay"
      }
   },
   {
      _obj: "featureInfo",
      active: false,
      command: "getFeatureActive",
      _options: {
         dialogOptions: "dontDisplay"
      }
   }

No matter what I do I’m just getting errors:


Do you have any idea how to fix it? Thank you!

1 Like

How about this? Render layer example
And change params to show dialog?

Hi Jarda,

I can’t find a piece of code that would do what I want, maybe I’m missing something.
My goal is simple - to open Export As dialog window:

   {
      _obj: "select",
      _target: [
         {
            _ref: "menuItemClass",
            _enum: "menuItemType",
            _value: "exportDocumentAsDialog"
         }
      ],
      _options: {
         dialogOptions: "dontDisplay"
      }
   }

Change dialogOptions: "dontDisplay" to dialogOptions: "display".

Unfortunately it doesn’t work for me. That’s the whole piece of code for this function, I’m still getting an error:

async function exportas() {

   await core.executeAsModal(() => {
 
      batchPlay(
         [ 

            {
               _obj: "select",
               _target: [
                  {
                     _ref: "menuItemClass",
                     _enum: "menuItemType",
                     _value: "exportDocumentAsDialog"
                  }
               ],
               _options: {
                  dialogOptions: "display"
               }
            }
         
         ], {});
      })
      }
      
document.getElementById("btnexportas").addEventListener("click", exportas);

Is it possible that you don’t have a document open?

I do have it open :slight_smile: I’m using PS v23.1.1 and the plugin based on API 2. That’s the only function that doesn’t work at all. I guess that something was changed in the lates versions of PS reg. export and it’s not fixed yet.

Working fine for me on Mac with v23.1.1 and API 2.
This error also occurs when PS is in a state where calling this command is not possible. For example when no document is open. Basically always when “Export as” is greyed out in the main menu.

Weird, no matter what I do, it doesn’t work. I have the file opened, I can access export as from the menu but the script doesn’t work.

const psCore = require('photoshop').core;
psCore.performMenuCommand({ "commandID": 3443 });

That works, thank you!

Be aware, that in very rare cases even command ID can change on Ps update. Like it happened for Select > Subject on upgrade v23.1 to v23.2

1 Like