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
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.
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.
Copy link to clipboard
Copied
Hi Jimmy_boy,
Is there a fix for Photoshop 2021?
Cheers