Answered
Remove All Group Without any contents
Is that possible to remove all Group only without any contents ?
Is that possible to remove all Group only without any contents ?
ungroup_folder(activeDocument);
function ungroup_folder(f)
{
try {
for (var i = f.layerSets.length-1; i >= 0; i--)
{
ungroup_folder(f.layerSets[i]);
}
if (f.typename == "LayerSet")
{
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
//ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
ref1.putIdentifier(cTID('Lyr '), f.id);
desc1.putReference(cTID('null'), ref1);
desc1.putBoolean(sTID("deleteContained"), false);
executeAction(cTID('Dlt '), desc1, DialogModes.NO);
}
}
catch (e) { alert(e); }
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.