Copy link to clipboard
Copied
the script we've been using is no longer works properly on the newer Photoshop version. I assume that it is the function below that is not working:
function savePrefs() {
var desc1 = new ActionDescriptor();
desc1.putString(0, Prefs.toSource());
app.putCustomOptions("ed0f5560-dfb3-11e0-9572-0800200c7a99", desc1, true);
}
the function is to remember options chosen on the GUI for radio buttons, checkboxes and a dropdown list. for example below:
if (psCompatible == false) {
Prefs.autoCrop = false;
}
Prefs.labelList_array = labelList_array;
savePrefs();
I couldn't remember exactly on which version the script starting to no longer remembers the options we choose as they keep coming back to default everytime we call the script. But on the Photoshop 25.3.1 the script still works fine.
I apologize in advance that I am not the one who created the script and I don't know how to write javascript. If anyone can help guide to fix this is greatly appreciated.
Copy link to clipboard
Copied
I realized that maybe below script is also necessary to give more context.
var Prefs = {};
try {
var desc1 = app.getCustomOptions("ed0f5560-dfb3-11e0-9572-0800200c7a99");
Prefs = eval(desc1.getString(0));
} catch (e) {}
if (Prefs.inputFolderPath == undefined) {
Prefs = {
inputFolderPath: "~/desktop",
templatesFolderPath: "~/desktop",
outputFolderPath: "~/desktop",
backupFolderPath: "~/desktop",
autoCrop: true,
savepsdcopy: true,
autoPrint: true,
addLabel: true,
labelIndex: 0,
labelList_array: labelList_array,
};
savePrefs();
}
var psVersion = app.version.split(".");
var psCompatible = true;
if (psVersion[0] < 19) {
psCompatible = false;
}
if (psCompatible == false) {
Prefs.autoCrop = false;
}
Prefs.labelList_array = labelList_array;
savePrefs();
function savePrefs() {
var desc1 = new ActionDescriptor();
desc1.putString(0, Prefs.toSource());
app.putCustomOptions("ed0f5560-dfb3-11e0-9572-0800200c7a99", desc1, true);
}
Copy link to clipboard
Copied
How did you determine that the function does not work?
Try in savePrefs() function put first line
alert(Prefs.toSource())
and you can also insert there at the beginning
eraseCustomOptions("ed0f5560-dfb3-11e0-9572-0800200c7a99")
You also need to wrap all the code inside the function in a try { /*the code here*/ } catch(e) { alert(e); } block
If nothing helps you find the problem, try deleting (renaming) the Photoshop preferences file.