This is a bug.
I will see what can be done later. Now there is no time.
For any other channels, except RGB, everything works.
Another bug occurs when you use (for any channel)
executeAction (idsetd, desc113, DialogModes.ALL);
Not sure that they will fix it.
If you set
var idRGB = stringIDToTypeID ("gray");
then Photoshops CS6 - CC2020 crashes !!
They definitely have to fix it!!!
EDIT:
If you need this selection to create a mask, it’s easier to use AppyImage to an already created mask.
EDIT: 27/02/2020
If you are satisfied, then you can make a selection not from the composite RGB channel, but only from the red (or green) channel.
In this case, there will be no messages.
// make selection from red channel
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
d.putReference(stringIDToTypeID("null"), r);
var r1 = new ActionReference();
r1.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("red"));
d.putReference(stringIDToTypeID("to"), r1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
}
catch (e) { alert(e); }
If you still need to make selection only from the composite RGB channel, the code below will do this and there will also be no messages.
try {
// make temp black alpha channel
var d = new ActionDescriptor();
var d1 = new ActionDescriptor();
d1.putEnumerated(stringIDToTypeID("colorIndicates"), stringIDToTypeID("maskIndicator"), stringIDToTypeID("maskedAreas"));
var d2 = new ActionDescriptor();
d2.putDouble(stringIDToTypeID("red"), 255);
d2.putDouble(stringIDToTypeID("green"), 0);
d2.putDouble(stringIDToTypeID("blue"), 0);
d1.putObject(stringIDToTypeID("color"), stringIDToTypeID("RGBColor"), d2);
d1.putInteger(stringIDToTypeID("opacity"), 50);
d.putObject(stringIDToTypeID("new"), stringIDToTypeID("channel"), d1);
executeAction(stringIDToTypeID("make"), d, DialogModes.NO);
// apply RGB to alpha channel
var d = new ActionDescriptor();
var d1 = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("RGB"));
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("merged"));
d1.putReference(stringIDToTypeID("to"), r);
d1.putBoolean(stringIDToTypeID("preserveTransparency"), true);
d.putObject(stringIDToTypeID("with"), stringIDToTypeID("calculation"), d1);
executeAction(stringIDToTypeID("applyImageEvent"), d, DialogModes.NO);
// make selection from alpha channel
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
d.putReference(stringIDToTypeID("null"), r);
var r1 = new ActionReference();
r1.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("to"), r1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
var d = new ActionDescriptor();
// delete temp alpha channel
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("delete"), d, DialogModes.NO);
}
catch (e) { alert(e); }
P.S. I can not add a new post. The forum is buggy. I had to change the old post.