Skip to main content
maninthebox390
New Participant
October 23, 2015
Question

need script to export all layer names into an excel sheet or text file.

  • October 23, 2015
  • 3 replies
  • 14589 views

are there any scripts to export layer names into an excel sheet or a text file?

This topic has been closed for replies.

3 replies

Participating Frequently
May 29, 2023

Hi. is there a way to skip the Hue/Saturation layers from the list, because they are getting added too?

Thanks,

Mukul

Stephen Marsh
Community Expert
May 29, 2023
quote

Hi. is there a way to skip the Hue/Saturation layers from the list, because they are getting added too?

Thanks,

Mukul


By @chandubhau

 

What method are you using, the one from @jazz-y or another one?

Participating Frequently
May 29, 2023

Yes, the one from @jazz-y .

Stephen Marsh
Community Expert
May 13, 2017

This is also possible with ExifTool using the following command:

exiftool -Photoshop:LayerNames PATH-TO-FILE-or-FOLDER

Which would output the following (which may be a little cryptic, see the screenshot below for a visual):

Color Fill 1, </Layer group>, Layer 0, Layer 1, Layer 2, Layer 3, Group 1, Layer 4, Invert 1

For an Adobe Illustrator .AI file, the command would be:

exiftool -a -XMP-egLayL:LayersName PATH-TO-FILE-or-FOLDER

natrev
Brainiac
October 23, 2015

Hi maninthebox390,

Try this Code..... and Big Thanks to c.pfaffenbichler.

-yajiv

#target photoshop

var theLayers = collectLayers(app.activeDocument, []);

////// function collect all layers //////

function collectLayers (theParent, allLayers) {

      if (!allLayers) {var allLayers = new Array}

      else {};

        var theNumber = theParent.layers.length - 1;

      for (var m = theNumber; m >= 0;m--) {

          var theLayer = theParent.layers;

        // apply the function to layersets;

          if (theLayer.typename == "ArtLayer") {

          OutFoldCSV("~/Desktop",theLayer.name);

          }

          else {

          allLayers = (collectLayers(theLayer, allLayers))

        // this line includes the layer groups;

          OutFoldCSV("~/Desktop/Layer_Data",theLayer.name);

          }

      };

      //return allLayers

  };

     function OutFoldCSV(App_Path,Layer_name){

        var outfolder = new Folder(App_Path)

            if (outfolder.exists == false){

                outfolder.create();

                var myLogFile = new File(outfolder + "/LayerRef.xls");

                myLogFile.open("a", undefined, undefined)

                myLogFile.write(Layer_name);

                myLogFile.write("\n");

            }

            else{

                var myLogFile = new File(outfolder + "/LayerRef.xls");

                myLogFile.open("a", undefined, undefined)

                myLogFile.write(Layer_name);                

                myLogFile.write("\n");

            }

    }

New Participant
February 14, 2021

I have a project I am working on that has almost 1400 layers and I need help with a script that will export the layer names to a text file (preferably) or an .xls file.

I tried the code in this link but it doesn't work... may just need some mods. (It was something I found on the web from 2015).  

Can anyone help me with this?

 

need script to export all layer names into an excel sheet or text file.

 

Thanks in advance!

Scott

Kukurykus
Brainiac
February 14, 2021

It's better to ask same question in that topic instead of 'duplicating' existing one.