Mobile app version of vmapp.org
Login or Join
Fox8063795

: How to wipe the active document clean at the beginning of a script? I want to have a blank slate at the start of my script. My two current approaches both have downsides. First, I create

@Fox8063795

Posted in: #AdobeIllustrator #IllustratorScripting

I want to have a blank slate at the start of my script. My two current approaches both have downsides.

First, I create a new document at the start of the script. However, during development, I test run my script multiple times. Thus, I then have many open documents in Illustrator that I have to close by hand.

Second, 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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8063795

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cugini998

For every pageItem do:

activeDocument.pageItems.removeAll();


This does not include swatches, symbols and other such persistent thing. As a alternative make a new document and close the old one.

activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.documents.add();

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme