Restart illustrator through script (or eliminate PARM error)
i'm working on javascript goes through folder, rasterizes paths inside each file, , saves results separate files in folder. script works fine on individual files several simple files. however, once gets going on of big ones, starts give me parm errors.
what i'm working with:
- illustrator cs5.1
- windows xp, sp3 (work computer)
- javascript
- the cad export created pdf , eps files broke curves tons of tiny straight lines. result, these drawings can have 15-35 thousand paths per image.
summary of code:
- get source , destination directories
- open file source directory
- go first layer of file
- loop through text items move them own layer
- loop through path , compound paths move them group
- rasterize group of path items
- repeat next layer , on
- save file destination directory
- repeat process next file , on
the scripting guide suggests conflicting functions or global variables overwriting each other. however, script entirely contained within own function, , variables declared locally. running clean illustrator , estk startup, still produce parm error after few large files.
the guide suggests having script quit , re-launch illustrator after working on many files. since assume these huge diagrams several "normal" files' worth of objects each, figured needs restart illustrator after x amount of stuff goes through. in guide's section on launching illustrator through javascript. says "why ever need that?" gee, thanks. tried looking in tools guide, document isn't clear @ all.
so, onto actual questions:
1. have illustrator doesn't throw parm error on line marked below? (besides putting in try/catch , pretending didn't happen) doesn't consistently happen on same file or @ same point in file, @ line.
this tiny part of script. objectclass placeholder pathitems, compoundpathitems, etc. looping backwards , setting group null @ end experiments, neither of had effect on error.
if(objectclass.length > 0){ var objectgroup = mylayer.groupitems.add(); for(var = objectclass.length; > 0; i--){ objectclass[i-1].move(objectgroup, elementplacement.placeatbeginning); //this 1 keeps breaking stuff. } sourcedoc.rasterize(objectgroup, rastbounds, rastoptions); objectgroup = null; }
2. failing that, how can relaunch illustrator through javascript? or limited amount of vbscript, though knowledge of limited too.
"#target estoolkit" , use bridgetalk run script function.
a basic example: https://gist.github.com/3321845
More discussions in Illustrator Scripting
adobe
Comments
Post a Comment