@Stephen Marsh
I just want a line of code on just this
create a reveal all layer mask
Sorry sir if I bothered you
@Stephen Marsh
I just want a line of code on just this
create a reveal all layer mask
Sorry sir if I bothered you
By @Mohamed Hameed21513110
Well, that does not appear to be what you asked earlier when conditionals were mentioned.
The following function will add a reveal all layer mask to an active layer (with no error checks or conditions).
addMask("RvlA"); // or "HdAl"
function addMask(revealOrHide) {
var idMk = charIDToTypeID("Mk ");
var desc2 = new ActionDescriptor();
var idNw = charIDToTypeID("Nw ");
var idChnl = charIDToTypeID("Chnl");
desc2.putClass(idNw, idChnl);
var idAt = charIDToTypeID("At ");
var ref1 = new ActionReference();
var idChnl = charIDToTypeID("Chnl");
var idChnl = charIDToTypeID("Chnl");
var idMsk = charIDToTypeID("Msk ");
ref1.putEnumerated(idChnl, idChnl, idMsk);
desc2.putReference(idAt, ref1);
var idUsng = charIDToTypeID("Usng");
var idUsrM = charIDToTypeID("UsrM");
var idHideOrReveal = charIDToTypeID(revealOrHide);
desc2.putEnumerated(idUsng, idUsrM, idHideOrReveal);
executeAction(idMk, desc2, DialogModes.NO);
}
or
addMask("revealAll"); // or "hideAll"
function addMask(revealOrHide) {
function c2t(s) {
return app.charIDToTypeID(s);
}
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
descriptor.putClass(s2t("new"), s2t("channel"));
reference.putEnumerated(s2t("channel"), s2t("channel"), s2t("mask"));
descriptor.putReference(s2t("at"), reference);
descriptor.putEnumerated(s2t("using"), c2t("UsrM"), s2t(revealOrHide));
executeAction(s2t("make"), descriptor, DialogModes.NO);
}