Problem saving files in .psb
Copy link to clipboard
Copied
Hi,
I have a script that manipulate layers and save them in different photoshop files.Some of them are big so need to be saved in .psb. My function that does this is based on many suggestions that i found both here and on stack overflow:
function SavePSB(saveFile) {
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putBoolean( stringIDToTypeID('maximizeCompatibility'), true );
desc1.putObject( charIDToTypeID('As '), charIDToTypeID('Pht8'), desc2 );
desc1.putPath( charIDToTypeID('In '), new File(saveFile) );
desc1.putBoolean( charIDToTypeID('LwCs'), true );
//this function creates the folder if it doesn't exist already.
makedirs(saveFile.substring(0, os.lastIndexOf('/')));
executeAction( charIDToTypeID('save'), desc1, DialogModes.NO );
};
This function works fine on windows but recently it caused trouble on macos. The computer is a M1 chip and when the artist tries to execute the script this error show up:
Error: General Photoshop Error has occurred. This functionality may not be available in this version of Photoshop. - <no additional information available>
After some digging it seems that it's the desc1.putPath() method that doesn't exist. The photoshop version is 24.7 which is the same one i have on my widows and it works well there.
My question is, is there an alternative way to save a psb file programmatically that is compatible with modern MAC? thanks in advance.
Explore related tutorials & articles
Copy link to clipboard
Copied
Make sure the path of the file object is correct.
Post the code of makedirs() function.
Copy link to clipboard
Copied
@Random_TD_Programmer – So, where are you at?
Copy link to clipboard
Copied
Hi, sorry for being so late. I tried to edit the the OP but couldn't. Here is the function:
function makedirs(folderString){
var f = new Folder(folderString);
if (f.exists == false) {
f.create()
}
}
As for the path,i will try to test today on the M1 to see if that string is wrong somehow.

