Hi,
I found this script to write XMP metadata to an open file, but it does not seem to work for me in Illustrator CC. The error message is "XMP exception: Source and destination XMP must differ".
Is there perhaps an alternative method of writing properties to the XMP fields?
Thanks,
Rich
if( xmpLib == undefined ) {
var xmpLib = new ExternalObject("lib:../../Frameworks/AdobeXMPScript");
app.synchronousMode = true;
}
var docXmp = new XMPMeta(app.activeDocument.XMPString);
var myXmp = docXmp;
myXmp.setProperty(XMPConst.NS_XMP, "CreatorTool", "My Script");
XMPUtils.appendProperties(myXmp, docXmp, XMPConst.APPEND_ALL_PROPERTIES);
var myDocFile = new File(app.activeDocument.fullName);
var docRef = new XMPFile(myDocFile.fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
if (docRef.canPutXMP(docXmp)) { docRef.putXMP(docXmp); }
docRef.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);