How to call HDR command?

This is the code I’m listening to, but it doesn’t work.

require("photoshop").action.batchPlay([
   {
      "_obj": "AdobeScriptAutomation Scripts",
      "javaScript": {
         "_path": "C:\\Program Files\\Adobe\\Adobe Photoshop 2021\\Required\\HDRToning.jsx",
         "_kind": "local"
      },
      "javaScriptMessage": "undefined",
      "_isCommand": true,
      "_options": {
         "dialogOptions": "display"
      }
   }
],{"synchronousExecution": false,"modalBehavior": "fail"});

You have to use a token instead of path.

Hello, how to use the token

It’s finally working!

var tempFun = async function () {

    const PluginFolder = await FS.getPluginFolder();

    const theTemplate = await PluginFolder.getEntry("HDRToning.jsx");

    const Token=await FS.createSessionToken(theTemplate);

    await PS.action.batchPlay([{

        "_obj": "AdobeScriptAutomation Scripts",

        "javaScript": {

            "_path": Token,

            "_kind": "local"

        },

        "javaScriptMessage": "undefined",

        "_isCommand": true

    }], {});

}

tempFun();

Hey there – I’m glad you found a solution. Note, however, that this is not going to work long-term, as ExtendScript is not technically supported by UXP. As such, it’s likely that the mechanism you’re using here will stop working. Furthermore, it requires redistributing part of Photoshop (HDRToning.jsx) alongside your plugin, which is also not something you should do.

(In general: if you need to execute ExtendScript, the correct way to do that in UXP is to convert that ExtendScript to modern JavaScript. Adobe does not support interfacing with ExtendScript from UXP.)

I’m sure there’s a batchPlay command to do this equivalent, however, this works just as well:

const core=require("photoshop").core;
core.performMenuCommand({
    title: core.translateUIString("$$$/Menu/Adjust/HDRToning")
});

If this doesn’t fully meet your needs, please describe in more detail how you’re using the HDR Toning feature, and we can help further.

3 Likes

Thank you very much, this is exactly the code I want

@kerrishotts Do you know where I can find a list for all functioning “zstring”?

Or a list of commandID’s, as it seems these can be used too.

1 Like

Here, you can have mine: ZStrings

2 Likes

Thanks @Pierre_G you are always kind. @DavideBarranca gave me the list of zstrings (I think it is the same list), unfortunately I have seen that many zstrings do not work. I was wondering if there was a list of zstrings that work.

You’re welcome! I have extracted these zstrings from PS2021, so I believe they are valid. How to use them is another kettle of fish :sweat_smile:

There’s no “list” other than extracting them from the app itself.

So far, the only ZStrings I’ve seen work in this case are those that are added dynamically (and talk to JSX scripts). Otherwise you have to use commands, but I’m not aware of any authoritative list of those.

1 Like