zOrderPosition error caused by 'duplicate' and 'move' methods
i created paths , grouped them script. selected item below them , tried getting zorderposition of script. , got error.
is there way rid of this?
here code.
please select path , run test1 or test2 twice. you'll error @ second time.
(tested ai cs3 , cc 2015)
thanks.
function test1(){ // error (at second time)
var lay = activedocument.activelayer;
var group = lay.groupitems.add();
var p1 = lay.pathitems.ellipse(100,100,10,10);
var p2 = p1.duplicate();
var p3 = p1.duplicate();
p2.move(group, elementplacement.placeatend);
p3.move(group, elementplacement.placeatend);
alert(activedocument.selection[0].zorderposition); // error
}
function test2(){ // error (at second time)
var lay = activedocument.activelayer;
var group = lay.groupitems.add();
var p1 = group.pathitems.ellipse(100,100,10,10);
var p2 = p1.duplicate();
alert(activedocument.selection[0].zorderposition); // error
}
function test3(){ // no error
var lay = activedocument.activelayer;
var group = lay.groupitems.add();
var p1 = lay.pathitems.ellipse(100,100,10,10);
var p2 = p1.duplicate();
p2.move(group, elementplacement.placeatend);
alert(activedocument.selection[0].zorderposition); // no error
}
test1();
yes, see error. persists if save, close , re-open document. think saw long time ago said zorder broken feature.
More discussions in Illustrator Scripting
adobe
Comments
Post a Comment