Wednesday, March 20, 2019

#1 2019-02-21 09:01:59 pm

Registered: 2019-02-21
Posts: 1

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.


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

Filed under: Photoshop PSB



#2 2019-02-22 11:03:08 am

From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 378

Re: Photoshop save as PSB

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


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

on save_as_psb(filePath)
   tell application "/Applications/Adobe Photoshop CS6/Adobe Photoshop"
       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.

Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb



#3 2019-02-26 08:51:00 am

From:: Förslöv, Sweden
Registered: 2019-02-19
Posts: 15

Re: Photoshop save as PSB

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.



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



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)