Skip to main content
Participant
August 22, 2022
Question

Need help with Illustrator XMP

  • August 22, 2022
  • 1 reply
  • 146 views

Hi all,

 

With a very limited understanding of Javascript / Applescript I've managed to hack a number of scripts together to perform the functions I need within Illustrator. But what I'm trying to do now has me completely stumped.

 

I'm looking for a way to extract some XMP metadata from an AI / PDF file and either copy it to the clipboard or save it to a basic text file in a list format.

 

I can see the data I need when I open the document in a text editor. Items in bold are what I'm looking to extract. I only posted the sections containing the relevant data but can include the entire file if necessary. 

 

 

 

 

I'd like to do this outside of Illustrator if possible. Maybe something like an Automator app / droplet where I can drop the file / files or run from a shortcut to have them batch processed?

 

Or maybe there's another way to do this entirely, I'm open to suggestions. Any help would be greatly appreciated! Thanks!

This topic has been closed for replies.

1 reply

femkeblanco
Legend
August 22, 2022
// saves text file to desktop
var XMP = new File("~/Desktop/XMP.txt");
XMP.encoding = "UTF-8";
var string1 = app.activeDocument.XMPString;
var string2 = string1.match(/<stRef:filePath>[\s\S]*?<\/stRef:filePath>/);
var string3 = string1.match(/<xmpTPg:PlateNames>[\s\S]*?<\/xmpTPg:PlateNames>/);
XMP.open("e");
XMP.write(string2 + "\n\n" + string3);
XMP.close;