• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Removing number sequence in 'Export layers to files" in CS5

New Here ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

Hi the script automatically embeds a number sequence prefix to the exported layers, thus rendering your own file naming convention useless. Is there a fix for this? Perhaps the JS file can be rewritten? Or an option created called 'dont auto-renumber my files' or 'use layer names as file names".

This is a similar thread, but for CS2, Im trying to get answers there too.

http://www.photoshopcafe.com/cafe/viewthread.php?tid=34313

The JS edits suggested there arent working for CS5.

Please help becuase its almost as painful renaming the final files as it is to simply "file/save as", which makes this script useless.

Cheers

TOPICS
Actions and scripting

Views

43.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jul 27, 2010 Jul 27, 2010

Comment out line 1030 by adding // to the start of the line.

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

That is the line that adds the numbers to the name.

Votes

Translate

Translate
Adobe
New Here ,
Jul 15, 2015 Jul 15, 2015

Copy link to clipboard

Copied

I would be very grateful to anyone who can post an updated script to replace the one in Photoshop 2015. I use layer comps to export to invision all the time and the old script I'd downloaded to remove the numbers doesn't work anymore with 2015. I wish adobe would just add a checkbox to remove numbers!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 15, 2015 Jul 15, 2015

Copy link to clipboard

Copied

Hi,

Same problem here.

Since update 2115.0.0 Release 20150529.r.88 x64 "Export layers to files" was moved from the Scripts menu to Export menu and the code alteration doesn't work anymore.

Please let me know if you found a solution.

Best,

Sebastian.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 19, 2015 Aug 19, 2015

Copy link to clipboard

Copied

I opened the "Export to Files" file in C:\Program Files\Adobe\Adobe Photoshop CC 2015\Presets\Scripts with Notepad in Administrator Mode. I then did a search for the lines posted above, made the changes and it worked for me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2015 Aug 21, 2015

Copy link to clipboard

Copied

Hello o0brewsky0o, can you tell me what lines did you change? I have tried most of the ones above but still not working.

Thanks!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 21, 2015 Aug 21, 2015

Copy link to clipboard

Copied

Sure, lines 1065 – 1067 are where they are in the current PS scripts. Did the same edits mentioned above.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 06, 2015 Oct 06, 2015

Copy link to clipboard

Copied

On Yosemite (Mac OSX), navigate to Applications/Adobe Photoshop CC 2015/Presets/Scripts/Layer Comps To Files.jsx and go to lines 191 & 192 (You'll have to open up the file in ExtendScript Toolkit from Adobe.

I've never tried, but it's possible a text editor would suffice.

191 //fileNameBody += "_" + zeroSuppress(compsIndex, 4); // This removes the number sequence

192 fileNameBody += "" + compRef.name; // This removes the underscore before the number sequence

Comment out line 191 and just remove the underscore between the double quotes in line 192.

This is what worked for me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 22, 2015 Dec 22, 2015

Copy link to clipboard

Copied

Hi,

I'm using Photoshop 2015.1.1 Release (20151209.r.327 x64, Mac Pro 10.11.2 (15C50))

Before the latest update I had the modified version of the Export Layers To Files scrip that completed the task without the four digit prefix nor underscores.

I can't figure out how to update the current script to do the same. It seems like the line numbers are different.

Please advise.

Best,

S.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 22, 2015 Dec 22, 2015

Copy link to clipboard

Copied

The line numbers for the 2015 script start at 1059. You can try and play around with the code there to get the result you want.

var fileNameBody = fileNamePrefix;

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

fileNameBody += "_" + layerName;

fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|]/g, "_");  // '/\:*?"<>|' -> '_'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Hi Chuck,

Really appreciated your reply. I must say: I'm by no means a code expert…

I've been trying to modify this script without success for hours.

Current file name: _0001_untitled.jpg

Wanted file name: untitled.jpg

Please shed a light.

Best,

S.    

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

I haven't tried it, but it looks like in the above code that I posted, the variable fileNameBody, should be the actual file name of the original document. In line 2 or I think 1059 in the original code, is where it will put the underscore and sequence number, so if you don't want that, comment it out with //. Line 3 adds another underscore and the name of the layer. So you would either need to comment that out or add something to make each file unique, so they don't overwrite themselves. Line 4 replaces any of the symbols after the // with an underscore. You can change the underscore to whatever character you want that is acceptable in a file name.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Not sure if this is what you meant, it's working now like this.

