Script -> Polygon -> fillColor -> MixedInk -> Nope.
Greetings,
This is my third question this weekend, and ever, and I apologize for posting so much. I do only post after hours of research so please be kind!
My question is how to assign a mixed ink to a polygon (fillColor)?
I can create a polygon and assign it a spot or a cmyk fine using the following code:
var poly = page.polygons.add({geometricBounds:[y1,x1,y2,x2],numberOfSides:6, fillColor: mySpot});The spot or cmyk were created like this:
var myCMYK = doc.colors.add();
myCMYK.properties = {name: "test", model: ColorModel.PROCESS, space: ColorSpace.CMYK, colorValue:[80,50,30,10] };
var myLAB = doc.colors.add();
myLAB.properties = {name: "myLAB", model: ColorModel.PROCESS, space: ColorSpace.CMYK, colorValue:[80,50,30,10] };The mixed ink was a bit more involved and is created this way:
var MY_MIX_INKS = { 'Process Cyan': 0, 'Process Magenta' : 0, 'Process Yellow': 100, 'Gold' : 60}, MY_MIX_NAME = 'mixed';
// Ink Validator
// -------------------------------------
var validateInkData = function(o, c, ll, pp) {
var k, t, z=0, r=1;
ll.length = pp.length = 0;
for( k in o )
{
if( !o.hasOwnProperty(k) ) continue;
if( !(t=c.itemByName(k)).isValid ){ r=0; break; }
ll[z] = t.getElements()[0];
pp[z++] = +o[k];
}
return r;
};
// Main Code
// -------------------------------------
var doc = app.activeDocument,
inkList, // will receive validated ink list (array)
inkPerc; // corresponding percentages (array)
if( !doc.mixedInks.itemByName(MY_MIX_NAME).isValid )
{
if( validateInkData(MY_MIX_INKS,
doc.inks, inkList=[], inkPerc=[]) )
{
doc.mixedInks.add(inkList, inkPerc,
{
name: MY_MIX_NAME,
model: ColorModel.MIXEDINKMODEL,
space: ColorSpace.MIXEDINK
});
/* alert( "The mixed ink '" + MY_MIX_NAME +
"' has been successfully created." );*/
}
else
{
alert( "Unable to create mixed ink. " +
"Some inner inks are missing." );
}
}
else
{
alert( "The mixed ink '" + MY_MIX_NAME +
"' already exists." );
}
But no matter what I try to write for that fill color, no matter that the mixed ink does show up in the swatches list in InDesign, ExtendScript always error out at that first line of the polygon creation.
var poly = page.polygons.add({geometricBounds:[y1,x1,y2,x2],numberOfSides:6, fillColor: mixed});To me, being inexperienced, and under pressure, it looks like there's some undocumented way of pulling this off, or there's a bug in there.
Any assistance is appreciated!!!
Cheers from Vancouver,
Antoine