One-click 'Save as jpeg' shortcut script please! - saved in the same folder
Copy link to clipboard
Copied
Hi, I've been re-directed here because I was told a script could solve my problems - but I have no scripting experience/knowledge/ability! Below is my original problem and post. I got as close as 2 button presses, but I'm after that sweet, sweet single-button, double-my-productivity shortcut! Thanks!
http://forums.adobe.com/thread/1106992
I use 'Save as .jpeg' ALL the time (Photoshop CS6, Mac ML), and it really feels like I should just be able to press one button (a shortcut) and the name/quality dialogs don't appear and it just saves a .jpeg into the folder that my original .PSD/file is in.
So basically:
- Press one button to save my open .PSD/file as a .jpeg
- Automatically save it in the same folder as my .PSD
- Save it as '10' quality in the jpeg settings
- No dialog boxes, as soon as I press the button, it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.
I've tried using 'Actions', but it seems to save it wherever my original Action folder was - it doesn't change to whatever the current folder the .PSD is in...
Thanks!
Adam
Explore related tutorials & articles
Copy link to clipboard
Copied
File -> Scripts -> Script Events Manager
Click Enable Events at the top
Select Save Document from Photoshop Event drop down
Select Save Extra JPEG from Script drop down
Click Add
Click Done
EVERY document you save, except JPEG files, will save a jpg file. Saving will be slower.
You will need to modify line 62 of the Save Extra JPEG.jsx file located here: <YOUR_PHOTOSHOP_INSTALL_LOCATION>\Presets\Scripts\Event Scripts Only
In order to boost your quality to '10'. Here is the line in question
jpegOptions.quality = 2; // really low
Change it to
jpegOptions.quality = 10; // really high
You will need to modify the script to get this problem solved as well: it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.
You can steal code out of Image Processor that finds a file name that is unique for the folder so you don't get overwrites.
Are you sure you want that? If you do lots of saves you are going to fill up your disk fast.
Copy link to clipboard
Copied
Thanks, it works but is there a way to make it selective? Like you said, if it saves EVERYTHING with a .jpeg my disk isn't going to last!
I tried adding an Action that turns on the 'script events manager', saves the file, then turns if off, so I could map it to a button and that would run. Problem is, the Action only brings up the 'script event manager', it doesn't tick the box and press 'Done' like when I recorded it...
Any ideas?
Thanks,
Adam
Copy link to clipboard
Copied
Copy this below and create a jsx file and save it in Presets/Scripts. Then put a keyboard modifier on it or record it in actions and put a keyboard shortcut on the action.
// toggle save extra jpeg on and off
// if i find it in the list i remove it
// if i didn't remove it i add it
if ( ! DidIRemoveIt() ) {
app.notifiers.add('save', new File(app.path + "/Presets/Scripts/Event Scripts Only/Save Extra JPEG.jsx" ) );
}
function DidIRemoveIt() {
var removedIt = false;
if (app.notifiers.length) {
var f = new File(app.path + "/Presets/Scripts/Event Scripts Only/Save Extra JPEG.jsx" );
for (var i = 0; i < app.notifiers.length && ! removedIt; i++) {
if (app.notifiers.event == 'save' &&
app.notifiers.eventFile.toString() == f.toString()) {
app.notifiers.remove();
removedIt = true;
}
}
}
return removedIt;
}
Copy link to clipboard
Copied
Thanks again, I saved it and left it in Presets/Scripts, but it won't show up when I go into File, Scripts, Browse.. in Photoshop - am I doing something wrong?
Thanks for your efforts so far! Adam
Copy link to clipboard
Copied
Did you save as *.jsx have you quit and re-launched PS…?
Copy link to clipboard
Copied
Yeah I tried both of those... I'll try it tomorrow after a restart and let you know
Copy link to clipboard
Copied
Hi, I managed to get it selected from File, Scripts, Browse.. but it doesn't seem to do anything when I select it! The Save Extra JPEG is working, any ideas?
Thanks,
Adam
Copy link to clipboard
Copied
Greetings,
A lot of people are having the same issue regarding the Save As command in Actions. However, the solution is simple and it requires no scripting.
Try this: Create a folder (eg. temp) in a removable media (usb flash drive) and use this folder (temp) when you record the "Save As" action. When you're done recording, eject that media.
The next time you play your action, Photoshop will take you to the same location as your opened file, since it cannot locate the previous destination (temp). It will however ask for a filename (identical to the opened one) so you can click OK, or hit Enter. Quite useful when you want to eg. save your opened raw files to JPG in the same folder.
Please notice that it is important that you DO create a folder in the removable media. If you go ahead without a folder, Photoshop (when you eject the media) will save to a hidden folder in System called Volumes (Mac OS), which is hidden by default.
I've tried it on a Mac, but I'm sure it works the same on Windows as well.
Hope this helped. Just remember NOT to insert that media when you playback your action in the future. Rename the media if necessary.
Copy link to clipboard
Copied
Thanks a lot, will try this!
Copy link to clipboard
Copied
I've just tried it, but it gives me an error - "Could not save as H:/folder/picture.jpg because the file could not be found"
Copy link to clipboard
Copied
This worked like a champ for me. Finally after years of abandoned efforts to find a solution to this. Thanks!
Tested half a dozen files from different directories just now and they all pointed back at their folder of origin correctly. Pretty lame that you have to half-hack/trick the action during recording, but at this point in trying to find a solution, I don't care. Wish I had known about this sooner. I'd wager that it would work on almost any iteration of PS.
FYI: It'll bring the dialogue to rename the file up no matter if you want it or not.
Mac OS X (Mavericks)
Photoshop CS6
Copy link to clipboard
Copied
This is a very useful workaround. My only question is how to prevent the "Save As" file name from having "Copy" appended to it?
Copy link to clipboard
Copied
rcraighead – When I tested the method outlined by DimPan, it did not produce the “ copy” suffix (probably because I didn’t have the copy box checked when recording):
That being said, I personally prefer the method offered by JJMack… DimPan’s trick is workable and creative, so kudos to both DimPan and JJMack!
Of course, it is best not to have this unwanted extra text being created in the first place, however it would be easy enough to batch rename using Bridge if one really had to in order to clean up:
All three variations (and more with other regular expressions) would remove the “ copy”, however the last option using the “(.*)\scopy(.*$)” regex find pattern would be the most robust method of the three as it would only remove the “ copy” text at the end of the filename (just in case “ copy” was valid elsewhere in the filename).
Copy link to clipboard
Copied
Stephen, thank you for your response. I'll give it a try.
Copy link to clipboard
Copied
Not a problem, the Image Processor Pro script mentioned by JJMack can be found here:
P.S. I fixed up the 3rd regex rename slightly too, just in case this helps somebody out in the future:
(^.*)\scopy(\..*$)
Copy link to clipboard
Copied
I have the same question but want to clarify: I'd like to record an action that performs the 'save for web' function and ends with an open dialog box asking you where you want to save the file. Can anyone give instructions to do that please? I've done it before a few years ago and it wasn't that hard but tried again and can't get it to work. thank you.
Copy link to clipboard
Copied
I think you want toggle "ON" the dialog option.
Copy link to clipboard
Copied
Thanks rcraighead that did help the action run (and I had no idea I needed to pay attention to that tiny box!) I also found this solution that works well too:
I just had to go in and change the export preferences from png to jpg. And the export preferences is in the same drop down under File. thanks again for your help.
Copy link to clipboard
Copied
Thank you! it's very useful for me, Gods bless you , old and new ))

