• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Incremental quicksave action

Community Beginner ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

Hi there!

I am creating an action that has 3 basic functions;

  1. Save file with incremental number (ex: figuredrawing001.png)
  2. Close the file (without "are you sure" warning)
  3. Create new document figuredrawing

This is what I have so far

action.png

I am creating this to quickly save 30 second figure drawings and refresh my canvas.

I found an ancient script online that did roughly this but for some reason it would stop without error (or notifying me) at 008 for no apparent reason and came with a whole host of other issues. (Like when I tried it after closing photoshop it started overwriting 001 again for instance)

Is there a way to set this up quickly under a hotkey? For reference this is the script that I was working with.

// This script will save the active document to a folder with an incremental sufix
// Change the options below to match your needs
var saveFolder = new Folder( 'E:/Specialization/30seconddrawing' ); //don't put the ending "/" this is for mac folders windows is /c/foldername
var saveSufixStart = '_';
var saveSufixLength = 3;
saveOptions = new PNGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 8;
// End of user options
//==========================================
var saveExt = 'png';
function zeroPad ( num, digit ){
   var tmp = num.toString();
   while (tmp.length < digit) { tmp = "0" + tmp;}
   return tmp;
}
var docName = decodeURI ( activeDocument.name );
docName = docName.match( /(.*)(\.[^\.]+)/ ) ? docName = docName.match( /(.*)(\.[^\.]+)/ ) : docName = [ docName, docName, undefined ];
var saveName = docName[ 1 ]; // activeDocument name with out ext
var files = saveFolder.getFiles( saveName + '*.' + saveExt );// get an array of files matching doc name prefix
if( files.length == 0 ) {  // no file with that name so start at one
   var saveNumber = 1;
}
if( files.length == 1 ) { // one file found, see if it has a sufix
   var fileName = decodeURI ( files[ 0 ].name );
   fileName = fileName.match( /(.*)(\.[^\.]+)/ ) ? fileName = fileName.match( /(.*)(\.[^\.]+)/ ) : fileName = [ fileName, fileName, undefined ];
   if( fileName[1].match( /_(\d{3})$/ ) == null ){
      var saveNumber = 1;// does not have sufix so set to one
   } else{// has sufix
      var saveNumber = parseInt( fileName[ 1 ].match( /_(\d{3})$/ )[1] ) + 1; // strip the ext and get the sufix , convert to number and add 1
   }
}
if( files.length > 1 ){
   files.sort();
   var fileName = decodeURI ( files[ files.length -1 ].name );
   fileName = fileName.match( /(.*)(\.[^\.]+)/ ) ? fileName = fileName.match( /(.*)(\.[^\.]+)/ ) : fileName = [ fileName, fileName, undefined ];
   var saveNumber = parseInt( fileName[ 1 ].match( /_(\d{3})$/ )[1] ) + 1; // strip the ext and get the sufix , convert to number and add 1
}
var saveFile = new File( saveFolder + '/' + saveName + '_' + zeroPad( saveNumber, saveSufixLength ) + '.' + saveExt );
activeDocument.saveAs( saveFile, saveOptions ,true ,Extension.LOWERCASE);

Views

458

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

You may want to post over at

Photoshop Scripting

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

I'll crosspost over there as well. I was hoping there would be an easier way using actions or droplets.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

LATEST

Actions are more limited and evaluating filenames and creating new, numbered ones is so far beyond their capabilities.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines