Photoshop save as PSB

Is there a way to save PSB files?
I looked up Photoshop dictionary, but there is anything like “PSB save options” When I try to save a file larger than 30000 pix as PSD format, the script stops at PSB save dialog. So I want to write a script that save the large files as PSB format without dialog.

Thanks,

Model: MacPro
AppleScript: 2.5
Browser: Firefox 45.0
Operating System: macOS 10.11

You can do it with Javascript, but it’s less user friendly.

set POSIXsavePath to "/Volumes/Mackintosh HD/Users/[username here]/[rest of path]"
save_as_psb(POSIXsavePath)


on save_as_psb(filePath)
	tell application "/Applications/Adobe Photoshop CS6/Adobe Photoshop CS6.app"
		do javascript "
var idsave = charIDToTypeID( \"save\" );
    var desc17 = new ActionDescriptor();
    var idAs = charIDToTypeID( \"As  \" );
        var desc18 = new ActionDescriptor();
    var idPhteight = charIDToTypeID( \"Pht8\" );
    desc17.putObject( idAs, idPhteight, desc18 );
    var idIn = charIDToTypeID( \"In  \" );
    desc17.putPath( idIn, new File( \"" & filePath & "\" ) );
    var idDocI = charIDToTypeID( \"DocI\" );
    desc17.putInteger( idDocI, 1124 );
    var idLwCs = charIDToTypeID( \"LwCs\" );
    desc17.putBoolean( idLwCs, true );
    var idPrvw = charIDToTypeID( \"Prvw\" );
        var list5 = new ActionList();
        var idPrvw = charIDToTypeID( \"Prvw\" );
        var idWnTh = charIDToTypeID( \"WnTh\" );
        list5.putEnumerated( idPrvw, idWnTh );
    desc17.putList( idPrvw, list5 );
    var idsaveStage = stringIDToTypeID( \"saveStage\" );
    var idsaveStageType = stringIDToTypeID( \"saveStageType\" );
    var idsaveBegin = stringIDToTypeID( \"saveBegin\" );
    desc17.putEnumerated( idsaveStage, idsaveStageType, idsaveBegin );
executeAction( idsave, desc17, DialogModes.NO );"
	end tell
end save_as_psb

Even if you perform a “save as” and provide a new file name, the Javascript doesn’t record the file name. So I think this will always save with the current file name. If you need to save with a unique name, I’d just sav this way to a temp folder and then move/rename the file as needed with Applescript.

You may want different save settings than I used. You can find those with scripting listener, or let me know what your save settings are and I can modify this. If you need to use different save settings by script, the different permutations can be run with scripting listener and then changed in the AM code via applescript based on arguments passed to the handler.

One way to do things with applescript and photoshop is to record what you want to do as a Photoshop action and then you can activate that action from the applescript.

Example:


tell application "Adobe Photoshop CC 2018"
			activate
			set display dialogs to never
do action "My Action" from "My Actionsfolder"
end tell