Hello,
I have building a helper tool for some repetitive tasks in adobe illustrator using ASOC.
I randomly throw errors while trying to do the following.
I
on createSwatches()
tell application "Adobe Illustrator"
if not (exists swatchgroup "specialColors" in current document) then
make new swatchgroup in current document with properties ¬
{name:"specialColors"}
end if
createColorSwatch("glosswhite",232.0,233.0,236.0,"specialColors") of me
createColorSwatch("mattewhite",232.0,233.0,236.0,"specialColors") of me
createColorSwatch("glossblack",16.0,15.0,17.0,"specialColors") of me
createColorSwatch("matteblack",16.0,15.0,17.0,"specialColors") of me
createColorSwatch("orange",226.0,77.0,37.0,"specialColors") of me
createColorSwatch("red",182.0,32.0,37.0,"specialColors") of me
createColorSwatch("yellow",255.0,199.0,10.0,"specialColors") of me
createColorSwatch("goldenyellow",251.0,170.0,25.0,"specialColors") of me
createColorSwatch("softpink",242.0,133.0,179.0,"specialColors") of me
createColorSwatch("hotpink",201.0,43.0,106.0,"specialColors") of me
createColorSwatch("brown",64.0,47.0,29.0,"specialColors") of me
createColorSwatch("mint",99.0,197.0,180.0,"specialColors") of me
createColorSwatch("yellowgreen",32.0,152.0,71.0,"specialColors") of me
createColorSwatch("darkgreen",0.0,63.0,40.0,"specialColors") of me
createColorSwatch("goldmetallic",119.0,98.0,49.0,"specialColors") of me
createColorSwatch("silvermetallic",106.00,107.0,108.0,"specialColors") of me
createColorSwatch("skyblue",4.0,115.0,187.0,"specialColors") of me
createColorSwatch("blue",32.0,62.0,118.0,"specialColors") of me
createColorSwatch("purple",67.0,42.0,113.0,"specialColors") of me
createColorSwatch("lightgrey",192.0,193.0,191.0,"specialColors") of me
end tell
end createSwatches
what I thought would be straight forward…randomly throws an error
it seems to generate a good deal of the swatches when this happens but misses a few of the last ones…
“Adobe Illustrator got an error: an Illustrator error occurred: 1346458189 (‘MRAP’) (error 1200)”
I’ve researched this a bit and found the following…
“An Illustrator error occurred: 1346458189 (‘PARM’)” alert (1459349)
Affects: JavaScript
Problem:
This alert may be popped when badly written scripts are repeatedly
run in Illustrator from the ExtendScript Toolkit
Scripters need to be very careful about variable initialization and
namespace conflict when repeatedly pushing a batch of Illustrator scripts
for execution in Illustrator via the ExtendScript Toolkit (ESTK) in a
single Illustrator session. Each script run is executed within the same
persistent ExtendScript engine within Illustrator. The ESTK debugger
uses BridgeTalk to communicate with Illustrator. One global, persistent
ExtendScript engine inside Illustrator handles all BridgeTalk
communications. The net effect is that the state of the ExtendScript
engine is cumulative across all scripts that ran previously.
The following issues with script code can cause this problem:
- Reading uninitialized variables.
- Global namespace conflicts, like when two globals from different
scripts clobber each other.
Workaround:
Initialize variables before using them, and consider the scope of
your variables carefully. For example, isolate your variables by
wrapping them within systematically named functions. Instead of:
var myDoc = app.documents.add();
// Add code to process myDoc
Wrap myDoc in a function that follows a systematic naming scheme:
function myFeatureNameProcessDoc() {
var myDoc = app.documents.add();
// Add code to process myDoc
}
myFeatureNameProcessDoc();
However none of that makes sense as I’m not using javascript, nor am I really doing anything complicated.
Any insight could greatly help me out! THANKS!