Ungroup selected items and delete them
Hello!
I have a code that removes the tags (if there are tags) from objects and then deletes them.
The problem is if tagged objects are grouped. Or even grouped objects in another group.
I need to ungroup the selected objects and then untagging and deleting them.
How can i do this?
My current code:
for (var iSel = app.activeDocument.selection.length-1; iSel >=0 ; iSel--){
var currentSelection = app.selection[iSel];
if (currentSelection.associatedXMLElement != null) {
currentSelection.associatedXMLElement.untag();
currentSelection.remove();
}
else {
currentSelection.remove();
}
}