Seeking new script based on features of existing script

Upload Photoshop Scripts, download Photoshop Scripts, Discussion and Support of Photoshop Scripts

Moderators: Tom, Kukurykus

bacton

Seeking new script based on features of existing script

Post by bacton »

I am using PS CC.

The source files that I work with are typically raw (DNG) files and my process will involve all the normal features and elements one uses in Photoshop.

1) EXISTING SCRIPT: When I arrive at the point that I've completed my edits and adjustments, I have an amazing script that prepares everything to be saved as a JPG file and then does the actual SAVE command assigning a filename the same as the original, with my specified modifications and placing the new JPG file in the same folder as the original file. For example, the script does the following:
- flatten the image
- convert from 16-bit to 8-bit
- SAVE as JPG with specified quality rating and using the same filename as the original file; and finally
- closes the file.
I have the script assigned to a hot key so I need only press a single key on the keyboard and all of the above is completed in 2-3 seconds. I LOVE IT! I thank Mike, Patrick and Xbytor for their invaluable assistance in developing the script.

2) SEEKING NEW SCRIPT: There are times when I would like to save my work in the form of a PSD file. Thus, when I am in the middle of my work process I would like the option to save the current state as a PSD file.... with the same name as the original RAW file and saved in the same folder as the original RAW file. I don't believe that any adjustments/considerations are required to save the current workspace as a PSD file.

I am thinking/hoping that this new script is actually a simplified version of my existing script since few adjustments are required to execute the process. Any comments and/or suggestions would be much appreciated. Bob.

Below is the existing script that I have for saving my workspace as a JPG file.
__________________________________________________________________________________________________
Code: Select all//Bob Acton.  November 3, 2009. Last updated July 29, 2013.
//Script to process a single image which is already open in CS6.  Do the following:
//   -flatten image
//   -convert to 8-bit mode
//   -SaveAs JPEG in high quality (10, or as set in script below) and
//           filename suffix (specified in script)
//   NOTE: This script was developed with much assistance from Mike, Patrick
//         and Xbytor at www.PS-Scripts.com
//-------------------------------------------------------------
//
//1. Flatten Image =======================================
var id12 = charIDToTypeID( "FltI" );
executeAction( id12, undefined, DialogModes.NO );

//2. Convert to 8-bit mode ===============================
var id13 = charIDToTypeID( "CnvM" );
    var desc4 = new ActionDescriptor();
    var id14 = charIDToTypeID( "Dpth" );
    desc4.putInteger( id14, 8 );
executeAction( id13, desc4, DialogModes.NO );

//3. Script to perform SAVEAS function//////////////////////////////////////////
// Usage: SaveAs function on existing open and active document in CS5
// Input: full name (path + filename) for the jpg
///////////////////////////////////////////////////////////////////////////////
// your active document
var doc = app.activeDocument;

var jpgQuality = 10;
var saveFile = doc.path + "/" + doc.name.replace(/\.[^\.]+$/, '') + "-processedHiRES120.jpg";

SaveJPEG( new File(saveFile), jpgQuality );

function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}