Identify and apply mask by RVlS or RVlA
Hello everybody, I'm having trouble changing this code. He applies a mask by a selection ('RVlS'), but if you haven't a selection, it displays an error.
I need that if there is no selection, then it creates an empty mask ('RVlA'). Can not understand how to put together this "if / else" ![]()
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
function Temp() {
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putClass(cTID('Nw '), cTID('Chnl'));
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Chnl'), cTID('Chnl'), cTID('Msk '));
desc1.putReference(cTID('At '), ref1);
desc1.putEnumerated(cTID('Usng'), cTID('UsrM'), cTID('RvlS'));
executeAction(cTID('Mk '), desc1, dialogMode.NO);
};
step1();
};
Temp.main = function () {
Temp();
};
Temp.main();
