Script to 'save as' a .psb to desktop with activeDocument name + "EmergencySave" as file name
Hello,
I've got the below script, that I generated through the script listner plugin, that currently saves the open file to my desktop with that open file's specific name. I need the script, when saving, to name the saved file with the activeDocmuent.name + "_EmergencySave" for any file thats open, so that evry different named file that I open and run this script on, it will adopt the open documents name and add the characters "_EmergencySave" on to the end of the file name and save it as a large document format .psb. Thank you,
-M
script:
// =======================================================
var idsave = charIDToTypeID( "save" );
var desc93 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
var desc94 = new ActionDescriptor();
var idmaximizeCompatibility = stringIDToTypeID( "maximizeCompatibility" );
desc94.putBoolean( idmaximizeCompatibility, true );
var idPhteight = charIDToTypeID( "Pht8" );
desc93.putObject( idAs, idPhteight, desc94 );
var idIn = charIDToTypeID( "In " );
desc93.putPath( idIn, new File( "~/Desktop/test.psb" ) );
var idDocI = charIDToTypeID( "DocI" );
desc93.putInteger( idDocI, 198 );
var idLwCs = charIDToTypeID( "LwCs" );
desc93.putBoolean( idLwCs, true );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveBegin = stringIDToTypeID( "saveBegin" );
desc93.putEnumerated( idsaveStage, idsaveStageType, idsaveBegin );
executeAction( idsave, desc93, DialogModes.NO );
// =======================================================
var idsave = charIDToTypeID( "save" );
var desc95 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
var desc96 = new ActionDescriptor();
var idmaximizeCompatibility = stringIDToTypeID( "maximizeCompatibility" );
desc96.putBoolean( idmaximizeCompatibility, true );
var idPhteight = charIDToTypeID( "Pht8" );
desc95.putObject( idAs, idPhteight, desc96 );
var idIn = charIDToTypeID( "In " );
desc95.putPath( idIn, new File( "~/Desktop/test.psb" ) );
var idDocI = charIDToTypeID( "DocI" );
desc95.putInteger( idDocI, 198 );
var idLwCs = charIDToTypeID( "LwCs" );
desc95.putBoolean( idLwCs, true );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
desc95.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
executeAction( idsave, desc95, DialogModes.NO );
