Ok this is what you do. You make a script that makes rectangles out of your artboards. Then Manipulate everything the way you want using the rectangles as geometry. Ignore your artboards. Then use a second script to copy artboard sizes back from you rectangles keeping in mind that arboards can only be rectangles not tilted rectangles so rotation by 90 degree increments is ok but 45 not.
Some quick test scripts. Probably not ready for all corner cases yet.
// jooArtbrd2rect.jsx
//
// Make rectangles out of artboards into a artboard layer
#target illustrator
artbrd2rect(app.activeDocument, "artboard squares");
function artbrd2rect(doc, ablayername){
artbrds = doc.artboards;
try {
layer = doc.layers.getByName(ablayername);
} catch (error) {
layer = doc.layers.add();
layer.name = "artboard squares";
}
for (i = 0; i < artbrds.length; i++) {
bounds = artbrds[i].artboardRect;
rect = layer.pathItems.rectangle(bounds[1], bounds[0],
bounds[2] - bounds[0], bounds[1] - bounds[3]);
rect.filled = false;
rect.stroked = false;
rect.name = artbrds[i].name;
}
}
and
// jooRect2artbrd.jsx
//
// Make artboards out of bounds of objects in a artboard layer
#target illustrator
rect2artbrd(app.activeDocument, "artboard squares");
function rect2artbrd(doc, ablayername){
layer = doc.layers.getByName(ablayername);
paths = layer.pathItems;
artbrds = doc.artboards;
for (i = 0; i < paths.length; i++) {
bounds = paths[i].geometricBounds;
ab = artbrds.getByName(paths[i].name);
ab.artboardRect = bounds
}
}