Copy link to clipboard
Copied
Hi,
how do you suppress solely the color profile dialog in a script (JavaScript) when opening a file, but not all dialogs?
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"
Copy link to clipboard
Copied
How do you choose that manualy? Where normally is it? Not all dialogs like without: displayDialogs = DialogModes.NO
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Desable this checkbox
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
THANK YOU!!!!!!!!!
Copy link to clipboard
Copied
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 );
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Geppetto's code works perfectly for me. Thanks everybody.
Copy link to clipboard
Copied
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)