Thanks!

S.

Screen Shot 2015-12-23 at 11.56.10 AM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Pretty much. line 1059 can be commented out using the double back slash "//". What you have there doesn't do anything. You're adding nothing to the variable fileNameBody. With line 1060, you can delete the middle section, as that just adds nothing, so it should look like:

fileNameBody += layerName;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2016 Mar 26, 2016

Copy link to clipboard

Copied

Okay first off.  Thank you to ALL you have worked on this.  I want to provide some word of caution before anyone pulls all there hair out like I did.  If you have both x64 and x86 versions installed: be sure to edit the correct file.  I was editing the x86 version on my system while I was using the x64.  It seemed to me that nothing was working.  Well nothing WAS working because I was editing the wrong file. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 27, 2017 Feb 27, 2017

Copy link to clipboard

Copied

I have edited the CC 2017 version of this script to include a checkbox for enabling or disabling layer numering. It is disabled by default. I'm not sure about the legality of sharing this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 06, 2017 Jul 06, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 11, 2018 Jan 11, 2018

Copy link to clipboard

Copied

I  successfully have the number prefix to not show when exporting layers.

In my PS CC version this is line 2193.

Now what I'd like to do is have no filename prefix appear as an option for exporting. I know I could just delete the suggestion every time I export, but I'm incorporating the export as part of an Action and don't want to stop to play with the dialog box.

I've tried commenting out many things but nothing seems to do the trick.

Any suggestions?

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 11, 2018 Jan 11, 2018

Copy link to clipboard

Copied

I'm not sure jnwbr, as I run into the same issue. I don't currently have a fix for this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 11, 2018 Jan 11, 2018

Copy link to clipboard

Copied

Probably I can help though I use CS6 and never tried that script till now, but tell me exactly what you need as that doesn't is clear for me enough what you ask for.

When I started this script there was default "Untitled_" File Name Prefix in blank under the same name. I removed it and ran script. After reopening Ps it was still empty. Then I recorded action to play it and there was not prefix in file names. It could if I used it again. It seems it remembers last input. Describe more precisely how that looks for you so we should l find solution.

If not I found other script "Export Layers to Files (fast)" with some more options basing on original one: GitHub - jwa107/Photoshop-Export-Layers-to-Files-Fast: This script allows you to export your layers...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 11, 2018 Jan 11, 2018

Copy link to clipboard

Copied

The standard Export to Layers script dialog box has an area used to denote a naming prefix for the layers being exported. That box defaults to, and is based the current document name.

I want to not have that default to show, so the box is blank and the exported layers would not have the document name as a prefix.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 11, 2018 Jan 11, 2018

Copy link to clipboard

Copied

I can't find anywhere on web new Export Layers to Files.jsx script (that with over 2000 lines) to edit it that worked you like...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2018 Jan 11, 2018

Copy link to clipboard

Copied

Cs6 script is 1214 lines,  CC 2014 script is 1205 lines,  CC 2018 script is  2645 lines

It is also not the script they have. I have removed CC, CC 2015, CC 2015.5 and CC 2017.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

I also changed line 2195

From:

fileNameBody += "_" + layerName;

To:

fileNameBody += layerName;

Although a prefix name will appear in the export script dialog box, the resulting file does not contain the prefix name.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

I can not help without at least part of that script to do changes / it is not avialable on interweb. Only users of latest CC got it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 18, 2022 Nov 18, 2022

Copy link to clipboard

Copied

LATEST

thanks to you, i've solved this problem

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 13, 2018 May 13, 2018

Copy link to clipboard

Copied

Hey y'all, I tried to summarize it all real quick and clean so anyone can figure it out. You don't need any knowledge of coding. Also, If you type a Prefix in the dialogue in Photoshop, you get a prefix. If you don't type in anything there, you don't get a prefix. Some people have been disabling that prefix piece of the code, but I didn't. The goal is to get rid of the dumb numbers. This tutorial will do that for you.

Export_Layers_to_Files_1.jpgExport_Layers_to_Files_2.jpgExport_Layers_to_Files_3.jpgExport_Layers_to_Files_4.jpgExport_Layers_to_Files_5.jpgExport_Layers_to_Files_6.jpgExport_Layers_to_Files_7.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines