Copy link to clipboard
Copied
hi, I have a psb multilevel. with ctrl + shift + s i can save a jpg file. the question: what is the authomatic command for save and rename each jpg as a series for example 1.jpg 2.jpg etc? thanks
Copy link to clipboard
Copied
The closest thing that I can think of is a script to save incremented versions suffixes.
Original File.psb
Original File_001.jpg
Original File_002.jpg
etc.
/* Start Open/Saved Document Error Check - Part A: Try */
savedDoc();
function savedDoc() {
try {
app.activeDocument.path;
/* Finish Open/Saved Document Error Check - Part A: Try */
/* Main Code Start */
// https://forums.adobe.com/message/4453915#4453915
main();
function main(){
if(!documents.length) return;
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var savePath = activeDocument.path;
var fileList= savePath.getFiles(Name +"*.jpg").sort().reverse();
var Suffix = 0;
if(fileList.length){
Suffix = Number(fileList[0].name.replace(/\.[^\.]+$/, '').match(/\d+$/));
}
Suffix = zeroPad(Suffix + 1, 3);
var saveFile = File(savePath + "/" + Name + "_" + Suffix + ".jpg");
SaveJPEG(saveFile, 12);
}
function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
}
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
}
/* Main Code Finish */
}
/* Start Open/Saved Document Error Check - Part B: Catch */
catch (err) {
alert("An image must be open and saved before running this script!");
}
}
/* Finish Open/Saved Document Error Check - Part B: Catch */
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
Previous post removed, I found an issue with the code...
Copy link to clipboard
Copied
Yeah was not very clear he means only numbers, otherwise its a little problem. No its either number or name + number
Copy link to clipboard
Copied
Copy link to clipboard
Copied
OK then, my previous post shows how to modify the code to remove the original filename and replace with only the incremented numbers. I'd strongly recommend that the zero-padding is left in there, but again this can be changed if desired.
Copy link to clipboard
Copied
thank so much Stephen! but I don't have any experience in the Ps scripts. how can I proceed? I'm afraid to create a desaster... best
Copy link to clipboard
Copied
In the first script code that I posted, there is a link to my blog explaining how to copy the code to create and install the script.
In the second post, I showed how you can change the line that includes the filename to one that does not include the filename.
Start there. It is not that hard and you can't break Photoshop.
Copy link to clipboard
Copied
unfortunately it doesn't work. maybe I'm wrong something....
ā
Copy link to clipboard
Copied
Looking at the screenshot, could it be possible that when you copied and pasted the text that the line breaks were lost? Is that a single line of text, wrapping to the window width?
There should be 45 separate lines of code.
Copy link to clipboard
Copied
I just worked out what you must have done, DON'T copy the text from the email notification sent from Adobe, copy and paste the text from the web page.
Copy link to clipboard
Copied
kind Marsh, thank you and sorry for my difficulties. I didn't understand which web page you recommend ... (the link you gave me in the first posts doesn't have this code) and then I don't know where to copy the code. I made a file by copying the script on microsoft notepad and then I uploaded this file to the folder you indicated but maybe it's not enough ... then I didn't understand how to create a command that performs the serial save. as I told you I have a psb with many levels. what i need is to save the combination of different layers in a jpg file. of course the combination of the levels is done by hand every time what takes time is to do ctrl + shif + s then rename the file with 1,2,3,4 etc ... select in the drop down format "jpeg" to not save it in psd of course. I was wondering if it was possible to automate ctrl + shift + s save as 1.jpg; 2.jpg; 3.jpg etc... THANK!!!
Copy link to clipboard
Copied
It is up to you on how you manually turn on/off the various layers.
All ths script does is create incremented JPEG versions of the current layer visibility when you run the script. If you install the script and assign a keyboard shortcut, then it is very fast to save out incremented numbered versions.
Somebody else can perhaps help in modifying the code, I am having problems when changing it from:
Original File_001.jpg
Original File_002.jpg
etc.
to:
001.jpg
002.jpg
etc.
Currently, it will take a Batch Rename of the output files to remove the original filename and underscore before the digits.
Copy link to clipboard
Copied
Another option ā You could explore using Layer Comps and the Layer Comps to Files script.
Copy link to clipboard
Copied
like @Stephen Marsh said, i think you would be better of with the layercomps to files script which comes with photoshop. That if you know how to use layer comps.
Layercomps is very powerful if you understand its usage. Ive been using this for ages, cant even remember when it was added.
Basically its very useful when doing different design in a single file. Im a graphic designer and i use for when i design poster/ flyers or anything when i need different layout or when im concepting. It usage takes some understanding of the concept. But once you got its super useful. Especially since other app from the Adobe suite understand the concept. That why you can use a single PSD file in say Indesign but have like 10 different designs. https://helpx.adobe.com/photoshop/using/layer-comps.html
I uploaded my altered version of Stephen base file. This file needs to go in PhotoshopVersionFolder > Presets > Scripts. It will then show in the export menu under file as "Quick Export as JPG Incremental".
Ive expanded the quality options as well as being able to save with or without the filename. You do need to open this in a text-editor and make sure to save it as .jsx or later change that in your File Explorer or Finder, depends on the OS.
When you open it you can change these 3 options. First 2 are self-explanatory, the last is for Progressive, Optimized Baseline or Standard Baseline. Ive added it to the Export menu so you can either find it quicker or you can add a shortcut to it.
PS i just noticed the quality was still at 1, thats really low and bad. The uploaded version has 10
var useFileName = false; // true - false
var jpegQuality = 1; // 1-12
var formatOption = 8; // 1-3
Preview script in export menu
http://www.filedropper.com/quick-export-as-jpg-incremental_1
Copy link to clipboard
Copied
I just noticed mine needs more work. When switched to numbers only, it doesnt check the folder properly for numbered files. Ill check what i can do to fix that.
EDIT
Okay got it working again. Now it does work using both methods. So now you can use either doc name_numbers (3) or numbers(3)
http://www.filedropper.com/quick-export-as-jpg-incremental_2
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Sorry to bother again, i tested today on OSX and some issues arose. I got that working but coming home, then on Windows issues arose. The issue was that when using the named version it would not add numbers properly. Also when the file already ended with numbers it would cause issues. I think it works now.
http://www.filedropper.com/quick-export-as-jpg-incremental_3
For me on Windows 10, when i use document name + incremental it works, but also when using incremental only it works. Ill test it Monday again on OSX.
Example of working numerical
Copy link to clipboard
Copied
Though i think ill change the underscore to dash. When using a regular dash you can still use shortcuts to jump around while editing the name. An underscore doesnt recognise that.
For example your editing the name and use ALT + arrow key L or R to jump sections in the name. I use this all the time when editing test, it allows for much faster renaming and editing.
However, i see on windows when it sorts, it seems to be sorting different as what i would expect. When a file name has -001 it still uses original name as the first and thus over-writing the first 001.
Copy link to clipboard
Copied
Great job, I tested on the Mac and it seems to work fine!
Copy link to clipboard
Copied
ive run into new issues... story continues š the life of a coderin progress š
My new discoveries is that when you use say document name with numbers in it, it causes errors. I tend to use dates at the end of a file name, this seems to cause issues with the incremental numbering. Then also the issue is that OSX and Windows seem to act different on the code. Its like playing tennis, one time i got OSX working and Windows not, the other time its swapped.
Ill try to see if i can get this to work.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now