Script To Deselect Invert Within Color Range - Photoshop
The script below does a simple function. Selects the RGB channel, loads color range (the type of selection does not matter) but most importantly, deselects Invert. Then simply closes Color Range and deselects the selection made. Problem is, this script works in Photoshop versions through CS6 although does not work in any version of Photoshop Creative Cloud? Why is that and what needs to be changed? The call to false in step2 is what deselects Invert. If someone can help out with getting this to work on CC versions that would be immensely appreciated! Can't seem to figure out why it doesn't? I also tried an Action, converted the Action to XML and added the call to false then saved again as an Action. This also doesn't work?
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
//
//==================== Repair-Solid-Channels-Script ==============
//
function Repair_Solid_Channels_Script() {
// Select
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Chnl'), cTID('Chnl'), sTID("RGB"));
desc1.putReference(cTID('null'), ref1);
executeAction(cTID('slct'), desc1, dialogMode);
};
// Color Range
function step2(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putEnumerated(cTID('Clrs'), cTID('Clrs'), cTID('Mdtn'));
desc1.putInteger(sTID("midtonesFuzziness"), 40);
desc1.putInteger(sTID("midtonesLowerLimit"), 105);
desc1.putInteger(sTID("midtonesUpperLimit"), 150);
desc1.putBoolean(cTID('Invr'), false);
desc1.putInteger(sTID("colorModel"), 0);
executeAction(sTID('colorRange'), desc1, dialogMode);
};
// Set
function step3(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID('Chnl'), sTID("selection"));
desc1.putReference(cTID('null'), ref1);
desc1.putEnumerated(cTID('T '), cTID('Ordn'), cTID('None'));
executeAction(cTID('setd'), desc1, dialogMode);
};
step1(); // Select
step2(); // Color Range
step3(); // Set
};
Repair_Solid_Channels_Script.main = function () {
Repair_Solid_Channels_Script();
};
Repair_Solid_Channels_Script.main();
