How to trigger Window > Arrange options?

Hey everyone!

I’m playing with my first PS plugin and I wanted to use some of the Windows > Arrange options (specifically “New Window from” and then “2-tile vertically”), but I can’t find a way to do so.

I thought I could use core.performMenuCommand, but I can’t figure out what commandID matches those menu options. Is there a list of all commandIDs somewhere?

On a more general note, I can’t find any API to manipulate windows and workspace elements (position and size), is this out of scope of PS plugins?

Cheers,
Max

You can do this with Batchplay and menuItemClass.
(There is no option 2 Tile Vertically (At least on my system), so this ex demonstrates 2 Up Vertical.)
Check the below code:

const {executeAsModal} = require("photoshop").core;
const {batchPlay} = require("photoshop").action;

async function actionCommands2UpVertical() {
   const result = await batchPlay(
      [
         {
            _obj: "select",
            _target: [
               {
                  _ref: "menuItemClass",
                  _enum: "menuItemType",
                  _value: "2upVertical"
               }
            ],
            _options: {
               dialogOptions: "dontDisplay"
            }
         }
      ],
      {}
   );
}

export default async function runModalFunctionResetView() {
   await executeAsModal(actionCommands2UpVertical, {"commandName": "Action Commands"});
}

You can replace any menuIem/command by converting menu item name into camelCase like 2 Up Vertical converted to 2upVertical. (Note - I have not tried every menuItem/Command)

1 Like