• 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 ,
Dec 24, 2019 Dec 24, 2019

Copy link to clipboard

Copied

I stumbled across these answers so sorry for a reply that is quite a bit after the question, but if you comment out the line then you cant easily add sequential numbers at a later date, so instead of commenting out the lines, I modified the code so the popup dialog box asks you if you want to include the sequential numbers or not.

I am using CS6, and as someone else pointed out, dont edit your script in the PS 32 bit folder and then run PS 64 bit as you wont see the changes (and visa versa).
If you are using PS 64 bit then the folder is
C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts

You might want to make a safe copy of the script in case it all goes wrong, but here are the modifications I made to add a check box that asks if you want to include the sequential numbers or not.


Find Line 73, which reads:
var strCheckboxVisibleOnly = localize("$$$/JavaScripts/ExportLayersToFiles/VisibleOnly=&Visible Layers Only");


Copy and paste it below line 73, and then modify the copied line to read...
var strCheckboxNumberPrefix = localize("$$$/JavaScripts/ExportLayersToFiles/NumberPrefix=&Add Number Sequence after Prefix");

This adds the text to display when you run the script and the popup appears.


Go to line 295, which should read...
// -- the fifth line in the dialog
If the line above isnt exactly line 295 it could be because you added a blank line or something previously.


Copy and paste line 295 to 297 underneath itself.
Modify the newly copied code to read...
dlgMain.cbNumberPrefix = dlgMain.grpTopLeft.add("checkbox", undefined, strCheckboxNumberPrefix);
dlgMain.cbNumberPrefix.value = exportInfo.numberPrefix;

This adds a checkbox to the popup dialog box. Pay attention to capitals letters as "exportInfo.numberPrefix" is not the same as "exportInfo.NumberPrefix".


Go to line 594 which should read...
exportInfo.visibleOnly = dlgMain.cbVisible.value;


Copy and paste this line under itself, and then modify the new line to read...

exportInfo.numberPrefix = dlgMain.cbNumberPrefix.value;
This line add the tick in the dialog box to a variable.


Go to line 671 which reads...
exportInfo.visibleOnly = false;

Copy and paste this line below itself, and modify it to read...
exportInfo.numberPrefix = false;


Go to line 1036-1038 which reads...
var fileNameBody = fileNamePrefix;
fileNameBody += "_" + zeroSuppress(i, 4);
fileNameBody += "_" + layerName;


Modify to... (note 1st and last line unchanged, just included to help find where to edit)
var fileNameBody = fileNamePrefix;
if (exportInfo.numberPrefix==true) {
fileNameBody += zeroSuppress(i, 4) +"_";
}
fileNameBody += layerName;


This code says add the sequential number if the tick was in the dialog box, otherwise dont add it.

This should work.

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 23, 2021 Feb 23, 2021

Copy link to clipboard

Copied

Hi Jimmy_boy,

 

Is there a fix for Photoshop 2021?

 

Cheers

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