18 Replies Latest reply on Nov 8, 2017 10:08 AM by bennyh35228578

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

    palericksson Level 1

      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

        • 1. Re: Is there a way to batch rename artboards in Illustrator CC?
          Qwertyfly... Level 4

          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[i].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[i]);
              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[i].value == true && prefix.text == ""){validatePre = true}
                      if(suf[i].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[i].text;
                  var pr = "";
                  var su = "";
                  if(pre[i].value == true){pr = prefix.text + " - "}
                  if(suf[i].value == true){su = " - " + suffix.text}
                  doc.artboards[i].name = pr + na + su;
              }
          }
          
          
          • 2. Re: Is there a way to batch rename artboards in Illustrator CC?
            palericksson Level 1

            WOW!

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

            /Pål

             

            • 4. Re: Is there a way to batch rename artboards in Illustrator CC?
              palericksson Level 1

              Hi again Qwertyfly...

               

              Another question!

              I have so many artboards that they dont fit into the menue when I try to rename them, its impossible to scroll that menue!

              Is that something you could solve?

              Kind regards, Pål

              • 5. Re: Is there a way to batch rename artboards in Illustrator CC?
                williamadowling Level 4

                can you post a screenshot of what you're talking about? How do you mean 'impossible' to scroll the menu?

                • 6. Re: Is there a way to batch rename artboards in Illustrator CC?
                  palericksson Level 1

                  Menu.jpgFullscreen.jpgHi!

                  I have attached two screen dumps, one of the menu and one of the whole

                  screen.

                  Hope it will make you understand.

                  /Pål

                  • 7. Re: Is there a way to batch rename artboards in Illustrator CC?
                    Silly-V Adobe Community Professional

                    Maybe a "Paginated" view would help, wherein only 25 artboards are visible per tab.

                    • 8. Re: Is there a way to batch rename artboards in Illustrator CC?
                      williamadowling Level 4

                      Is the dialog necessary? Is there a known value you want to change the artboards to all the time? Or does that change? I guess i'm not entirely sure what you want to do.

                      • 9. Re: Is there a way to batch rename artboards in Illustrator CC?
                        Qwertyfly... Level 4

                        i can add a scroll bar. But it needs quite a rework to do so.

                        not hard just more work. Leave it with me.

                        very busy right now bit will try to get back to you asap

                        • 10. Re: Is there a way to batch rename artboards in Illustrator CC?
                          palericksson Level 1

                          Great!

                          I'll wait!

                          Thanks a lot!

                          /Pål

                           

                          >>> "Qwertyfly..." <forums_noreply@adobe.com> 2015-06-05 07:24 >>>

                          Qwertyfly...  created the

                          discussion

                           

                           

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

                           

                           

                          To view the discussion, visit:

                          https://forums.adobe.com/message/7611793#7611793

                          • 11. Re: Is there a way to batch rename artboards in Illustrator CC?
                            Qwertyfly... Level 4

                            I've not done a lot of testing on it but it seems to work.

                            let me know if this works for you.

                            or if there are any problems

                             

                            Don't Forget - you can set the dialog size but modifying the rows variable at the top of the script

                             

                            //=========================================================== 
                            // 
                            //          Rename Artboards 
                            // 
                            //=========================================================== 
                            // 
                            //          Version 0.2 
                            //          7/6/2015 
                            //          Qwertyfly 
                            // 
                            //=========================================================== 
                            //          User set variable
                            var rows = 10;      // Number of visible rows.
                            //===========================================================
                            var doc = app.activeDocument, abs = [], item = [];
                            for(var i = 0; i < doc.artboards.length; i++){ 
                                abs[i] = [];
                                abs[i] = [false,doc.artboards[i].name,false,i];
                            }
                            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 scrollwin = list.add('group');
                            scrollwin.alignChildren = "fill";
                            var items = scrollwin.add ("panel");
                            if(abs.length<rows){
                                for(var i = 0; i < abs.length; i++){ 
                                    newLine(i,"item" + i); 
                                } 
                            }else{
                                var sbar = scrollwin.add ("scrollbar", undefined, 0, 0, abs.length-rows);
                                sbar.preferredSize.width = 20;
                                for(var i = 0; i < rows; i++){
                                    item[i] = items.add('group');
                                    item[i].alignment = "left"; 
                                    newLine(i,item[i]); 
                                }
                                sbar.onChanging = function(){ //alert("sbar change");
                                    var start = Math.round (this.value);
                                    var stop = start+rows;
                                    var r = 0;
                                    for (var i = start; i < stop; i++){
                                        pre[r].value = abs[i][0];
                                        pre[r].label = abs[i][3];
                                        nam[r].text = abs[i][1];
                                        nam[r].label = abs[i][3];
                                        suf[r].value = abs[i][2];
                                        suf[r].label = abs[i][3];
                                        r++;
                                    }
                                }
                            }
                            
                            
                            function newLine(num,item){ 
                                pre[num] = item.add('checkbox', undefined,"");
                                pre[num].value = abs[num][0];
                                pre[num].label = abs[num][3];
                                pre[num].onClick = function () {if(abs[this.label][0] == false){abs[this.label][0] = true}else{abs[this.label][0] = false}}
                                nam[num] = item.add('edittext', [0,0,200,20]); 
                                nam[num].characters = 50; 
                                nam[num].text = abs[num][1];
                                nam[num].label = abs[num][3];
                                nam[num].onChange = function() {abs[this.label][1] = this.text;}
                                suf[num] = item.add('checkbox', undefined, ""); 
                                suf[num].value = abs[num][2];
                                suf[num].label = abs[num][3];
                                suf[num].onClick = function () {if(abs[this.label][2] == false){abs[this.label][2] = true}else{abs[this.label][2] = false}}
                            } 
                            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(abs[i][0].value == true && prefix.text == ""){validatePre = true} 
                                        if(abs[i][2].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 = abs[i][1]; 
                                    var pr = ""; 
                                    var su = ""; 
                                    if(abs[i][0] == true){pr = prefix.text + " - "} 
                                    if(abs[i][2] == true){su = " - " + suffix.text} 
                                    doc.artboards[i].name = pr + na + su; 
                                } 
                            }
                            
                            
                            
                            
                            
                            
                            
                            • 12. Re: Is there a way to batch rename artboards in Illustrator CC?
                              palericksson Level 1

                              Hi again!

                              I get an error when i run this script!!!

                               

                              Error_script.jpg

                               

                               

                              Kind regards, Pål

                               

                               

                               

                               

                              >>> "Qwertyfly..." <forums_noreply@adobe.com> 2015-06-07 08:32 >>>

                              Qwertyfly...  created the discussion

                               

                               

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

                               

                               

                              To view the discussion, visit: https://forums.adobe.com/message/7616757#7616757

                              • 13. Re: Is there a way to batch rename artboards in Illustrator CC?
                                Qwertyfly... Level 4

                                i must have had a car initiated in the main engine.

                                leave it with me and I'll make it work

                                • 14. Re: Is there a way to batch rename artboards in Illustrator CC?
                                  Qwertyfly... Level 4

                                  I forgot to initiate a few of the arrays... Oops.

                                   

                                  //===========================================================
                                  //
                                  //          Rename Artboards
                                  //
                                  //===========================================================
                                  //
                                  //          Version 0.2.1
                                  //          10/6/2015
                                  //          Qwertyfly
                                  //
                                  //===========================================================
                                  //
                                  //          ChangeLog
                                  //
                                  //          Version 0.2
                                  //          -added scrollbar (needed full rework)
                                  //
                                  //          Version 0.2.1
                                  //          -bug fix, forgot to initiate the "pre" "nam" & "suf" arrays.
                                  //          -added user var for Seperators
                                  //
                                  //===========================================================
                                  //          User set variable
                                  var rows = 10;          // Number of visible rows.
                                  var preSep = " - ";     // Seperator between Prefix and name
                                  var sufSep = " - ";     // Seperator between name and Suffix
                                  //===========================================================
                                  var doc = app.activeDocument, abs = [], item = [], pre = [], nam = [], suf = [];
                                  for(var i = 0; i < doc.artboards.length; i++){
                                      abs[i] = [];
                                      abs[i] = [false,doc.artboards[i].name,false,i];
                                  }
                                  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 scrollwin = list.add('group');
                                  scrollwin.alignChildren = "fill";
                                  var items = scrollwin.add ("panel");
                                  if(abs.length<rows){
                                      for(var i = 0; i < abs.length; i++){
                                          newLine(i,item[i]);
                                      }
                                  }else{
                                      var sbar = scrollwin.add ("scrollbar", undefined, 0, 0, abs.length-rows);
                                      sbar.preferredSize.width = 20;
                                      for(var i = 0; i < rows; i++){
                                          item[i] = items.add('group');
                                          item[i].alignment = "left";
                                          newLine(i,item[i]);
                                      }
                                      sbar.onChanging = function(){
                                          var start = Math.round (this.value);
                                          var stop = start+rows;
                                          var r = 0;
                                          for (var i = start; i < stop; i++){
                                              pre[r].value = abs[i][0];
                                              pre[r].label = abs[i][3];
                                              nam[r].text = abs[i][1];
                                              nam[r].label = abs[i][3];
                                              suf[r].value = abs[i][2];
                                              suf[r].label = abs[i][3];
                                              r++;
                                          }
                                      }
                                  }
                                  function newLine(num,item){
                                      pre[num] = item.add('checkbox', undefined,"");
                                      pre[num].value = abs[num][0];
                                      pre[num].label = abs[num][3];
                                      pre[num].onClick = function () {if(abs[this.label][0] == false){abs[this.label][0] = true}else{abs[this.label][0] = false}}
                                      nam[num] = item.add('edittext', [0,0,200,20]);
                                      nam[num].characters = 50;
                                      nam[num].text = abs[num][1];
                                      nam[num].label = abs[num][3];
                                      nam[num].onChange = function() {abs[this.label][1] = this.text;}
                                      suf[num] = item.add('checkbox', undefined, "");
                                      suf[num].value = abs[num][2];
                                      suf[num].label = abs[num][3];
                                      suf[num].onClick = function () {if(abs[this.label][2] == false){abs[this.label][2] = true}else{abs[this.label][2] = false}}
                                  }
                                  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(abs[i][0].value == true && prefix.text == ""){validatePre = true}
                                              if(abs[i][2].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 = abs[i][1];
                                          var pr = "";
                                          var su = "";
                                          if(abs[i][0] == true){pr = prefix.text + "" + preSep}
                                          if(abs[i][2] == true){su = sufSep + "" + suffix.text}
                                          doc.artboards[i].name = pr + na + su;
                                      }
                                  }
                                  
                                  
                                  
                                  
                                  2 people found this helpful
                                  • 15. Re: Is there a way to batch rename artboards in Illustrator CC?
                                    palericksson Level 1

                                    WOW!

                                    Thanks a lot, works perfect!

                                    /Pål

                                     

                                    >>> "Qwertyfly..." <forums_noreply@adobe.com> 2015-06-10 02:53 >>>

                                    Qwertyfly...  created the

                                    discussion

                                     

                                     

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

                                     

                                     

                                    To view the discussion, visit:

                                    https://forums.adobe.com/message/7625415#7625415

                                    • 16. Re: Is there a way to batch rename artboards in Illustrator CC?
                                      Qwertyfly... Level 4

                                      glad it helps you.

                                      hope others can use it to!

                                      • 17. Re: Is there a way to batch rename artboards in Illustrator CC?
                                        willaeast02 Level 1

                                        Hello Qwertyfly! Thanks so much for making this. I was able to get the first script to work but I keep getting the "Error 21: undefined is not an object" on Line: 73 for some reason.

                                         

                                        error.PNG

                                        • 18. Re: Is there a way to batch rename artboards in Illustrator CC?
                                          bennyh35228578

                                          Hi Qwertyfly

                                           

                                          I'm super new with scripting and don’t know where to begin

                                          I have multiple Illustrator artboards that are already named something like this:

                                           

                                          icon_DataRawInfo_blue

                                          icon_Devices_blue


                                          I was wondering if there is a script that can find and replace a certain text in this case “blue” to “black” or whatever text it need to be found and replaced.

                                           

                                           

                                          Any info on this is greatly appreciated. Also how do you install the script.

                                           

                                          Thank you!

                                           

                                           

                                           

                                           


                                          ben