Skip to main content
Participating Frequently
September 2, 2018
Answered

How to suppress the color profile dialog (CC 2018)

  • September 2, 2018
  • 4 replies
  • 3060 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.

Geppetto Luis
Geppetto LuisCorrect answer
Legend
September 2, 2018

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 );

schroef
Inspiring
October 13, 2023

That is nice, but if someone doesnt have this activated, it will activate now. Wish we could check settings like we can in illustrator app script

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