Skip to main content
palericksson
Participating Frequently
May 22, 2015 11:17 AM UTC
Answered

Is there a way to batch rename artboards in Illustrator CC?

Is there a way to batch rename artboards in Illustrator CC?

I have 20 different artbords that i want to rename with a specific name and number!

/Pål

This topic is closed to new replies. Start a new post to keep the conversation going.
Qwertyfly___
Qwertyfly___Correct answer
Legend
May 25, 2015 1:41 AM UTC

does this do what you are after?

modified a script I wrote to do the same with layers.

//===========================================================

//

//          Rename Artboards

//

//===========================================================

//

//          Version 0.1

//          25/5/2015

//          Qwertyfly

//

//===========================================================

var doc = app.activeDocument, abs = [];

for(var i = 0; i < doc.artboards.length; i++){

    abs.push(doc.artboards.name);

}

var w = new Window('dialog',"Artboard Name Editor");

var list = w.add('group');

list.orientation = "Column";

var head = list.add('group');

head.alignment = "left";

var p = head.add('statictext', undefined, "Prefix");

var n = head.add('statictext', [0,0,165,20], "         Artboard Name");

var s = head.add('statictext', undefined, "Suffix");

var  pre = [], nam = [], suf = [];

for(var i = 0; i < abs.length; i++){

    newLine(i,"item" + i);

}

function newLine(num,item){

    item = list.add('group');

    item.alignment = "left";

    pre[num] = item.add('checkbox', undefined,"");

    nam[num] = item.add('edittext', [0,0,200,20], abs);

    nam[num].characters = 50;

    suf[num] = item.add('checkbox', undefined, "");

}

var sep1 = list.add("panel");

sep1.alignment = ["fill","fill"];

sep1.minimumSize.height = sep1.maximumSize.height = 2;

var prefixt = list.add('statictext', undefined, "Prefix to add to checked artboards");

var prefix = list.add('edittext', [0,0,250,20], "");

var sep2 = list.add("panel");

sep2.alignment = ["fill","fill"];

sep2.minimumSize.height = sep2.maximumSize.height = 2;

var prefixt = list.add('statictext', undefined, "Suffix to add to checked artboards");

var suffix = list.add('edittext', [0,0,250,20], "");

var sep3 = list.add("panel");

sep3.alignment = ["fill","fill"];

sep3.minimumSize.height = sep3.maximumSize.height = 2;

var ButtonGroup = w.add("group");

  ButtonGroup.margins = [0,-10,0,-8];

  ButtonGroup.alignment = "right";

  var go = ButtonGroup.add ("button", undefined, "OK");

  var stop = ButtonGroup.add ("button", undefined, "Cancel");

  stop.onClick = function(){

  w.close();

  }

    go.onClick = function(){

        var validatePre = false, validateSuf = false, validateMessage = "";

        for(var i = 0; i < abs.length; i++){

            if(pre.value == true && prefix.text == ""){validatePre = true}

            if(suf.value == true && suffix.text == ""){validateSuf = true}

        }

        if(validatePre == true){validateMessage = "Artboards have been marked for Prefix, but no Prefix entered\n"}

        if(validateSuf == true){validateMessage = validateMessage + "Artboards have been marked for Suffix, but no Suffix entered"}

        if(validateMessage != ""){

            alert(validateMessage);

        }else{

            w.close();

            goTime();

        }

  }

w.show();

function goTime(){

    for(var i = 0; i < abs.length; i++){

        var na = nam.text;

        var pr = "";

        var su = "";

        if(pre.value == true){pr = prefix.text + " - "}

        if(suf.value == true){su = " - " + suffix.text}

        doc.artboards.name = pr + na + su;

    }

}

54 replies

Inspiring
Jan 10, 2024 2:17 PM UTC

@Sergey Osokin Thanks for the work you do! Would it be easy to add a function to the script to find and replace only on certain artboards? Or to select artboards in the Artboards panel as an input to the script? That would make it super useful for me. 

Translate
Sergey Osokin
Inspiring
Jan 10, 2024 3:37 PM UTC

I will consider your request. Unfortunately, selected artboards in the Artboards panel are not available for scripting.

