3

Classical situation: you're working in Photoshop on a PSD file and you want a to export it to PNG or JPG.

Here is the usual way: menu File > Save As > Click on Format > Find PNG in the list and select it > Save > PNG Interlace dialog > OK.

A little shorter is to use CTRL + SHIFT + S to do Save As.

Question: is there a way to do all of this in one or two keyboard shortcuts?

Example: CTRL+SHIFT+J: Export to JPEG, CTRL+SHIFT+P: Export to PNG

  • I've made myself a script that always saves a jpg and psd next to each other in the folder I choose.. I have the same script for illustrator, except it saves pdf and ai. Such a time saver. – Joonas May 30 '18 at 19:08
  • I'm actually angry that this has been a requested feature for 7 years (as far as I can see) and Adobe still have yet to do it. It's like they want customers to hate them. – Balls Jun 6 at 16:24
5

Open the actions window (Window → Actions or Alt+F9), then create and record and action.

Now just apply to it a hotkey (one of the function keys) Add it by going to action options.

You can record actions for each type of export you'd like.


It's worth it to note, that the action will always name the file the same thing (overwriting previous files) - which is very unfortunate and I haven't found any sources to allow for custom naming (or at least not overwriting)

Maybe one day Adobe will allow this.

Apparently, it does work in newer versions (tested)

I don't think so with older versions


See GIF below for how to create action:

gif showing action creation (click to enlarge)

Once completed you can just click the function key (F6 in my case) and it will perform all the actions that were pre-recorded.

  • Thank you. Hmm, if the file has always the same filename, then it won't be useful to save a few seconds on each export, sadly (because then one would have to rename manually) – Basj May 29 '18 at 15:31
  • I just tested, it didn't replace the file name. – WELZ May 29 '18 at 15:35
  • that's cool! Is it possible to save this action script/macro in a few lines of code? If so, could you post these lines of code in your answer? – Basj May 29 '18 at 15:54
  • 1
    Hey, it's actually very easy to use, I will try to upload a screen recording soon (it isn't code, you merely record what you do and it will repeat it) – WELZ May 29 '18 at 16:13
  • 1
    Just a little tip for following long gifs. There's a Chrome extensions that gives you playback controls for gifs – Joonas May 30 '18 at 19:12
0

This doesn't fully answer the question, but you wanted me to post this, so here we are.


So I have this script that I use to easily save the work file with the production file in Photoshop and Illustrator.

enter image description here

SaveTo.jsx - Gist link to the script

  • I also added the code to the bottom of this post.

Tip: When you simply want to save the files without changing the filename or filepath, you can just trigger the script and then press enter once for each dialog (2x).

How to install the script/set the shortcut:

It got a bit ranty after the first bullet point so if you only want to run the script not worry about details... maybe don't continue reading past that.

  • You can put the script in the "Photoshop/Scripts" folder and it will appear in the top menu File > Scripts > SaveTo after a restart. You can then give it a shortcut in Edit > Keyboard shortcuts...

  • You can also use a 3rd party app to set a shortcut for the script. You can read more here.

    • Some benefits to this method:
    • I use Alfred on mac, which can sync the shortcuts (workflows) using Dropbox... so I can access the script on multiple computers and if I make changes on one computer they sync to any other computer I use.
      • I guess on Windows you could put the .ahk file in the Dropbox folder and create a symbolic link (shortcut) from that file to the startup folder and it would do the same thing.
    • I can just set one global shortcut and the script will open up in either app. Though I should mention that you may need to set some restrictions in the app that triggers the script, like "only open this if PS or AI is active".
    • So essentially when I go to a new computer, all I need is Dropbox and Alfred and I can start using the same old shortcuts. Super handy.
      • I don't use the PS/scripts folder anymore because it's just a hindrance. For example on mac at least if you update to a new CC version, it may install it in a different folder and so the old scripts will stay in the old scripts folder and you have to go and move them to the new folder. Or if I have to reinstall PS or format the computer I don't have to worry about moving the scripts to a safe place and then redo all the shortcuts because they come from a third party app through Dropbox.

SaveTo.jsx:

// https://gist.github.com/joonaspaakko/b878d993b038b98b8ca78cc859916af4

// The idea is that it exports the work file and the production file at the same time saving some time and effort.

// - This has been tested in Photoshop and Illustrator CC. It used to work in CS3, but I'm fairly sure I've changed the code enough at this point to break it for older versions.
// - Has a simple dialog where you can rename the file or leave it as it is.
// - If document has been saved the script will suggest saving in the same path, otherwise it will default to what's set in the variable "newDocPath".
// - Photoshop saves .jpg and .psd
// - Illustrator saves .pdf and .ai

// ***** SaveTo.jsx Version 1.1. *****

