Sure, so I want the code to simply export a high quality JPG of the active document to "C:/exports/" upon running the script, and (like your first script) it would be ideal to create an extersion with date/time format.
This script would then work on anything in one click. I could create a new document, open a previous document, PSD, TIF - it shouldn't matter because it will simply export the active document to the same folder with the unique date/time filename.
(I understand this is a werid workflow, and it's not what I generally use for my photography and design, but I want this script for quick saving of random scraps and ideas, so I can waste little time and get the imagery out)
Hii,
Its not wierd work flow, it just we have such requirements. I would request to try another version of the script that have few changes as you required. And you can change the folder location where you want to export as required. I have added the comment where it needs to be get changed. I am exporting at location Desktop/Exported JPEG. Also this script uses name as [date_timestamp]. jpeg. For instance, 200523_1590251957007. jpeg. I added date in the file name just to have more clearity in the name of the files.
#target photoshop
function exportToJPEG(path) {
var dateObj = new Date();
var year = dateObj.getFullYear().toString().substr(-2);
var month = ("0" + (dateObj.getMonth() + 1)).slice(-2);
var date = ("0" + dateObj.getDate()).slice(-2);
var timeStamp = dateObj.getTime();
var completeDate = year.toString() + month.toString() + date.toString();
var fileName = path + "/" + completeDate + "_" + timeStamp + ".jpeg";
var idsave = stringIDToTypeID("save");
var desc5 = new ActionDescriptor();
var idas = stringIDToTypeID("as");
var desc6 = new ActionDescriptor();
var idextendedQuality = stringIDToTypeID("extendedQuality");
desc6.putInteger(idextendedQuality, 12);
var idscans = stringIDToTypeID("scans");
desc6.putInteger(idscans, 5);
var idmatteColor = stringIDToTypeID("matteColor");
var idmatteColor = stringIDToTypeID("matteColor");
var idnone = stringIDToTypeID("none");
desc6.putEnumerated(idmatteColor, idmatteColor, idnone);
var idJPEG = stringIDToTypeID("JPEG");
desc5.putObject(idas, idJPEG, desc6);
var idin = stringIDToTypeID("in");
desc5.putPath(idin, new File(fileName));
var iddocumentID = stringIDToTypeID("documentID");
desc5.putInteger(iddocumentID, 219);
var idlowerCase = stringIDToTypeID("lowerCase");
desc5.putBoolean(idlowerCase, true);
var idsaveStage = stringIDToTypeID("saveStage");
var idsaveStageType = stringIDToTypeID("saveStageType");
var idsaveSucceeded = stringIDToTypeID("saveSucceeded");
desc5.putEnumerated(idsaveStage, idsaveStageType, idsaveSucceeded);
executeAction(idsave, desc5, DialogModes.NO);
}
function main() {
var desktopFolder = Folder.desktop;
var exportedFolder = Folder(desktopFolder + "/Exported JPEG"); // Change folder name and location here as you required
if(!exportedFolder.exists){
exportedFolder.create();
}
exportToJPEG(exportedFolder.fsName);
}
main();
I hope this version works for you as expected.