Sg2.9
Code error when creating a ne...
Recent RSS
Code error when creating a new document
From:  Alessandro
Date:  31. March 2008, 14:22

Hi,
I've made a grid generator script, in this script I create automaticly a new document.
the script works well if, before running it, there's an active open document, it dosen't work if there're no open document. this is the error II get if there're no document on illustrator:

com.scratchdisk.script.rhino.RhinoScriptException
java.lang.NullPointerException

it's like the script goes on without waiting for illustrator to create the document (that is not instantaneous of course): do I have to stop the script until I create the document? how can I do that?

thanks in advance!

Re: Code error when creating a new document
From:  Alessandro
Date:  31. March 2008, 18:45

I already create a new document at the beginning of the script!

values = Dialog.prompt("Golden Section Grid:", [
{ value: height, description: "Single page height in mm (leave 0 for autodetect)", width: 50 },
{ value: width, description: "Single page widht in mm (leave 0 for autodetect)", width: 50 },
{ value: orientamento, description: "Orientamento (o / v)", width: 50 },
]);

if (values != null ) {
height = values[0];
heightPt = height;
width = values[1];
widthPt = width;
orientamento = values[2];
}
[...]
documento = new Document("griglia"+i, width, height, Color.MODEL_CMYK, Document.DIALOG_OFF);

Re: Code error when creating a new document
From:  Jürg Lehni
Date:  1. April 2008, 11:42

This seems to work here on CS3. What version of Illustrator are you using? On which platform?

Re: Code error when creating a new document
From:  Alessandro
Date:  1. April 2008, 15:24

Illustrator CS2 on a powerbook 12" G4 1.5 Ghz with 768 MB.

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Stroke 3D 16.06.09