List of core.performMenuCommand() parameter or quit Photoshop from script

It is not really user to do, but quitting Photoshop from plugin is one of critical path in current CEP’s automation test. So I’d like to do same on UXP.

Is there list of core.perforMenuCommand() parameter available?
I wonder if Menu: File > Exit (Ctrl+Q) can be used.

In ExtendScript, following code works.

    var id = charIDToTypeID( "quit" );
    executeAction( id, undefined, DialogModes.ALL );

id has the value of 1903520116

So I tried following, but it does not work.

require('photoshop').core.performMenuCommand(
    {
        commandID:1903520116,
        kcanDispatchWhileModal:true,
        _isCommand:false
    }
);

It shows “pending”, “fulfilled”, but nothing happen.
Similar way worked for “ZoomFitToScreenSize”.

Am I missing something or any other way (to quit Photoshop from script)?

Thank you,
Naoki

command ID is not string ID. And I think the action manager code should still work.

1 Like

Hi @Jarda ,

Thank you for the reply.
But I’m not sure your comment.

command ID is not string ID.

Yes, so I converted charIDToTypeID( “quit” ) in ExtendScript and verified it is 1903520116.
And used performMenuCommand().
I’m not sure if it is correct way. But it does not work.

And I think the action manager code should still work.

It works on ExtendScript, but it does not work on UXP.

So I’m still looking for way to quit Photoshop within UXP.

Thank you,
Naoki

I think if you get “menuBarInfo” property of the Application class then it shows also commandIDs?

1 Like

Hi @Jarda

Thank you very much for updated info.

I could not located the “menuBarInfo”. But I got commandID number from your Alchemist plugin.

Following code is verified works for quitting Photoshop from UXP as same as menu command.

var result = require('photoshop').core.performMenuCommand(
    {
        commandID:36, // 36 == Menu: File > Quit (got info from Alchemist UXP plugin)
        kcanDispatchWhileModal:true,
        _isCommand:false
    }
);

Thank you,
Naoki

2 Likes