batchPlay JPEG quality settings not being updated. It always saves at 11/12. Why?

Here’s the code I use to save a Photoshop document as a JPEG, using a variable that contains the JPEG quality save settings:

    const result = await app.batchPlay([
        {
            "_obj": "save",
            "as": {
                "_obj": "JPEG",
                "options": {
                    "extendedQuality": image_save_quality,
                }
            },
            "in": {
                "_path": outputFileToken,
                "_kind": "local"
            },
            "documentID": app.activeDocument._id,
            "copy": true,  // required to ensure it saves as JPEG; without this, it saves as .psd; 
            "overwrite": true,
            "_isCommand": true,
            "_options": {
                "dialogOptions": "dontDisplay"
            }
        }
    ], {
        "synchronousExecution": true,
        "modalBehavior": "fail"
    });

    console.log(result);

} catch (error) {
    console.error("Error:", error);
}

}

The variable values are correct, as I confirm by console logging its values. However when I console log the return object of this command? It always shows “extendedQuality = 11”, no matter what I set it to in the code. Why does this happen?

Is there some other setting I have marked in there that overrides the specified quality settings to default it back to 11?

Thanks

Your original topic has already provided a solution, see my reply if you want to use DOM, or Wanokuni’s reply if you want to use batchPlay.
http://forums.creativeclouddeveloper.com/t/when-i-try-to-save-as-jpeg-it-saves-as-psd-instead-why

1 Like