/*

    Changelog:

    v.1.1.
        - Fixed a weird issue where saving as jpg causes weird dialog stuff to happen if it's not saved as a copy. This started happening somewhere between PS CC 2017 and PS CC 2018.
        - Variable "pdfProfileAI" now has a failsafe where if the set profile doesn't exist, the first found profile is used instead. So what ever happens the pdf will be saved, but it might be using a wrong profile, but don't worry, the script will tell you if this happened and gives the name of the profile that was used. This failsafe would still fail if someone doesn't have any presets at all, but if that ever happens, he had it coming...
        - Added a new variable "listOfPresetsAI" so that you can easily get a list of preset so you can copy and paste the preset name to "pdfProfileAI";

*/

var newDocPath = "~/Desktop/";
var listOfPresetsAI = false; // When set to true the script won't save anything but instead gives you a list of pdf preset names.
var pdfProfileAI = "CMYK - Swop v2s";
var dialogOffsetX = 250; // Subtracts from the center of the screen = Center of the screen horizontally - 250px.
var dialogOffsetY = 200; // Just a static value = 200px from the top of the screen.

var o = {};
var appName = app.name;
var pdfPresetNoMatch = false;

// If Photoshop
if ( appName === "Adobe Photoshop" ) {
    o.dialogTitle = "Save As: .psd and .jpg";
    o.formats = ['jpg','psd'];
    o.app = 'ps';
}
// If Illustrator
else if ( appName === "Adobe Illustrator" ) {
    o.dialogTitle = "Save As: .ai and .pdf";
    o.formats = ['pdf','ai'];
    o.app = 'ai';
}

function dialog() {

    // Dialog
    var dlg = new Window("dialog");
    dlg.text = o.dialogTitle;

    var panel = dlg.add('panel');
    panel.alignChildren = ['left','center'];
    panel.orientation = 'row';

    var text1 = panel.add('statictext');
    text1.text = 'Filename: ';

    var text2 = panel.add('editText');
    text2.text = app.activeDocument.name.split('.')[0];
    text2.preferredSize = [530,23];
    text2.active = true;

    var button1 = panel.add('button', undefined, undefined, { name: 'cancel'});
    button1.text = "Cancel";

    var button2 = panel.add('button', undefined, undefined, { name: 'ok'});
    button2.text = "Save...";

    button2.onClick = function ( e ) {
        save.init( dlg, text2.text );
    };

    dlg.onShow = function () {
        dlg.location.x = dlg.location.x - dialogOffsetX;
        dlg.location.y = dialogOffsetY;
    }

    dlg.show();

}

var save = {
    init: function( dlg, dialog_filename ) {

        dlg.close();

        var doc = app.activeDocument;

        var doc_path;
        try {
            doc_path = doc.path.toString();
        } catch(e) {
            doc_path = newDocPath;
        }

        var output_folder = Folder.selectDialog( 'Output folder', doc_path === "" ? newDocPath : doc_path );

        if ( output_folder != null ) {
            for ( var i = 0; i < o.formats.length; i++ ) {
                var save_options = save[ o.formats[i] ]();

                if ( o.app === 'ps' ) {
                    doc.saveAs( new File( output_folder + '/' + dialog_filename ), save_options, ( o.formats[i] === 'jpg' ? true : false ), Extension.LOWERCASE );
                }
                else if ( o.app === 'ai' ) {
                    doc.saveAs( new File( output_folder + '/' + dialog_filename ), save_options );
                }
            }
        }

    },
    ai: function() {

        var ai_options = new IllustratorSaveOptions();
        ai_options.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
        return ai_options;

    },
    pdf: function() {

        var pdf_Options = new PDFSaveOptions();
        pdf_Options.pDFPreset = checkPresets( false, pdfProfileAI );
        return pdf_Options;

    },
    psd: function() {

        var psd_Options = new PhotoshopSaveOptions();
        return psd_Options;

    },
    jpg: function() {

        var jpg_Options = new JPEGSaveOptions();
        jpg_Options.embedColorProfile = true;
        jpg_Options.FormatOptions = FormatOptions.OPTIMIZEDBASELINE; // OPTIMIZEDBASELINE, PROGRESSIVE, STANDARDBASELINE
        // jpg_Options.scans = 5; // For FormatOptions.PROGRESSIVE
        jpg_Options.matte = MatteType.WHITE; // BACKGROUND, BLACK, FOREGROUND, NETSCAPE, NONE, SEMIGRAY, WHITE
        jpg_Options.quality = 11; // 0-12
        return jpg_Options;

    }
};

function checkPresets( list, testPreset ) {

    var pdfPresets = app.PDFPresetsList;

    if ( list === true ) {
        alert( "\n" + pdfPresets.join('\n') );
    }
    else {
        var preset = null;
        for ( var i = pdfPresets.length; i--; ) {
            if ( pdfPresets[i] === testPreset ) {
                preset = testPreset;
            }
        }
        pdfPresetNoMatch = (preset === null);
        return (pdfPresetNoMatch ? pdfPresets[0] : preset);
    }

}

if ( listOfPresetsAI === true ) {
    checkPresets( true );
}
else if ( app.documents.length > 0 ) {

    dialog();
    if ( pdfPresetNoMatch ) alert( "Couldn't use your PDF preset!!! \n Used " + app.PDFPresetsList[0] + " instead." );

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.