Copy link to clipboard
Copied
Hello,
My biggest problem is that doesn't know how to write script. Can anyone kind enough to enlighten me with a ExtendScript to export Adobe illustrator XMP data into a xml file please?
Regards,
Jeno
Copy link to clipboard
Copied
Using ExternalObject is one of easer way to access XMP Metadata.
I think below sample code help you to get XMP Metadata:
// load the library
if (ExternalObject.AdobeXMPScript == undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
var fNm = File.openDialog ("select target file");
var xmp = new XMPFile( fNm.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
obj = xmp.getXMP();
xmp.closeFile();
alert(obj.serialize(XMPConst.SERIALIZE_READ_ONLY_PACKET | XMPConst.SERIALIZE_USE_COMPACT_FORMAT));
This script alert selected files XMP Strings.
"JavaScript Tools Guide CC.pdf" file also helps you understanding manipurating XMP Metada.
Ten.
Copy link to clipboard
Copied
Thanks Ten,
Now if I already have a .ai file opened. How do I export all the xmp data into a external xml file (where the .ai file is located)?
Regards,
Jeno
Copy link to clipboard
Copied
You need to save current document and get it's meta data.
Probably, If you get non saved documents information from file->file information, Its template files metadata, not current editing documents info.
Ten.
Copy link to clipboard
Copied
Yes, I already have a saved document and the job is coming in for revision. My user will trigger this script after there're done with the .ai file and while they still have the .ai file open on screen.
Exporting xml data is actually part of my "file saving/exporting workflow", I already have first part of the workflow sorted (.ai file > export PDF > export xmp) and now I need to build the exporting xmp part.
Regards,
Jeno
Copy link to clipboard
Copied
Hi Ten,
I just found this old thread. Do you know whether it is safe to store xmp within a "documentAfterSave" handler, when the document remains open and may be saved again