An updated 1.2 version which offers a selection to include or exclude maximise compatibility in PSD or PSB files:
/*
Batch Add or Remove Maximize Compatibility from PSD v1-2.jsx
Stephen Marsh
30th August 2025 - v1.0: Initial release
30th August 2025 - v1.1: Consolidated folder selection + file count prompts
2nd December 2025 - v1.2: Added dropdown for Maximize Compatibility preference: ALWAYS/NEVER
https://community.adobe.com/t5/photoshop-ecosystem-discussions/batch-remove-maximize-compatibility-from-psd-folders/td-p/15481712
https://community.adobe.com/t5/photoshop-ecosystem-discussions/image-processor-no-longer-overwrites-original-files/m-p/15615418
*/
#target photoshop
main();
function main() {
var originalSetting = app.preferences.maximizeCompatibility;
// Create main window
var win = new Window("dialog", "Batch Add or Remove Maximize Compatibility (v1.2)");
win.preferredSize.width = 400;
win.alignChildren = "fill";
// Create panel
var panel = win.add("panel", undefined, "");
panel.alignment = ["fill", "top"];
panel.preferredSize.width = 400;
panel.orientation = "column";
panel.alignChildren = "fill";
panel.margins = 15;
// Instructions
var infoText = panel.add("statictext", undefined,
"This script will process all PSD/PSB files in the selected folder and subfolders, update Maximize Compatibility according to your selection, overwrite the originals, and restore your original preference.",
{ multiline: true }
);
infoText.preferredSize.width = 400;
if ($.os.match(/Windows/i)) {
infoText.preferredSize.height = 40;
} else {
infoText.preferredSize.height = 60;
}
infoText.alignment = ["fill", "top"];
// Folder group
var folderGroup = panel.add("group");
folderGroup.orientation = "row";
folderGroup.alignChildren = ["left", "center"];
var browseBtn = folderGroup.add("button", undefined, "Browse...");
var folderPath = folderGroup.add("edittext", undefined, "");
folderPath.alignment = ["fill", "center"];
// File count display
var fileCountText = panel.add("statictext", undefined, "No folder selected.");
fileCountText.preferredSize.width = 400;
// Maximize Compatibility dropdown
var compatGroup = panel.add("group");
compatGroup.orientation = "row";
compatGroup.alignChildren = ["left", "center"];
compatGroup.add("statictext", undefined, "Maximize Compatibility:");
var compatDropdown = compatGroup.add("dropdownlist", undefined, ["NEVER", "ALWAYS"]);
compatDropdown.selection = 0; // Default: NEVER
// Buttons
var buttonGroup = win.add("group");
buttonGroup.alignment = "right";
var cancelBtn = buttonGroup.add("button", undefined, "Cancel", { name: "cancel" });
var okBtn = buttonGroup.add("button", undefined, "OK", { name: "ok" });
var selectedFolder;
var allFiles = [];
browseBtn.onClick = function () {
selectedFolder = Folder.selectDialog("Select the root folder to process PSD/PSB files");
if (selectedFolder) {
folderPath.text = decodeURI(selectedFolder.fsName);
allFiles = [];
collectFiles(selectedFolder, allFiles);
if (allFiles.length > 0) {
fileCountText.text = "Found " + allFiles.length + " PSD/PSB files to process.";
} else {
fileCountText.text = "No PSD/PSB files found.";
}
}
};
okBtn.onClick = function () {
if (!selectedFolder) {
alert("Please select a folder first.");
return;
}
if (allFiles.length === 0) {
alert("No PSD/PSB files found.");
return;
}
var proceed = confirm("Found " + allFiles.length + " PSD/PSB files - all files will be overwritten! Continue?");
if (!proceed) {
win.close();
return;
}
// Dropdown value (NEVER/ALWAYS)
var chosenSetting = compatDropdown.selection.text;
app.togglePalettes();
win.hide();
processFiles(allFiles, originalSetting, chosenSetting);
win.close();
};
cancelBtn.onClick = function () {
win.close();
};
win.show();
}
///// Functions /////
function processFiles(allFiles, originalSetting, chosenSetting) {
var prefs = app.preferences;
// Apply user preference
prefs.maximizeCompatibility =
(chosenSetting === "ALWAYS") ?
QueryStateType.ALWAYS :
QueryStateType.NEVER;
try {
var progressBarWin = new Window("palette", "Processing PSD Files", undefined, { closeButton: false });
progressBarWin.alignChildren = "fill";
var progressBar = progressBarWin.add("progressbar", undefined, 0, allFiles.length);
progressBar.preferredSize.width = 300;
var statusText = progressBarWin.add("statictext", undefined, "Starting...");
statusText.preferredSize.width = 300;
progressBarWin.show();
for (var i = 0; i < allFiles.length; i++) {
var file = allFiles[i];
statusText.text = "Processing (" + (i + 1) + " of " + allFiles.length + "): " + decodeURI(file.name);
progressBar.value = i + 1;
progressBarWin.update();
try {
processPSD(file);
} catch (e) {
alert("Error processing file: " + file.name + "\n" + e.message);
}
}
app.bringToFront;
progressBarWin.close();
app.togglePalettes();
app.beep();
alert(
allFiles.length + " files processed!" +
"\n\nYour original Maximize Compatibility setting has been restored."
);
} catch (e) {
alert("An error occurred during processing:\n" + e.message);
} finally {
prefs.maximizeCompatibility = originalSetting;
}
}
function collectFiles(folder, fileArray) {
var files = folder.getFiles();
for (var i = 0; i < files.length; i++) {
var f = files[i];
if (f instanceof Folder) {
collectFiles(f, fileArray);
} else if (f instanceof File && f.name.match(/\.(psd|psb)$/i)) {
fileArray.push(f);
}
}
}
function processPSD(file) {
var doc = app.open(file);
var tempLayer = doc.artLayers.add();
tempLayer.name = "TempLayer";
tempLayer.remove();
var fileExt = file.name.split('.').pop().toLowerCase();
if (fileExt === "psd") {
// DOM PSD save
var saveOptions = new PhotoshopSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.alphaChannels = true;
saveOptions.layers = true;
saveOptions.annotations = true;
saveOptions.spotColors = true;
doc.saveAs(file, saveOptions, true);
doc.close(SaveOptions.DONOTSAVECHANGES);
} else {
// Action Manager PSB save
var c2t = function (s) { return app.charIDToTypeID(s); };
var s2t = function (s) { return app.stringIDToTypeID(s); };
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor2.putBoolean(s2t("maximizeCompatibility"), false);
descriptor.putObject(s2t("as"), s2t("largeDocumentFormat"), descriptor2);
descriptor.putPath(c2t("In "), doc.fullName);
descriptor.putInteger(s2t("documentID"), doc.id);
descriptor.putBoolean(s2t("lowerCase"), true);
executeAction(s2t("save"), descriptor, DialogModes.NO);
doc.close(SaveOptions.DONOTSAVECHANGES);
}
}
Copy the code text to the clipboard
Open a new blank file in a plain-text editor (not in a word processor)
Paste the code in
Save as a plain text format file – .txt
Rename the saved file extension from .txt to .jsx
Install or browse to the .jsx file to run (see below)
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
... View more