Adding masks to group layers
Allah to all the angels progamators! How do I add a mask in all groups based on the reference to the selection of layers of shapes that are within their respective groups? Thank you.

Allah to all the angels progamators! How do I add a mask in all groups based on the reference to the selection of layers of shapes that are within their respective groups? Thank you.

function sTT(v) {return stringIDToTypeID(v)}
(ref = new ActionReference()).putEnumerated
(sTT('document'), sTT('ordinal'), sTT('targetEnum'))
nOL = executeActionGet(ref).getInteger(sTT('numberOfLayers'))
bGL = !executeActionGet(ref).getInteger(sTT('hasBackgroundLayer'))
for(i = nOL - bGL; i >= 0; i--) {
function ttS(v) {return typeIDToStringID(v) == lS + 'Start'}
(ref = new ActionReference()).putIndex(sTT('layer'), idx1 = i + bGL)
if (ttS(executeActionGet(ref).getEnumerationValue(sTT(lS = 'layerSection')))) {
(ref = new ActionReference()).putIndex(sTT('layer'), idx2 = i - 1 + bGL)
if (executeActionGet(ref).getInteger(sTT(lS = 'layerKind')) == 4) {
(ref1 = new ActionReference()).putProperty(sTT('channel'), sTT('selection'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref1);
(ref2 = new ActionReference()).putEnumerated(sTT('path'), sTT('path'), sTT('vectorMask'))
ref2.putIndex(sTT('layer'), idx2), dsc1.putReference(sTT('to'), ref2), executeAction(sTT('set'), dsc1);
(ref = new ActionReference()).putIndex(sTT('layer'), idx1);
(dsc = new ActionDescriptor()).putReference(sTT('null'), ref)
dsc.putBoolean(sTT('makeVisible'), false);
executeAction(sTT('select'), dsc);
(dsc = new ActionDescriptor())
.putClass(sTT('new'), sTT('channel'));
(ref = new ActionReference()).putEnumerated
(sTT('channel'), sTT('channel'), sTT('mask'))
dsc.putReference(sTT('at'), ref), dsc.putEnumerated
(sTT('using'), sTT('userMaskEnabled'), sTT('revealSelection'))
executeAction(sTT('make'), dsc)
}
}
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.