Copy link to clipboard
Copied
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
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 );
};
Copy link to clipboard
Copied
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 );
};
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
savePSB(activeDocument.path)
Copy link to clipboard
Copied
Hello, I was wondering what were behind the stringIDToTypeID and others code.
that seems to be more difficult more than the general guideline. where can I find a documentation on that?
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now