@Rozmere
Here is a version 1 script.
This initial version can be used to target a networked or local directory. If this works as intended, the code can be adjusted to save to a local temporary location, then copy the files over the network to the target volume. Baby steps.
Read the comments at the head of the script for options to change the PDF preset name and run your spellcheck/CMYK action.
Let me know how it goes...
/*
Save PSD and PDF versions to subfolder in selected folder.jsx
Stephen Marsh
v1.0 - 22nd November 2024
Info: This script saves both a layered PSD and a flattened PDF version named
after the Identifier group text layer to a selected folder, in a subfolder
named after the Identifier group text layer.
Notes:
* Change the PDF preset name from "Press Quality" to your desired preset
* Optionally uncomment and change the name of the action and action set
*/
#target photoshop;
(function () {
// Check if there's an open document
if (app.documents.length) {
try {
// Run the spellcheck and CMYK profile action (case sensitive)
//app.doAction("My Action", "My Action Set");
// Set the text layer in the "Identifier" layer group
var identifierTextLayer = app.activeDocument.layerSets["Identifier"].layers[0].name;
// Select the output folder
var selectedFolder = Folder.selectDialog("Select the root/top-level output folder:");
if (selectedFolder === null) {
alert('Script cancelled!');
return;
}
// Set the save folder
var outputFolder = new Folder(decodeURI(selectedFolder) + "/" + identifierTextLayer);
if (outputFolder.exists == false) outputFolder.create();
// Save a layered PSD file named after the identifier into a sub-folder named after the identifier
var saveFilePSD = new File(outputFolder + "/" + identifierTextLayer + '.psd');
savePSD(saveFilePSD);
// Save a flattened PDF file named after the identifier into the same folder as the PSD
app.activeDocument.flatten();
var saveFilePDF = new File(outputFolder + "/" + identifierTextLayer + '.pdf');
savePDF(saveFilePDF);
// SaveOptions.PROMPTTOSAVECHANGES | SaveOptions.DONOTSAVECHANGES | SaveOptions.SAVECHANGES
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
} catch (err) {
alert("Error!" + "\r" + err + ' ' + err.line);
}
} else {
alert('A document must be open to run this script!');
}
// Helper functions
function savePSD(saveFile) {
var psdSaveOptions = new PhotoshopSaveOptions();
psdSaveOptions.embedColorProfile = true;
psdSaveOptions.alphaChannels = true;
psdSaveOptions.layers = true;
psdSaveOptions.annotations = true;
psdSaveOptions.spotColors = true;
app.activeDocument.saveAs(saveFile, psdSaveOptions, false, Extension.LOWERCASE);
}
function savePDF(saveFilePath) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor2.putString(s2t("pdfPresetFilename"), "Press Quality"); // Change the PDF preset as required
descriptor.putObject(s2t("as"), s2t("photoshopPDFFormat"), descriptor2);
descriptor.putPath(s2t("in"), saveFilePath);
descriptor.putBoolean(s2t("copy"), true);
descriptor.putBoolean(s2t("lowerCase"), true);
descriptor.putBoolean(s2t("embedProfiles"), false);
executeAction(s2t("save"), descriptor, DialogModes.NO);
}
}());
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html