Copy link to clipboard
Copied
Hi,
Can this be automated?
I am currently using 3 different PS recorded actions to adjust my photos with raw filter settings.
Each recorded action is for a specific type of folder (folder name known in advance). All the folders are always in a master folder (so together).
Now I just
choose script 1 and folder 1 and hit run
choose script 2 and folder 2 and hit run
choose script 3 and folder 3 and hit run
But is there a way to script this, so it runs automatically from script 1 to 3 (choosing each corresponding folder)?
2 Correct answers
Scripts are generally run from the File > Scripts menu for an installed script, or from File > Scripts > Browse.
Script execution can also be recorded into an action.
Script files can be double-clicked in the Mac Finder or Windows Explorer, or the script file can be dragged onto the Photoshop application icon.
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
However, it is possible to paste in code via a legacy CEP extension, however, this is often u
...
You can try the following 1.2 version, remember to disable or remove the Save/Save As step from all 3 actions as this is now being performed by the script:
/*
Batch Play Actions from Conditional Folder Names v1-2.jsx
v1.0 - 21st February 2024, Stephen Marsh
v1.1 - 23rd February 2024, Replaced the original sub-folder/file processing code as it had unexpected errors in Windows (it worked on the Mac without issue)
v1.2 - 24th February 2024, Added a save to JPEG in a folder
ht
...
Explore related tutorials & articles
Copy link to clipboard
Copied
Like this, how the result is of a manual run action
 
Copy link to clipboard
Copied
Thanks, a screenshot of your JPEG save settings would help so that I know which options are required.
Copy link to clipboard
Copied
No screenshot possible now: so just the data
100% (or maximum) kwality
bicubic automatic
1920x1080
convert to sRGB
insert color profile
Copy link to clipboard
Copied
No screenshot possible now: so just the data
100% (or maximum) kwality
bicubic automatic
1920x1080
convert to sRGB
insert color profile
By that35510420xudu
I was referring to this:
However, your reply sounds like Save for Web (Legacy) – NOT Save As/Save a Copy...
Copy link to clipboard
Copied
Oh, I see what you mean, in that case this is what
i use. Exactly like this screenshot
 
Copy link to clipboard
Copied
Thanks! Only Save or Export Save for Web can be put into a script, the "new" Export As can't be scripted.
Copy link to clipboard
Copied
You can try the following 1.2 version, remember to disable or remove the Save/Save As step from all 3 actions as this is now being performed by the script:
/*
Batch Play Actions from Conditional Folder Names v1-2.jsx
v1.0 - 21st February 2024, Stephen Marsh
v1.1 - 23rd February 2024, Replaced the original sub-folder/file processing code as it had unexpected errors in Windows (it worked on the Mac without issue)
v1.2 - 24th February 2024, Added a save to JPEG in a folder
https://community.adobe.com/t5/photoshop-ecosystem-discussions/ps-script-for-multiple-actions-for-files-in-different-folders-automatic/m-p/14435721
NOTE:
* There must be 3 folders named: folder1, folder2, folder3
* The action set must be named: photo adjust
* There must be 3 actions named: action1, action2, action3
*/
#target photoshop
try {
// Main script function
(function () {
// Save and disable dialogs
var restoreDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
// Recursive open files from 1st level sub-folders under the selected parent/root folder by c.pfaffenbichler (2022)
var theFolder = Folder.selectDialog('Please select the input folder:');
if (theFolder === null) return;
var theFolders = theFolder.getFiles(isFolder);
//theFolders.sort().reverse();
theFolders.sort();
for (var m = 0; m < theFolders.length; m++) {
var inputFolder = theFolders[m];
cTID = function (s) {
return app.charIDToTypeID(s);
};
sTID = function (s) {
return app.stringIDToTypeID(s);
};
var inputFiles = inputFolder.getFiles(/\.(jpg|jpeg|tif|tiff|png|psd|psb|gif|webp)$/i);
// inputFiles.sort().reverse();
inputFiles.sort();
// Validate that the file list is not empty
var inputCount = inputFiles.length;
var cancelScript = (inputCount === 0);
if (cancelScript === true) {
alert('Zero input files found, script cancelled!');
return;
}
// Hide the Photoshop panels
app.togglePalettes();
for (var i = 0; i < inputFiles.length; i++) {
app.open(File(inputFiles[i]));
// Conditionally play the actions corresponding to the folder name
try {
if (/folder1$/i.test(app.activeDocument.path.fsName)) {
app.doAction('action1', 'photo adjust');
saveJPG();
} else if (/folder2$/i.test(app.activeDocument.path.fsName)) {
app.doAction('action2', 'photo adjust');
saveJPG();
} else if (/folder3$/i.test(app.activeDocument.path.fsName)) {
app.doAction('action3', 'photo adjust');
saveJPG();
} else {
alert('The idea is not to see this message...');
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
} catch (e) {
alert('ERROR: Check that the action exists and is named correctly!');
}
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
}
// Restore saved dialogs and panels
app.displayDialogs = restoreDialogMode;
app.togglePalettes();
// End of script notification
app.beep();
alert('Script completed!');
function isFolder(theFile) {
if (theFile.constructor.name == "Folder") {
return true;
} else {
return false;
}
}
function saveJPG() {
var docPath = app.activeDocument.path;
var jpgFolder = new Folder(docPath + '/JPG/');
if (!jpgFolder.exists) {
jpgFolder.create();
}
var docName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var jpgSave = new File(jpgFolder + "/" + docName + ".jpg");
var jpgOptns = new JPEGSaveOptions();
jpgOptns.formatOptions = FormatOptions.STANDARDBASELINE;
jpgOptns.embedColorProfile = true;
jpgOptns.matte = MatteType.NONE;
jpgOptns.quality = 12;
app.activeDocument.saveAs(jpgSave, jpgOptns, true, Extension.LOWERCASE);
}
}());
} catch (e) {
// Restore saved dialogs
app.displayDialogs = restoreDialogMode;
alert('Oops... Something went wrong!' + '\r' + e + ' ' + e.line);
}
Copy link to clipboard
Copied
thank you for the jpg folder adition, this is very helpfull. Thank you Stephen!


-
- 1
- 2