Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
1

Problem saving files in .psb

New Here ,
Sep 06, 2023 Sep 06, 2023

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.

TOPICS
Actions and scripting , macOS

Views

289
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 06, 2023 Sep 06, 2023

Copy link to clipboard

Copied

Make sure the path of the file object is correct.

 

Post the code of makedirs() function.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2023 Sep 08, 2023

Copy link to clipboard

Copied

@Random_TD_Programmer â€“ So, where are you at?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 11, 2023 Sep 11, 2023

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines