Skip to main content
stephenw42374084
Inspiring
February 7, 2017
Answered

.PSB file type, 'save as' cannot be done in Photoshop script?

  • February 7, 2017
  • 1 reply
  • 3556 views

Have a Photoshop file (PSD) containing a Smart Layer .psb file.

I can replace the smart layer .psb file with another pre-saved .psb file, to produce an updated version file.

However I'm looking to create a new 'file' in script, that I want to use as the replacement .psb file.

The problem is cannot "Save As" in Photoshop Script any file as a .psb file?

Can anybody help please, or suggest a work around, such as create a .psb from scratch?

Thank you for looking.

Stephen

This topic has been closed for replies.
Correct answer SuperMerlin

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 );

executeAction( charIDToTypeID('save'), desc1, DialogModes.NO );

};

1 reply

SuperMerlin
SuperMerlinCorrect answer
Inspiring
February 7, 2017

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 );

executeAction( charIDToTypeID('save'), desc1, DialogModes.NO );

};

stephenw42374084
Inspiring
February 7, 2017

Thanks very much, works like a treat.....

Will now have to change the title of the Thread!

Also no issue with Opening the file as .psb using the app.Open(filename) and no OpenDocumentType.

Again thanks again.

Stephen

Inspiring
January 18, 2019

Hello,

  This script isn't working for me. It just doesn't do anything. No errors, but isn't bringing up a save dialog. What I'm doing is opening a file, duplicate that file and then try to run this script to bring up a 'save as' dialog, but nothing happens. What am I missing?