Answered
Select group of layers by part of a name
Is it possible to select group with a script if i know that name of that group always contains text, for example "TEST" but other part of group name is always changing (TEST1, TEST2, TEST3...)?
Is it possible to select group with a script if i know that name of that group always contains text, for example "TEST" but other part of group name is always changing (TEST1, TEST2, TEST3...)?
if (test = documents.length) {
sTT = stringIDToTypeID, lngth = activeDocument.layerSets.length; (ref = new ActionReference()).putProperty(sTT('property'), json = sTT('json'))
ref.putEnumerated(sTT('layer'), sTT('ordinal'), sTT('targetEnum')), (evl = eval('(' + (dsc = executeActionGet(ref)).getString(json) + ')')).layers.length = lngth
function slct(v) {test = (ref = new ActionReference()).putIdentifier(sTT('layer'), layerSet.id), dsc.putReference(sTT('null'), ref), executeAction(sTT('select'), dsc)}
(function(v){while(test && v && lngth = v.length) {var lst = lngth - 1; if (/TEST[_-]?\d+/.test((layerSet = v[lst]).name)) return slct(); callee(v[lst].layers), v.length = lst}})(evl.layers)
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.