Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Appending metadata to a file

$
0
0

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


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>