Mobile app version of vmapp.org
Login or Join
Hamaas979

: CS5 export layers as files with NO number sequence I am using cs5 layers to modify and then exporting layers as files. While saving CS5 automatically adds some number sequence at the end thereby

@Hamaas979

Posted in: #AdobePhotoshop #Cs5 #Export #Layers #Mac

I am using cs5 layers to modify and then exporting layers as files. While saving CS5 automatically adds some number sequence at the end thereby modifying my original filename.

It automatically embeds a number sequence prefix to the exported layers, thus rendering my own file naming convention useless. Is there a fix for this? Is there an option somewhere called 'dont auto-renumber my files' or 'use layer names as file names"?

I DO NOT want this numbering. How to prevent this ?

10.06% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamaas979

6 Comments

Sorted by latest first Latest Oldest Best

 

@Connie430

I'm pretty sure I have figured it out guys. Thanks to everyone who posted in this forum giving me the clues that were needed to put this to rest. So the code is as follows:

line: 2179 var fileNameBody = fileNamePrefix;
//fileNameBody += "" + zeroSuppress(i, 4);
//fileNameBody += "" + layerName;
fileNameBody += layerName;

What this does is get rid of the prefix for most layer names. The issue that many of us had after was that when layers were in groups, it still had a prefix when saved. To fix that you need to alter one more line of code:

line: 2219 //fileNameBody += "_" + zeroSuppress(i, 4) + "s";

Essentially you need to comment out this code, which should be under the "var fileNameBody = fileNamePrefix;" line of code. This should remove the prefix even if your layers are grouped.

The only code you need to change is what I have coded to be red.

Disclaimer: line number in code may vary by what version of photoshop you have. You can get around this by simply using your applications search feature to search for the code. Make sure you remove the "//" or else it won't find what you are looking for in the code.

I hope I help someone with this.

10% popularity Vote Up Vote Down


 

@Speyer780

In the Layer Comps to Files dialogue box, just next to File Name Prefix, uncheck Index. This prevents the index numbers from being added.

10% popularity Vote Up Vote Down


 

@Chiappetta793

For CC 2015.5 you need to comment out lines 1083 and 1084

// fileNameBody += "_" + zeroSuppress(i, 4);
// fileNameBody += "_" + layerName;


and replace lines 1085 - 1088

fileNameBody = fileNameBody.replace(/[:/*?"<>|]/g, "_"); // '/:*?"<>|' -> '_'
if (fileNameBody.length > 120) {
fileNameBody = fileNameBody.substring(0,120);
}


with the following

fileNameBody += "" + layerName;

10% popularity Vote Up Vote Down


 

@Candy945

For Photoshop CC it is line 1020. Plus you can copy, comment out and edit the line below it to remove the underscore from the naming.

// fileNameBody += "_" + zeroSuppress(i, 4);
// fileNameBody += "_" + layerName;
fileNameBody += "" + layerName;

10% popularity Vote Up Vote Down


 

@Hamaas979

To add in words, Since Export Layers to Files is run by some script all I had to do was find that script, then find the function which saves the layers to files, find which part of the function does the numbering prefix & comment it out.

So here are the steps -


on Mac running Lion, goto Applications > Adobe Photoshop CS5 > Presets > Scripts > Export Layers To Files.jsx (in windows it's pretty much the same directory just in "program files/Adobe"
Now in this file goto line 1030 and comment it out.
Also in line 1031, change fileNameBody += "_" + layerName; to fileNameBody += layerName; deleting the underscore and parenthesis.
Comment out line 1049 (fileNameBody += "_" + zeroSuppress(i, 4) + "s";)


Save and close the file. This should get the job done. Below are the forum source links.
forums.adobe.com/message/3006825 forums.devshed.com/photoshop-help-88/removing-number-sequence-in-export-layers-to-files-in-cs5t-730612.html

10% popularity Vote Up Vote Down


 

@Speyer780

I see your problem. I don't know of any way to adjust this within Photoshop, but you do have a couple of alternatives.

First, you can batch rename all your files using Adobe Bridge. (Tools >> Batch rename)


As you can see, this window provides many more options for renaming your files and controlling prefixes and suffixes. The downside is, if you need the layers in a particular order right when you save, bridge won't catch that as it's just renaming files that are already saved.

Second, I've written a script as an answer for another question. (Which I just updated to accommodate your need to saves layers using their layer name). The script, while not super customizable, saves all layers as either JPEG (with quality control) or PNG and saves all layers as files using their layer names.
Please let me know if you run into any issues, I've only been able to test the script on my own machine and it works perfectly fine.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme