Copy link to clipboard
Copied
When i used color range ,the default selected model is highlight,but i used color range with sampled colors model by scripts in next time ,it stil show the result that is
highlight model.I dont konw why? please help ,thanks!
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
var desc1 = new ActionDescriptor();
desc1.putInteger(cTID('Fzns'), 80);
var desc2 = new ActionDescriptor();
desc2.putDouble(cTID('Lmnc'), 48.58);
desc2.putDouble(cTID('A '), -9.14);
desc2.putDouble(cTID('B '), -45.14);
desc1.putObject(cTID('Mnm '), cTID('LbCl'), desc2);
var desc3 = new ActionDescriptor();
desc3.putDouble(cTID('Lmnc'), 60.86);
desc3.putDouble(cTID('A '), -4.64);
desc3.putDouble(cTID('B '), -40.1);
desc1.putObject(cTID('Mxm '), cTID('LbCl'), desc3);
desc1.putInteger(sTID("colorModel"), 0);
executeAction(sTID('colorRange'), desc1, DialogModes.NO);
I try to add"desc1.putEnumerated(cTID('Clrs'), cTID('Clrs'), sTID("sampledColors"));"before in"desc1.putInteger(sTID("colorModel"), 0);",but it has error
Copy link to clipboard
Copied
Could you describe the problem in more detail? How did you determine that "highlights" (as I understand) is applying as you have the DialogModes.NO mode?
The valid ID values for the "colors" enumeration are:
stringIDToTypeID("reds")
stringIDToTypeID("yellows")
stringIDToTypeID("greens")
stringIDToTypeID("cyans")
stringIDToTypeID("blues")
stringIDToTypeID("magenta")
stringIDToTypeID("highlights")
stringIDToTypeID("midtones")
stringIDToTypeID("shadows")
stringIDToTypeID("skinTone")
stringIDToTypeID("outOfGamut")
"sampledColors" is unknown string.at least for PS CS6.
Copy link to clipboard
Copied
Firsts,the color range default setting is highlights model,like this picture:
when run the code that function is select sampled colors,but the result is still highlights selection not the sampled colors selection
Copy link to clipboard
Copied
It looks like a bug at least in versions 2015.5-2018. It is not in CS6 It also don`t work in Actions There is another bug in Color Range related to the eyedropper's mode "sapple al layers". Because of this and many other bugs, I do not use either 2015 or 2018 versions.
You can manually call "Color Range" and set "sampled colors" and press Enter. Some time after this, everything will work.
Copy link to clipboard
Copied
Thanks to your reply,i test it in CC2017 and it indeed is a bug.
Copy link to clipboard
Copied
As a workaround, save the sample.axt file to your script folder while selecting the "sampled color" mode and click on the "Save" button in the Color Range dialog.
Then insert into the script line after "var desc1 = new ActionDescriptor ();"
desc1.putPath (charIDToTypeID ("Usng"), new File ("<HERE PLACE PATH TO FILE>" + "/" + "sample.axt" ));
All will work right with DialogModes.NO or DialogModes.ALL
Hope you understand )
Copy link to clipboard
Copied
it was a mistake )
you must run such script before main unchanged
var desc0 = new ActionDescriptor();
desc0.putPath (charIDToTypeID ("Usng"), new File ("<HERE PLACE PATH TO FILE>" + "/" + "sample.axt" ));
executeAction(sTID('colorRange'), desc0, DialogModes.NO);
app.activeDocument.selection.deselect(); |
Copy link to clipboard
Copied
Yes,i
Copy link to clipboard
Copied
Yes,it can avoid this problem,thanks a lot