Copy link to clipboard
Copied
Try this!!!
Edit > Preference > Export...
then
It would show this option: "Quick Export Format"
then choose particular format you want to be save, let's say "JPG" then choose the quality like "90%"
and then hit 'Okay'
Now you have a shortcuts to save as jpg all the time by pressing...
File > Export > Quick Export as 'JPG'
*this can be called shortcuts right??? I guess?
but it's faster and easy than choosing format every time when you save. or making those ugly and seems difficult script.
Hope it helps!
Copy link to clipboard
Copied
Hi Adam,
The next code work as described under PS CS6 Win 10
It duplicates the flattend file instead of saveAs. When layers are active Saveas to JPG will not work.
create an action with a keyboard shortcut onto this script.
--- copy below and paste in a jsx file --
var sAlertDocumentNotOpen = "No open document !";
var jpgQuality = 10;
main();
function main() {
if ( app.documents.length <= 0 ) {
alert( sAlertDocumentNotOpen );
return 'cancel'; // quit, returning 'cancel' (dont localize)
}
var fileName = app.activeDocument.fullName.toString().slice( 0, -4 ); // copy the name of the document without the extension ( .psd assumed )
var jpgDoc = app.activeDocument.duplicate( "JPGFILE", true ); // duplicate with merged layers
fileName = getNewFileName( fileName );
saveFile( jpgDoc, fileName );
return true;
}
function saveFile( docRef, fileName ) {
docRef.bitsPerChannel = BitsPerChannelType.EIGHT;
var saveFile = new File( fileName );
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.quality = jpgQuality;
docRef.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
docRef.close( SaveOptions.DONOTSAVECHANGES );
return true;
}
function pad(num, size) {
var s = "000" + num;
return s.substr(s.length-size);
}
function getNewFileName( fileName ) {
var num = 1;
fileName = fileName + "-";
while ( File( fileName + pad(num,4) + ".jpg" ).exists ) {
num = num +1;
}
return fileName + pad(num,4) + ".jpg";
}
// best regards: Willem
Copy link to clipboard
Copied
If you do not want to overwrite saved JPEG files with a file open you can record a single step action that uses the Image Processor Pro plug-in Menu File>Automate>Image Processor Pro.... Fill the dialog like this. The Plug-in will record those setting into the action's step. Assign a Shortcut to the action. When you use the shortcut the action will save a jpeg with a unique filename it will add a serial number to the current document name and save that unique jpeg there will be no dialog display the next jpeg image for the document will be saved into the current document folder you can continue editing your open layer document.
exactly what the OP asked for it is easy with Image processor pro thanks to X
Copy link to clipboard
Copied
Thank you so much!! Your answer in combo with DimPan's saved me tons of time and effort!
If anyone needs the script, go here:
Just make sure to copy the file to your version of photoshop's folder in (Windows) C:\Program Files\Adobe\Adobe Photoshop (version here)\Presets\Scripts
Yes, it works even on photoshop 2020.
Copy link to clipboard
Copied
That an old versopn of Image Proessor Pro.... version 3.2b5 is the latest one Image Processor Pro


-
- 1
- 2