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