File backups for Photoshop

I’ve been working with Photoshop for a long time, and every once in a while I work on a file, sometimes in a rush, sometimes just being lazy.. what happens is that I end up ruining it.

I save, go on with my day, and then I open it later only to realize/remember that a previous version was better, only if I would of saved it in multiple versions as I usually do.. but sometimes it happens and I DON’T.

Do you know of a plugin or an add-on or something that does this, is there some option somewhere in Photoshop that I don’t know about ?
I saw some new features about Recovery Information Under Preferences > File Handling but I find no use for it.. I want something that prevents me from overwriting, or rather it doesn’t even prevent me, it just saves a different file with an incremental number at the end.

(What I need is something that won’t let me overwrite a file when saving, but rather create another file with the exact same name and a number at the end. Something like Save as but not Saves As and not me writing a different file name every time. I wan’t it as part of my normal routine, to be safe and never sorry that I lost something I spen hours working on and ruined it in a few minutes, then saved the turd and wonder at it later.)

For example, when I use the default Ctrl + S (Save) multiple times, I want it to automatically do:

  • ThisPsdFile-1.psd
  • ThisPsdFile-2.psd
  • ThisPsdFile-3.psd

[Please restrain from comments like: “you are too lazy, blabla..” it just happens sometimes, and I want this error solved forever… something I install once and boom, that’s about it.

Thank you for your time.

Answer

Ok. I should have known that I’d never be able to leave as it was. New stuff!

I ended up making a repo in github because there’s still room for improvements.

You can download the file in here: Auto Save PSD in github »

enter image description here

It’s now slightly easier to install, and the additional .psd file is saved only when you wish to do so.


Install

  • Download the files: Auto Save PSD.jsx and Auto Save PSD.atn
    Auto Save PSD.jsx: Put this file in {Photoshop_root}\Presets\Scripts\Auto Save PSD.jsx

    • Next time you open photoshop you will find the script in: File > Scripts > Auto Save PSD. If photoshop is already running, restart it.
  • Auto Save PSD.atn: Double click this file so that it is added to photoshop.

    • You can make sure that it was added by going to: Window > Actions and
      making sure that you an find Auto Save PSD folder at the bottom of
      your Actions panel.
  • Add a shortcut in photoshop:

    • Edit > Keyboard shortcuts... ( Mac: Alt + Shift + Cmd + K. Windows: Alt + Shift + Ctrl + K )
    • Choose Shortcuts for: [Applications menus]
    • File > Scripts > Auto Save PSD. ( After opening File you need to scroll down quite a bit to find Scripts ) enter image description here
  • Install complete

Usage:

Each time you feel like saving additional file, press the shortcut you gave to the script.

A new file will be saved in a folder next to the original one.



In such case where the github page is down

The action required is easy to set up:

  • Open a new document
  • Save it once as .psd
  • Make changes in it
  • Make a new folder for Actions. Name it: Auto Save PSD
  • Start recording new action inside that folder. Name it save
    • Press hotkey for save. Mac: Cmd + S. Windows: Ctrl + S.
  • Stop recording action.

Copy this and make it into a file Auto Save PSD.jsx:

    // (c) Copyright 2005.  Adobe Systems, Incorporated.  All rights reserved.

// Auto Save PSD.jsx 1.3.
// This file was modified out of "Save Extra JPEG.jsx".
// Modifications by Joonas Pääkkö
// https://github.com/joonaspaakko

/*

    <javascriptresource>
    <name>$$$/JavaScripts/AutoSavePSD/Menu=Auto Save PSD</name>
    <category>Auto Save</category>
    <enableinfo>true</enableinfo>
    <eventid>64feff0a-8271-436f-8c59-d2105497d902</eventid>
    </javascriptresource>

*/

// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop

// on localized builds we pull the $$$/Strings from a .dat file, see documentation for more details
$.localize = true;

try {

    // Get the currently active document.
    var doc = app.activeDocument;

    // If document has been saved once...
    if ( doc.saved ) {
        // One document save is needed so that we know where to save the psd.
        doc.save();
    }
    // Document has not been saved yet...
    else {

        // An action is triggered to prompt save as dialog.
        // You'd think that this would be easy to do, but I
        // couldn't figure out a better way for doing this.
        app.doAction('save','Auto Save PSD');

    }

    // Save additional psd file...
    var data = GetDataFromDocument( doc );
    AutoSavePSD( doc, data );



} // try end

catch( e ) {
    // always wrap your script with try/catch blocks so you don't stop production
    // remove comments below to see error for debugging
    // alert( e );
}


///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
// Function: AutoSavePSD
// Use: save the current document as a copy
// Input: a document must be active
// Params: folder, filename, extension
// Output: file saved as a copy next to the current active document
///////////////////////////////////////////////////////////////////////////////
function AutoSavePSD( doc, data ) {


        // Save as .psd
        var psd_Opt = new PhotoshopSaveOptions();
        psd_Opt.layers = true; // Preserve layers.
        psd_Opt.embedColorProfile = true; // Preserve color profile.
        psd_Opt.annotations = true; // Preserve annonations.
        psd_Opt.alphaChannels = true; // Preserve alpha channels.

         // Excuse me sir. What time is it? ...where am I?
        var time                      = new Date();
        var seconds                   = time.getSeconds();
        var sec                       = seconds < 10 ? '0' + seconds : seconds;
        var minutes                   = time.getMinutes();
        var min                       = minutes < 10 ? '0' + minutes : minutes;
        var hours                     = time.getHours();
        var hour                      = hours < 10 ? '0' + hours : hours;
        var day                       = time.getDate();
        var dd                        = day < 10 ? '0' + day : day;
        var month                     = time.getMonth() + 1;
        var mm                        = month < 10 ? '0' + month : month;
        var yyyy                      = time.getFullYear();
        var date                      =  yyyy + '-' + mm + '-' + dd + '-' + hour + '-' + min + '-' + sec;

        // New folder for the auto saves...
        var fileName                  = data.fileName;
        var folderPath                = data.folder + '/' + fileName + ' (-autoSave-)/';
        var asFolder                  = new Folder( folderPath );

        // If folder doesn't exist, let's create one.
        if( !asFolder.exists ) asFolder.create();

        // Creates the additional .psd file.
        doc.saveAs( File( folderPath + fileName + ' ' + date + '.psd' ), psd_Opt, true );
}

///////////////////////////////////////////////////////////////////////////////
// Function: GetDataFromDocument
// Usage: pull data about the document passed in
// Input: document to gather data
// Output: Object containing folder, fileName, fileType, extension
///////////////////////////////////////////////////////////////////////////////
function GetDataFromDocument( inDocument ) {

    var data           = new Object();
    var fullPathStr    = inDocument.fullName.toString();
    var lastDot        = fullPathStr.lastIndexOf( "." );
    var fileNameNoPath = fullPathStr.substr( 0, lastDot );
    var lastSlash      = fullPathStr.lastIndexOf( "/" );

    data.extension     = fullPathStr.substr( lastDot + 1, fullPathStr.length );
    data.fileName      = fileNameNoPath.substr( lastSlash + 1, fileNameNoPath.length );
    data.folder        = fileNameNoPath.substr( 0, lastSlash );
    data.fileType      = inDocument.fullName.type;

    return data;

}

Attribution
Source : Link , Question Author : Flavius Frantz , Answer Author : Joonas

Leave a Comment