Unify Multiple Artboard Sizes

Explorer ,
Jul 05, 2022 Jul 05, 2022

Copy link to clipboard

Copied

Hello all,

I'm looking for a script to set multiple artboard sizes to specific dimensions.

Luckily I found this script, but unfortunately it's in Chinese.
Is there a similar script or can someone edit the code for translation?


Thanks in advance 

TOPICS
How to , Scripting , Third party plugins , Tools

Views

83

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jul 06, 2022 Jul 06, 2022

Thanks to @CarlosCanto I can used and it seems to work fine.

//  script.name = resizeArtboards_CS4andUp.jsx;
//  script.description = resizes all artboards;
//  script.requirement = one document with at least one artboard;
//  script.parent = carlos canto // 11/4/12;
//  script.elegant = false;

if (app.documents.length > 0) {


        //alert("more than 0");
                    var idoc = app.activeDocument;


        var title = "Resize All Artboards";


        var width = Number(Window.promp
...

Likes

Translate

Translate
Adobe Community Professional ,
Jul 05, 2022 Jul 05, 2022

Copy link to clipboard

Copied

Hi @MidoSemsem, do you just want to use it? If so see below. Or do you want to adapt the code for your own use? In that case, you don't need to translate the Chinese, you need to translate the binary encoding! Which is harder.

 

I don't read Chinese, but the script was easy to use. I ran it, entered the artboard size I wanted, select which artboards (script calls them "pages") and whether it sizes the artboards from top left (default is center) and pressed Enter. (Buttons are equivalent of "Cancel" and "OK".

 

I sense that this won't be a satisfactory answer for you and, if so, so please outline your exact needs.

- Mark

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

Thanks @m1b

I'm learning how to use it by trial. I want to make it easier for my junior coworkers to use with knowledge instead of testing. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

LATEST

Thanks to @CarlosCanto I can used and it seems to work fine.

//  script.name = resizeArtboards_CS4andUp.jsx;
//  script.description = resizes all artboards;
//  script.requirement = one document with at least one artboard;
//  script.parent = carlos canto // 11/4/12;
//  script.elegant = false;

if (app.documents.length > 0) {


        //alert("more than 0");
                    var idoc = app.activeDocument;


        var title = "Resize All Artboards";


        var width = Number(Window.prompt ("Enter New Artboard Width in points", 612, title));
        var height = Number(Window.prompt ("Enter New Artboard Height in points", 792, title));


    for (i=0; i<idoc.artboards.length; i++) {
        var abBounds = idoc.artboards[i].artboardRect;// left, top, right, bottom


        var ableft = abBounds[0]; // 0
        var abtop = abBounds[1]; // 612
        var abwidth = abBounds[2] - ableft; // 792 // width
        var abheight = abtop- abBounds[3]; // 0 // height

        var abctrx = abwidth/2+ableft;
        var abctry = abtop-abheight/2;

        var ableft = abctrx-width/2;
        var abtop = abctry+height/2;
        var abright = abctrx+width/2;
        var abbottom = abctry-height/2;

        idoc.artboards[i].artboardRect = [ableft, abtop, abright, abbottom];
    }
}
 else  {
        alert ("there are no open documents");
}

 
The main advantage of the first script is about details and options available. 
I hope CarlosCanto's version will be updated

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines