Photoshop: Saving Photoshop Script Document Properties

  • 2
  • Question
  • Updated 8 years ago
  • Answered
  • (Edited)
I am writing a VB app that opens a RAW file under Photoshop scripting, updates the document's Info.Title and Info.Caption properties, then saves.

doc.Save doesn't seem to work, as this attempts a PSD save. I have tried various SaveAs options, but all these seem to want to save a copy. I want to update just these two properties on the original document.

Any help out there, anyone?

Thanks in advance.

Photo of Brad Varey

Brad Varey

  • 2 Posts
  • 0 Reply Likes

Posted 8 years ago

  • 2
Photo of Paul Riggott

Paul Riggott

  • 360 Posts
  • 144 Reply Likes
Raw files are read only! You can update the metadata in the xmp sidecar using javaScript via Photoshop or Bridge.
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 838 Reply Likes
If you changed something in the document that won't work in the current (opened) file format, then Photoshop defaults to saving PSD.

And, as Paul pointed out, Camera RAW files cannot be saved, so saving them must default to PSD.
Photo of Paul Riggott

Paul Riggott

  • 360 Posts
  • 144 Reply Likes
You might me able to pass the javaScript by the "DoJavaScript" command?
Here is one way of updating the metadata without open the Camera Raw file.

#target photoshop
var xmpFile = new File( "/c/folderName/folderName/fileName.xmp" );

var Title = "This is the best Photo ever";
var Caption = "This is also known as the description field";
setMetadata( xmpFile, Title, Caption );

function setMetadata( file, Title, Caption ){
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
file.encoding = "UTF8";
file.lineFeed = "unix";"r", "TEXT", "????");
var xmpStr =;
var xmpStr='';
var xmp = new XMPMeta( xmpStr );
if(Title != ''){
xmp.deleteProperty(XMPConst.NS_DC, "title");
xmp.appendArrayItem(XMPConst.NS_DC, "title", Title, 0, XMPConst.ALIAS_TO_ALT_TEXT);
xmp.setQualifier(XMPConst.NS_DC, "title[1]", "", "lang", "x-default");
if(Caption != ''){
xmp.deleteProperty(XMPConst.NS_DC, "description");
xmp.setLocalizedText( XMPConst.NS_DC, "description", null, "x-default", Caption );
file.encoding = "UTF8";
file.lineFeed = "unix";
file.write( xmp.serialize() );