Skip to main content
Participating Frequently
September 2, 2018
Answered

How to suppress the color profile dialog (CC 2018)

  • September 2, 2018
  • 4 replies
  • 3059 views

Hi,

how do you suppress solely the color profile dialog  in a script (JavaScript) when opening a file, but not all dialogs?

This topic has been closed for replies.
Correct answer Geppetto Luis

black_square  ha scritto

Yes, I mean the dialog appearing when the embedded profile does not match the working color space and I want to suppress it by some code, not the settings.

these are the codes

// Disable color profile

var desc6 = new ActionDescriptor();

var desc7 = new ActionDescriptor();

var ref1 = new ActionReference();

ref1.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "colorSettings" ));

ref1.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));

desc6.putReference( charIDToTypeID( "null" ), ref1 );

desc7.putBoolean( stringIDToTypeID( "askMismatchOpening" ), false );

desc7.putBoolean( stringIDToTypeID( "askMismatchPasting" ), false );

desc7.putBoolean( stringIDToTypeID( "askMissing" ), false );

desc6.putObject( charIDToTypeID( "T   " ), stringIDToTypeID( "colorSettings" ), desc7 );

executeAction( charIDToTypeID( "setd" ), desc6, DialogModes.NO );

// Enable color profile

var desc6 = new ActionDescriptor();

var desc7 = new ActionDescriptor();

var ref1 = new ActionReference();

ref1.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "colorSettings" ));

ref1.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));

desc6.putReference( charIDToTypeID( "null" ), ref1 );

desc7.putBoolean( stringIDToTypeID( "askMismatchOpening" ), true );

desc7.putBoolean( stringIDToTypeID( "askMismatchPasting" ), true );

desc7.putBoolean( stringIDToTypeID( "askMissing" ), true );

desc6.putObject( charIDToTypeID( "T   " ), stringIDToTypeID( "colorSettings" ), desc7 );

executeAction( charIDToTypeID( "setd" ), desc6, DialogModes.NO );

4 replies

Participating Frequently
September 2, 2018

Geppetto's code works perfectly for me. Thanks everybody.

Kukurykus
Legend
September 2, 2018

Honestly I was sure you ask about something else as it was too obvious. I mean you can get it from Script Listener. But it seems first guess was right 🙂


Anyway here is also other version of the same code geppettol66959005 posted:

 

function sTT(v) {return stringIDToTypeID(v)} (function(v1, v2, v3) {

    (ref = new ActionReference()).putProperty(sTT('property'), sTT('colorSettings'))

    ref.putClass(sTT('application')); (dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref)

    dsc2 = new ActionDescriptor(); for(i = 0; i < (arr = ['Opening', 'Pasting', '']).length; i++) {

          dsc2.putBoolean(sTT('askMis' + (i < 2 ? 'match' : 'sing') + arr[i]), arguments[i])

    }

    dsc1.putObject(sTT('to'), sTT('colorSettings'), dsc2), executeAction(sTT('set'), dsc1)

})(false, false, false)

Participating Frequently
September 2, 2018

Yes, I mean the dialog appearing when the embedded profile does not match the working color space and I want to suppress it by some code, not the settings.

Legend
September 2, 2018

OK, in this case, we can assemble the response…

The Color Settings are accessed via menu Edit --> Color Settings… (Cmd-Shift-K / Ctrl-Shift-K).

The checkboxes to deactivate are shown in geppettol66959005​'s message.

It is recommended to save these settings under its own name, so that it is easy to switch (there are many cases where it is important to know that there are issues with the profiles.

Besides loading the settings using code, I don't see just so a way to deal with specifically that dialog, because it opens automatically, but you might try the displayDialogs = DialogModes.NO statement. It may or may not work as intended.

Known Participant
March 17, 2022

THANK YOU!!!!!!!!!   

Legend
September 2, 2018

Do you understand the "color profile dialog" to be the dialog appearing when the embedded profile does not match the working color space?

If so, the easiest, IMHO, would be creating custom Color Settings where the options to ask when no or not matching profiles are with the picture are unchecked, and use those settings.

If not, could you explain what exactly you are referring to?

Geppetto Luis
Legend
September 2, 2018

Desable this checkbox

Kukurykus
Legend
September 2, 2018

How do you choose that manualy? Where normally is it? Not all dialogs like without: displayDialogs = DialogModes.NO