
Hey there graphic designer. Do you ever use Photoshop’s “Layer Comps to Files” feature? If so you may find it annoying that it automatically adds numbers before your filename — not a big deal for 10 files but for those cases where you’re batch creating a large number of files it’s tedious to have to rename each one. Want to save yourself the hassle? Luckily there’s a fix that removes the file numbering, and all you need is a text editor.
Here’s what to do:
- Browse your hard drive for “Layer Comps To Files.jsx” — it should be in your Adobe/Presets folder. For me running CS5 on a Mac it was located here: /Applications/Adobe Photoshop CS5/Presets/Scripts/
- Open the file “Layer Comps To Files.jsx” in a text editor (I used Text Edit). Unless you understand java code it probably won’t make much sense. Don’t panic.
- Scroll down until you find the following block of code:
var fileNameBody = exportInfo.fileNamePrefix;
fileNameBody += "_" + zeroSuppress(compsIndex, 4);
fileNameBody += "_" + compRef.name;
if (null != compRef.comment) fileNameBody += "_" + compRef.comment;
fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|\\\r\\\n]/g, "_"); // '/\:*?"<>|\r\n' -> '_'
if (fileNameBody.length > 120) fileNameBody = fileNameBody.substring(0,120); - Replace it with this block instead:
var fileNameBody = exportInfo.fileNamePrefix;
fileNameBody += "_" + compRef.name;
if (null != compRef.comment) fileNameBody += "_" + compRef.comment;
fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|\\\r\\\n]/g, "_"); // '/\:*?"<>|\r\n' -> '_'
if (fileNameBody.length > 120) fileNameBody = fileNameBody.substring(0,120); - Save the file and be careful to keep the “.jsx” extension.
- Restart Photoshop and try out your new and improved Layer Comps to Files!