Well as you appear to be happy with the selection of objects on the Artboard… You could now just remove() or other by testing the selected property… #target illustrator removeNonArtboardFluff(); function removeNonArtboardFluff(){ var i, doc, count, itemList; doc = app.activeDocument; doc.artboards.setActiveArtboardIndex( 0 ); doc.selectObjectsOnActiveArtboard(); itemList = doc.pageItems; count = itemList.length; for ( i = count-1; i >= 0; i-- ) { // A reversed loop for object removal… if ( ! itemList.selected ) { itemList.remove(); } }; doc.selection = null; app.redraw(); };
... View more