Translate
Participant
Jan 7, 2023 6:45 PM UTC
var doc = app.activeDocument;

for(var i = 0; i < doc.artboards.length; i++){
   doc.artboards[i].name="INSERT-NAME-HERE"+"-"+(i+1);
   }

 

Place whatever name you want your artboards to have inside the quotes of "INSERT-NAME-HERE". 

Place the above code in a .js file, and run from "File->Scripts->Other Script" in Adobe Illustrator. 

Translate
Qwertyfly___
Qwertyfly___Correct answer
Legend
May 25, 2015 1:41 AM UTC

does this do what you are after?

modified a script I wrote to do the same with layers.

//===========================================================

//

//          Rename Artboards

//

//===========================================================

//

//          Version 0.1

//          25/5/2015

//          Qwertyfly

//

//===========================================================

var doc = app.activeDocument, abs = [];

for(var i = 0; i < doc.artboards.length; i++){

    abs.push(doc.artboards.name);

}

var w = new Window('dialog',"Artboard Name Editor");

var list = w.add('group');

list.orientation = "Column";

var head = list.add('group');

head.alignment = "left";

var p = head.add('statictext', undefined, "Prefix");

var n = head.add('statictext', [0,0,165,20], "         Artboard Name");

var s = head.add('statictext', undefined, "Suffix");

var  pre = [], nam = [], suf = [];

for(var i = 0; i < abs.length; i++){

    newLine(i,"item" + i);

}

function newLine(num,item){

    item = list.add('group');

    item.alignment = "left";

    pre[num] = item.add('checkbox', undefined,"");

    nam[num] = item.add('edittext', [0,0,200,20], abs);

    nam[num].characters = 50;

    suf[num] = item.add('checkbox', undefined, "");

}

var sep1 = list.add("panel");

sep1.alignment = ["fill","fill"];

sep1.minimumSize.height = sep1.maximumSize.height = 2;

var prefixt = list.add('statictext', undefined, "Prefix to add to checked artboards");

var prefix = list.add('edittext', [0,0,250,20], "");

var sep2 = list.add("panel");

sep2.alignment = ["fill","fill"];

sep2.minimumSize.height = sep2.maximumSize.height = 2;

var prefixt = list.add('statictext', undefined, "Suffix to add to checked artboards");

var suffix = list.add('edittext', [0,0,250,20], "");

var sep3 = list.add("panel");

sep3.alignment = ["fill","fill"];

sep3.minimumSize.height = sep3.maximumSize.height = 2;

var ButtonGroup = w.add("group");

  ButtonGroup.margins = [0,-10,0,-8];

  ButtonGroup.alignment = "right";

  var go = ButtonGroup.add ("button", undefined, "OK");

  var stop = ButtonGroup.add ("button", undefined, "Cancel");

  stop.onClick = function(){

  w.close();

  }

    go.onClick = function(){

        var validatePre = false, validateSuf = false, validateMessage = "";

        for(var i = 0; i < abs.length; i++){

            if(pre.value == true && prefix.text == ""){validatePre = true}

            if(suf.value == true && suffix.text == ""){validateSuf = true}

        }

        if(validatePre == true){validateMessage = "Artboards have been marked for Prefix, but no Prefix entered\n"}

        if(validateSuf == true){validateMessage = validateMessage + "Artboards have been marked for Suffix, but no Suffix entered"}

        if(validateMessage != ""){

            alert(validateMessage);

        }else{

            w.close();

            goTime();

        }

  }

w.show();

function goTime(){

    for(var i = 0; i < abs.length; i++){

        var na = nam.text;

        var pr = "";

        var su = "";

        if(pre.value == true){pr = prefix.text + " - "}

        if(suf.value == true){su = " - " + suffix.text}

        doc.artboards.name = pr + na + su;

    }

}

Translate
palericksson
Participating Frequently
May 25, 2015 8:58 AM UTC

WOW!

Thanks a lot, you saved me a lot of time!

/Pål

–

Translate
Qwertyfly___
Legend
May 25, 2015 9:57 AM UTC

Glad I could help

Translate