How to suppress warning dialogs for document.duplicateLayers

Hi everyone

Does anyone know if there is a way to suppress warning dialogs when using document.duplicateLayers
to paste layers into another document?

Due to a color profile mismatch I get the current dialog:

If the user saw this before and chose “Don’t show again” then it’s not a problem.
Otherwise this will show up and cause issues with the code that follows it.

Thank you for your help!

Henrique \\ TMMW
Text Replacer for Premiere Pro | Clips Exporter | Thumbs Up | Selector for Premiere Pro

@Tom Is this another dialog that needs to change?

Are you sure you have app.displayDialogs = DialogModes.NO; before your call in your script?

1 Like

Hi Tom

How can I get this DialogModes contant?

const PHXS = require(“photoshop”);
const app = PHXS.app;

Could not find it in the documentation or in the required photoshop and app instances.

Thanks

Henrique \\ TMMW
Text Replacer for Premiere Pro | Clips Exporter | Thumbs Up | Selector for Premiere Pro

Ah, UXP. I think it is something like this: const bpOptions: CommandOptions = {
dialogOptions: “dontDisplay”,
modalBehavior: “execute”,
};

    const activeDoc = app.activeDocument;

    const desc = [
        selectDocument(docRef.id(this.id)),
        closeDocument(false),
        selectDocument(docRef.id(activeDoc.id)),
    ];

    batchPlaySync(desc, bpOptions);
}

Hi Tom

Thanks for the additional info.
But I believe this is not it yet.

This solution is for calling batchPlay but I’m calling from the api
via document.duplicateLayers.

Let me know if this makes sense and if you have any other suggestions.

Thanks

Henrique \\ TMMW
Text Replacer for Premiere Pro | Clips Exporter | Thumbs Up | Selector for Premiere Pro

AFAIK, the DOM api as it’s currently written doesn’t give you an easy way to override this. @Barkin – do you have any thoughts in how the DOM api should handle these kinds of cases?

That dialog is controlled by the Color Settings preferences. At the moment, you’d have to set that preference to off via the Color Settings dialog or via batchPlay:

[
    {
        "_obj": "set",
        "_target": [
            {
                "_property": "colorSettings",
                "_ref": "property"
            },
            {
                "_ref": "application"
            }
        ],
        "to": {
            "_obj": "colorSettings",
            "askMismatchPasting": false
        }
    }
]

Thanks @kerrishotts!

Thanks @samgannaway but with that batchPlay I actually found out that there are
two dialogs that can open in that situation.

The one from my original post and this one:

if(askWhenPasting){
this new dialog shows up
}else{
the original shows up
}

In my case askWhenPasting was already off.

I’ve now found out why my code was breaking with the dialogs so it
works independently of that, but would be nice to be able to turn these
off in the future.

Hmm, I only get that dialog when “Ask When Pasting” is checked.
Going from second document with different profile.

require("photoshop").core.executeAsModal(async () => {console.log(await require('photoshop').app.activeDocument.activeLayers[0].duplicate(require('photoshop').app.documents[0]))})