trying to set the height of a groupItem to the height of aa artboard so it is flush up to the top of it. for some reason it is acting funny, I have had this before but have avoided it by not getting into negative numbers and using Math.abs(); but this seems like a terrible fix.
here is what I am using:
$.writeln(app.activeDocument.groupItems[0].top);
$.writeln(app.activeDocument.artboards[2].artboardRect[0]);
app.activeDocument.groupItems[0].top = app.activeDocument.artboards[2].artboardRect[0];
and it prints:
-1008.0224609375
-789
Result: -789
yet in illustrator it is clearly not even close, its at 1028.5 which really weirds me out because I am printing the values right there...?
What you need to remember is that there 2 sets of measurements going on… Document and Artboard… When working with Artboards its much easier to set the apps script property to suit… See this…
#target illustrator
topAlign();
function topAlign() {
app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
var doc = app.activeDocument;
var grp = doc.groupItems[0];
doc.artboards.setActiveArtboardIndex(1);
grp.top = 0;
};
North America
Europe, Middle East and Africa
Asia Pacific