22 Replies Latest reply on Apr 24, 2015 11:37 AM by mathews96862287

    Each file on it's own layer + layer name

    mathews96862287 Level 1

      I create interactive maps in illustrator and export individual al's to InDesign. I run the following script to place each file on it's own layer. I would like it to name the layer the file name that is being placed on that layer minus the .ai

      The reason I do this to export to PDF in chunks then combine in Acrobat to have headings and sub headings which can be toggled on/off depending on what the person operating the map would like to see.


      If there is an easier way to do this I'm all ears. I cannot export directly from Illustrator as there are simply 100s of layers that can be turned on or off without any headings. Any suggestions or rewrites of the script are greatly appreciated.


      For example:

      County Lands by owner

           Johnson land

           Scott land




           Unpaved roads    



      var mySels = app.selection.length; 

      if (mySels == 0) { 

          alert("Select the object and Run the script");  





                var objLayer=app.activeDocument.layers.add(); 

                app.selection[mySels].itemLayer = objLayer;