2 Replies Latest reply on Jul 13, 2015 8:37 AM by andreasr45946726

    select symbol on artboard and copy symbol name to art board name


      I am generating icons in AI CS6

      I have AI files with 100 artboards

      Some art boards are still empty, while in progress.

      On most artboard I have the raw paths and on a separate layer called Symbols with one Symbol only.


      The symbol layer could be the only visible layer.

      100 symbols in the document.

      Now I want to copy those names to the art board names for export and to a text box on the art board for printing an overview.


      I found a script to rename a layer to its content - but it does not recognize symbols

      I found a script to rename an artboard to a layer

      I found a script to place a text box with the art board name on the art board.


      I cannot combine them, please help!


      I can do applescript and Filemaker scripting, but I am new to Javascript.




      Rename Layer to content - does not recognize Symbols!


      function LayerNameMatch() { 

          if (app.documents.length == 0) { 

              alert("No Open / Active Document Found"); 

          } else { 

              var doc, i, l, ab, sel, n; 

              doc = app.activeDocument; 

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

                  ab = doc.artboards[i]; 



                  sel = doc.selection[0]; 

                  sel.parent.name = sel.name; 

                  doc.selection = false; 







      Rename artboard to layer name:



      if (app.documents.length == 0) { 

          alert("No Open / Active Document Found"); 

      } else { 

          var doc = app.activeDocument; 

          if (doc.artboards.length == doc.layers.length && doc.layers.length == doc.artboards.length) { 

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

                  var ab = doc.artboards[i]; 

                  ab.name = doc.layers[i].name; 


              alert("Finished:\nRenaming of Artboards to match Layer names is complete"); 

          } else { 

              alert("Opps: This wont work!\n The number of Layers and Artboards do not match"); 



      Make a Textbox with art board name


         //This script takes a document's artboard names and prints them into each artboard. 

          // Tell the script to only work on the open, focused document 

          var myDocument = app.activeDocument;

                                              var idoc = app.activeDocument;

                                              var ilayer = idoc.layers.add();

                                              ilayer.name = "0 SeitenName";


          // STEP ONE: Create the labels for each artboard    

          // grab ahold of the artboards 

          for (var i = 0; i < app.activeDocument.artboards.length; i++) 


                    var artboard = app.activeDocument.artboards[i]; 


                    // For each artboard, add a new text frame 

                    var myLabel = myDocument.textFrames.add(); 


                    // fill it with the artboard name 

                    myLabel.contents = artboard.name; 


                    // this line controls the font size 

                    myLabel.textRange.characterAttributes.size = 12; 


                    // this line positions the text relative to each artboard 

                    myLabel.position = [artboard.artboardRect[0], artboard.artboardRect[1]];