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