Adobe illustrator Scripting (JavaScript) Beginner Questions
<p>I am literally 24 hours into learning javascripting for Adobe Illustrator and I have two basic questions:</p>

<p>Firstly, is there a way to clear the contents of a document prior to re-running the same script.  Currently I'm creating a new document each time with the following command:</p>

<pre><code>var docX = 595, docY = 842;
var doc = documents.add(null, docX, docY);
</code></pre>

<p>Is it possible to write to the same document by preceding the above code with something like: </p>

<pre><code>documents.clear() 
</code></pre>

<p>rather than creating a new document each time?</p>

<p>Secondly, I'm a little confused by the Javascript syntax. Is there only one way to initialize JavaScript objects? Currently I'm using the following syntax:</p>

<pre><code>var c0 = new RGBColor; 
c0.red = 255; 
c0.green = 255; 
c0.blue = 255;
</code></pre>

<p>but shouldn't the following also work?:</p>

<pre><code>var c0 = new RGBColor(255, 255, 255);
</code></pre>

<p>It doesn't for me.</p>

<p>Many thanks for any advice!</p>