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

38.6K

Likes

translate

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.

Likes

translate

Translate

Translate
Guru ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

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.

Likes

translate

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 ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

Wow, great stuff. Thanks so much - this worked! Thanks Michael I {heart} you.

Also I was meant to tag this as 'correct answer', rather than just 'helpful'

Thanks again

Likes

translate

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 ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

Likes

translate

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
Guru ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

Removing the numbers or other changes to the way that script names files is a common request. Maybe one day Adobe add some naming options to the the script's dialog.

Likes

translate

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 14, 2013 Mar 14, 2013

Copy link to clipboard

Copied

Hi!

I know this thread is a couple years old, but I was hoping you could help me out. I did exactly as your instructions said, and went a step further to remove the "_" from in front of the file name. The code now reads:

  var fileNameBody = fileNamePrefix;

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

        //fileNameBody += "_" + layerName;

        fileNameBody += "" + layerName;

However, I'm still getting half of the string of numbers in front of the file name: "_0000slayername.png"

Where is that coming from?? I'm working in CS5.

Thank you in advance!

Likes

translate

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 ,
Apr 17, 2013 Apr 17, 2013

Copy link to clipboard

Copied

Hi there,

Just thought I'd complete this as I was looking for the answer and all the comments above helped me find it.

SarahAJS was very nearly there - no need for the final "". The code works like this:

var fileNameBody = fileNamePrefix;

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

        //fileNameBody += "_" + layerName;

        fileNameBody += layerName;

Hope it helps someone!

Likes

translate

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 ,
Apr 25, 2013 Apr 25, 2013

Copy link to clipboard

Copied

I was getting the same problem.

Comment out line 1049 (fileNameBody += "_" + zeroSuppress(i, 4) + "s";)

That should fix your problem.

Likes

translate

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 ,
Sep 11, 2015 Sep 11, 2015

Copy link to clipboard

Copied

hello sir,

Can you please help me to save  png save for web  names with sequential numbers as prefix or suffix, while in  batch automation process

is there any script?

Likes

translate

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
Adobe Community Professional ,
Sep 11, 2015 Sep 11, 2015

Copy link to clipboard

Copied

siddharthk61789754. I would suggest you post a new question to the scripting forum. Michael Hale has passed away.

Likes

translate

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
Most Valuable Participant ,
Aug 03, 2019 Aug 03, 2019

Copy link to clipboard

Copied

Rest in Peace Michael L Hale.

You were a greate help here..jj

JJMack

Likes

translate

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
Adobe Community Professional ,
Aug 04, 2019 Aug 04, 2019

Copy link to clipboard

Copied

Was August 3rd the day he passed away?

Likes

translate

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
Most Valuable Participant ,
Aug 04, 2019 Aug 04, 2019

Copy link to clipboard

Copied

JJMack

Likes

translate

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 ,
Jul 17, 2013 Jul 17, 2013

Copy link to clipboard

Copied

Hello everyone,

Anyone know why this script we're talking about replaces the layername's " " (spaces) with "-" when its exported to files ?

I was looking into the script but i can't find any part of the code to do that.. I would like to filename to come exactly as the layer is named, no changes..

anyone?

thanks in advance

Likes

translate

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
Guru ,
Jul 17, 2013 Jul 17, 2013

Copy link to clipboard

Copied

At a guess I would say that you are saving the files in the png format as that script uses SaveForWeb to export png8 or png24 files. All other formats are saved using the normal document.saveAs method.

If so you need to check your output settings under the fly-out menu in the saveForWeb dialog. Look under Saving Files and make sure Unix is not checked in the Filename Compatibility section. That is not something the script can control. With Unix checked SFW replaces spaces with the - char.

Likes

translate

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 ,
Jul 18, 2013 Jul 18, 2013

Copy link to clipboard

Copied

Ahh thank you.. That is helpful.. Will try it asap

Thanks

Likes

translate

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 ,
Jul 23, 2013 Jul 23, 2013

Copy link to clipboard

Copied

I am having the same issue but I am exporting to JPG. I set the quality to 12 & changed all the lines of code in the script editor & replaced the script in the adobe file. I have come to the conclusion I have no idea what i am doing: can someone please let me know what to do to get rid of the extra numbers & underscores that are not located in my original layer name? Im working with photoshop CC

Screen Shot 2013-07-23 at 5.41.02 PM.png

Likes

translate

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
Guru ,
Jul 23, 2013 Jul 23, 2013

Copy link to clipboard

Copied

See LCorn's post above about commenting out line 1049. That line is not commented out in your screenshot. But that should only apply to layers inside layerSets.

Likes

translate

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 ,
Jan 20, 2014 Jan 20, 2014

Copy link to clipboard

Copied

I wanted only the Layer name to show on the file Name to make it easy.

I took out the whole Prefix and just replaced "FileNamePrefix;" with "layerName;". Then commented out the other two lines with // (Double slashes)

var fileNameBody = layerName;

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

        //fileNameBody += "_" + layerName;

No more renaming for me, so much nicer. Remember to name your layers and remove any spaces between words for Web work.

Enjoy

- Kismet

Likes

translate

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 14, 2014 Aug 14, 2014

Copy link to clipboard

Copied

This is something that worked for me, running Photoshop CC 2014.

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

190     fileNameBody += "" + compRef.name;

I commented out one line 189 and deleted the underscore between the "" in line 190.

Likes

translate

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 ,
Sep 29, 2014 Sep 29, 2014

Copy link to clipboard

Copied

For PHOTOSHOP CC 2014 - September+

I took out the whole Prefix and just replaced "FileNamePrefix;" with "layerName;". Then commented out the other two lines with // (Double slashes)

      

1020        var fileNameBody = layerName;

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

1022        //fileNameBody += "_" + layerName;

Likes

translate

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 ,
Oct 31, 2014 Oct 31, 2014

Copy link to clipboard

Copied

GREAT! Thanks so much, I was really getting tired with removing all the prefix junk manually!

Likes

translate

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
Participant ,
Jun 05, 2015 Jun 05, 2015

Copy link to clipboard

Copied

Sorry to bug - but can someone please send me or copy/paste the full script? I can't seem to find the script anywhere...

Likes

translate

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
Adobe Community Professional ,
Jun 06, 2015 Jun 06, 2015

Copy link to clipboard

Copied

SteveDolanACE‌ That script should be included with every install of PS, and located in the Presets\Scripts folder.

Likes

translate

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 ,
Jun 24, 2015 Jun 24, 2015

Copy link to clipboard

Copied

Same problem, in Photoshop 2015 this fix doesn't work, any clues? Why to add this bothering number to layer comps?

Likes

translate

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