• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Action that converts artboard to specific size [Letter Size]

Explorer ,
Sep 08, 2022 Sep 08, 2022

Copy link to clipboard

Copied

I have a different size of artboard, I want to record an action to convert the artboard to letter size.



TOPICS
Feature request , Scripting , Tools

Views

329

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 2 Correct answers

Community Expert , Sep 09, 2022 Sep 09, 2022

Could easily be done with an action.

 

Record:

 

- Create rectangle (letter size)
- H/V align rectangle to artboard.
- Object menu > Artboards > Fit to Selected Art.
- Delete rectangle.

 

Votes

Translate

Translate
Explorer , Sep 09, 2022 Sep 09, 2022

Not the cleanest code, but it's operational...

var docRef = app.activeDocument;
var docRef = app.activeDocument;
var ABs = docRef.artboards;
var choice;
//Creates new Popup
var Pallette = new Window ("dialog", "Artboard Resizer");
Pallette.add ("statictext", undefined, "Pick a size");
Pallette.orientation = "row";
//Dropdown Menu
var myDropdown = Pallette.add ("dropdownlist", undefined, [
"8.5\" x 11\"",
"11\" x 8.5\"",
"12\" x 12\"",
"12\" x 16\"",
"16\" x 12\"",
"24\" x 12\"",
"32\" x 20\""
]);
...

Votes

Translate

Translate
Adobe
LEGEND ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

As I was educated the other day artboards are not "axction-able", so there's no way to do that. You have to do it manually.

 

Mylenium

Votes

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 ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

Thank you for your response. Appreciated

Votes

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
Guide ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

Could easily be done with a script.  

Votes

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 ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

This is noted. Thank you

Votes

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
Community Expert ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

Could easily be done with an action.

 

Record:

 

- Create rectangle (letter size)
- H/V align rectangle to artboard.
- Object menu > Artboards > Fit to Selected Art.
- Delete rectangle.

 

Votes

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 ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

This method worked.

Thank you!

Votes

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 ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

Not the cleanest code, but it's operational...

var docRef = app.activeDocument;
var docRef = app.activeDocument;
var ABs = docRef.artboards;
var choice;
//Creates new Popup
var Pallette = new Window ("dialog", "Artboard Resizer");
Pallette.add ("statictext", undefined, "Pick a size");
Pallette.orientation = "row";
//Dropdown Menu
var myDropdown = Pallette.add ("dropdownlist", undefined, [
"8.5\" x 11\"",
"11\" x 8.5\"",
"12\" x 12\"",
"12\" x 16\"",
"16\" x 12\"",
"24\" x 12\"",
"32\" x 20\""
]);
myDropdown.selection = 0
var group3 = Pallette.add("group");
    group3.orientation = "row";
    //var a = group3.add("radiobutton", undefined, "Single Artboard");
    var a = group3.add("radiobutton", undefined, "All Artboards");
    var radiobuttons = [a];
    a.checkedState = false;
    for (var i = 0; i < radiobuttons.length; i++) {
    (function (i) {
        radiobuttons[i].onClick = function () {
            method = radiobuttons[i].text;
        };
    })(i);
 }

    var myButtonGroup =  Pallette.add ("group");
    myButtonGroup.orientation = "column";
    var btnCreate = myButtonGroup.add ("button", undefined, "OK");
    btnCreate.onClick = function () {
    choice = myDropdown.selection.text;
    method = radiobuttons[i].text;
    w.button.onClick = function () {

        w.close();
   
    }  
 };
Pallette.show ();

var method = method;

if(method == "All Artboards"){

    if (choice == "8.5\" x 11\"") {
        resizeAllArtboards(8.5 * 72, 11 * 72);
    } else if (choice == "11\" x 8.5\"") {
        resizeAllArtboards(11 * 72, 8.5 * 72);
    } else if (choice == "12\" x 12\"") {
        resizeAllArtboards(12 * 72, 12 * 72);
    } else if (choice == "12\" x 16\"") {
        resizeAllArtboards(12 * 72, 16 * 72);
    } else if (choice == "16\" x 12\"") {
        resizeAllArtboards(16 * 72, 12 * 72);
    } else if (choice == "24\" x 12\"") {
        resizeAllArtboards(24 * 72, 12 * 72);
    }  else if (choice == "32\" x 20\"") {
        resizeAllArtboards(32 * 72, 20 * 72);
    }}
else {
    // new code
    if (choice == "8.5\" x 11\"") {
        resizeArtboard(8.5 * 72, 11 * 72);
    } else if (choice == "11\" x 8.5\"") {
        resizeArtboard(11 * 72, 8.5 * 72);
    } else if (choice == "12\" x 12\"") {
        resizeArtboard(12 * 72, 12 * 72);
    } else if (choice == "12\" x 16\"") {
        resizeArtboard(12 * 72, 16 * 72);
    } else if (choice == "16\" x 12\"") {
        resizeArtboard(16 * 72, 12 * 72);
    } else if (choice == "24\" x 12\"") {
        resizeArtboard(24 * 72, 12 * 72);
    }  else if (choice == "32\" x 20\"") {
        resizeArtboard(32 * 72, 20 * 72);
    }
   
 }


function resizeAllArtboards(w, h) {
        for (var i = 0; i < ABs.length; i++) {
        app.selection = null;
        ABs.setActiveArtboardIndex(i);
        var idx  = docRef.artboards.getActiveArtboardIndex();
        var AB  = docRef.artboards[idx];
        var ABR = AB.artboardRect;
        var xC = ABR[0]+((ABR[2]-ABR[0])/2);
        var yC = ABR[1]+((ABR[3]-ABR[1])/2);
        AB.artboardRect = [xC-w/2, yC+h/2, xC+w/2, yC-h/2];
  }
 }

function resizeArtboard(w, h) {
    var idx  = docRef.artboards.getActiveArtboardIndex();
    var AB  = docRef.artboards[idx];
    var ABR = AB.artboardRect;
    var xC = ABR[0]+((ABR[2]-ABR[0])/2);
    var yC = ABR[1]+((ABR[3]-ABR[1])/2);
    AB.artboardRect = [xC-w/2, yC+h/2, xC+w/2, yC-h/2];
    }

 

Votes

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 ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

LATEST

Thank you for the effort. Appreciated

Votes

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