Skip to main content
Participant
May 10, 2016
Question

Script to copy variables into metadata

  • May 10, 2016
  • 1 reply
  • 1491 views

I have various text anchors with given as variables. I am able to alert the object information of variables in an illustrator document using the script below. Is there a way of copying the contents of those into the metadata? I don't mind which field of metadata. Thanks.

var idoc = app.activeDocument; 
var vars = idoc.variables; 
for (j=0; j<vars.length; j++) 
    alert(vars.name + ' : ' + vars.pageItems[0].contents); 
This topic has been closed for replies.

1 reply

Ten A
Community Expert
Community Expert
May 11, 2016
llkinnAuthor
Participant
May 11, 2016

To clarify, I would like to write to the metadata form the variable object data in the file, not write the metadata to an exported file.

Ten A
Community Expert
Community Expert
May 12, 2016

You can use it to write opened document metadata.

To set custom metadata and get opened document path(ex: XMPtool.f = app.activeDocument.fullName).

Call the write function with previouse path.