redraw the canvas to commit your changes right before you show the options
app.redraw();
function Main(curDoc, sel, amountofselectedobjects) {
// we just fail silently if <2 paths are selected,
// just like the normal blend operation
if (amountofselectedobjects >= 2) {
firstPath = sel[0];
pathClosed = new Array();
// record closed/open state of all paths, close them all
for (var i = 0; i < amountofselectedobjects; i++) {
pathClosed [i] = sel[i].closed;
sel[i].closed = true;
// alert (pathClosed[i]);
}
app.executeMenuCommand('Path Blend Make');
// Illustrator thinks blends should default to having 'knockout group' turned on and I never want this.
firstPath.parent.parent.artworkKnockout = KnockoutState.DISABLED;
// attempt to restore closed/open status
// why does everything stay closed
// even though my diagnostic alert returns a few 'false'es
for (var i = 0; i < amountofselectedobjects; i++) {
sel[i].closed = pathClosed [i] ;
alert (pathClosed[i]);
}
app.redraw();
// I would like to immediately pop up the blend options but for some reason
// this undoes the blend creation when I start cursoring around
// in the blend options window, wtf.
app.executeMenuCommand('Path Blend Options');
}
}
// initial setup: check for open document, fail quietly or invoke main function
if ( app.documents.length > 0 ) {
var curDoc = app.activeDocument;
var sel = curDoc.selection; // get selection Pageitems
var amountofselectedobjects = sel.length;
Main(curDoc, sel, amountofselectedobjects);
}
... View more