Open "Export As" window with UXP or batch play

Anyone have an idea how to open new Export As window with UXP or Batch play?

I really need this for my script.

Thank you!

Alchemist listener doesn’t record anything useful. Maybe I’m doing something wrong?

Not sure how command IDs are consistent among platforms (Win/Mac) and version upgrades, but I think performMenuCommand() is what you’re looking for. I’ve read somewhere here on forum, that only negative command IDs are not consistent, but can’t confirm.

Command ID you’re looking for, is 3443 for Export As...
You can get all commands from menuBarInfo (thanks @Jarda)

    ps.action.batchPlay([
            {
                "_obj": "get",
                "_target": [
                    {"_property": "menuBarInfo"},
                    {"_ref": "application", "_enum": "ordinal", "_value": "targetEnum"}
                ]
            }
        ], {
        synchronousExecution: true,
        modalBehavior: 'execute'
    })[0]

Or you could record action in action panel where you would click ā€œadd menu itemā€ in action panel menu. Then save .atn file and load it with Occultist to see what code will be generated.

1 Like

Thank you so much! It’s exactly what I was looking for!

Thank you Jarda, I don’t thought about that. It’s a great solution.

This is what works for me:

async function saveforweb() {


   await core.executeAsModal(() => {

     
      batchPlay(
         [ 
            {
               _obj: 'select',
               _target: 
                  {
                     _ref: 'menuItemClass',
                     _enum: 'menuItemType',
                     _value: 'exportDocumentAsDialog'
                  }
               ,
               _options: {
                  dialogOptions: 'display'
               }
            }
         
         ], {});
      })
      }
1 Like

Did you get this from Occultist? I think this might come in handy for me also at some point

Yes, I’ve created an Action, added menu item, then I’ve saved an action and opened it in Occultist.

The only thing I’ve changed was dialogOptions: ā€˜dontDisplay’ —> display

1 Like