scripting-for-illustrator-tutorial
scripting-for-illustrator-tutorial copied to clipboard
How to clean up all elements of a document in the start of a script?
I test run the script in development multiple times. If I create a new document at the start of every script, it will lead to many open document in Illustrator very quickly.
If I choose the active document at the start of the script instead, it does not open new documents but it will write on top of whatever is already there.
Is there a way to select the active document but wipe it clean in the beginning of the script?
Remove all items is something like this:
var doc = app.activeDocument;
doc.pageItems.removeAll();