ianPark
8/6/2019 - 5:04 PM

Add Metadata

addXMPdata("TEXT TO ADD TO METADATA");

// ADD XMP METADATA TO STARTING PSD
function addXMPdata(xmpMessage) {
    if (ExternalObject.AdobeXMPScript === undefined) {  
        ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');  
    } 
    var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
    var myNamespace = "http://z.zz.zzz/";
    var myPrefix = "nsfns:";
    XMPMeta.registerNamespace(myNamespace, myPrefix);
    xmp.setProperty(myNamespace, "ZZZ", xmpMessage);
    app.activeDocument.xmpMetadata.rawData = xmp.serialize();
}