Copy link to clipboard
Copied
IS there a script to resize the artboard on all open documents? I have hundreds of files that are the same dimensions 14 x 7.5in. I've seen a few scripts that will resize artboards and Art i just want the artboard alone to be changed they also change the size in one direction instead of H x W. Or at the very least is there a script that will resize the artboard per selected document. it would still take a while to do however no where near as long as it would take to manually change the sizes.
This should resize around the centre of the artboard (as opposed to the left top corner in the above snippet).
var w = prompt("width (in inches)") * 72;
var h = prompt("height (in inche)") * 72;
var docs = app.documents;
for (var i = 0; i < docs.length; i++) {
docs[i].activate();
for (var j = 0; j < activeDocument.artboards.length; j++) {
var AB = activeDocument.artboards[j];
var xCentre = AB.artboardRect[0] + ((AB.artboardRect[2]-AB.artboardRect[0])/2);
var yCentre = AB.artboard
...
Copy link to clipboard
Copied
I don't know how this will perform with hundreds of documents/artboards, but here you go.
var w = prompt("width (in inches)") * 72;
var h = prompt("height (in inche)") * 72;
var docs = app.documents;
for (var i = 0; i < docs.length; i++) {
docs[i].activate();
for (var j = 0; j < activeDocument.artboards.length; j++) {
var AB = activeDocument.artboards[j];
AB.artboardRect = [AB.artboardRect[0], AB.artboardRect[1], AB.artboardRect[0] + w, AB.artboardRect[1] - h];
}
}
Copy link to clipboard
Copied
Thank you. This works great except for one thing. What do i have to add to make it adjust all corners evenly rather than just adjusting the Left and Bottom up? this way my art and text stays centered in the document and i wont have to move anything. I've changed the artboardRect to several different numbers but its not doing what i was hoping.
Copy link to clipboard
Copied
This should resize around the centre of the artboard (as opposed to the left top corner in the above snippet).
var w = prompt("width (in inches)") * 72;
var h = prompt("height (in inche)") * 72;
var docs = app.documents;
for (var i = 0; i < docs.length; i++) {
docs[i].activate();
for (var j = 0; j < activeDocument.artboards.length; j++) {
var AB = activeDocument.artboards[j];
var xCentre = AB.artboardRect[0] + ((AB.artboardRect[2]-AB.artboardRect[0])/2);
var yCentre = AB.artboardRect[1] + ((AB.artboardRect[3]-AB.artboardRect[1])/2);
AB.artboardRect = [xCentre - w/2, yCentre + h/2, xCentre + w/2, yCentre - h/2];
}
}
Copy link to clipboard
Copied
Thank you very much works perfect!!!!