Thank you very much for your inspiring work, Roland! This was the right way to go (although it’s a rocky one ...)! I hope you don’t mind, that I use some of your code lines in this threat ... For people who are stumbling over this thread: InDesign’s easy access to the "author" metadata field ("metadataPreferences.author") respects only (and consequently) one author for an InDesign document. If there is a comma or a semicolon inside the author String, it treats this as one author and qoutes it (as mentioned in the starting post). This respects the possibility to insert authors with "[last name], [first name]", as in "Gibson, William" – either separated by comma or semicolon. To insert multiple author names correctly, we have to use the XMP methods. Here is a piece of code, which allows to correctly insert multiple authors into the XMP metadata field "author": const destinationNameSpace = "http://purl.org/dc/elements/1.1/";
const destinationName = "dc:creator";
const containerType = "SEQ";
var activeDoc = app.documents.item(0);
var metadataPrefs = activeDoc.metadataPreferences;
var numberOfContainerItems = metadataPrefs.countContainer(destinationNameSpace, destinationName);
var newContainerItems = ["William Gibson", "Dorothy Sayers"]
/* Check if container exists */
if (numberOfContainerItems === 0) {
/* Create new container */
metadataPrefs.createContainerItem(destinationNameSpace, destinationName, 0, ContainerType[containerType]);
}
/* Empty existing container */
for (var n = numberOfContainerItems; n > 0; n -= 1) {
metadataPrefs.setProperty(destinationNameSpace, destinationName + "[" + n + "]", "");
}
/* Fill containerItems into container */
for (var i = 0; i < newContainerItems.length; i += 1) {
var objectItem = newContainerItems[i];
var itemIndex = i + 1;
var itemPath = destinationName + "[" + itemIndex + "]";
metadataPrefs.setProperty(destinationNameSpace, itemPath, objectItem);
} Please note, that this is just a proof of concept ignoring error possibilities. For a better implemenation with error checking, analyse Rolands code carefully. I found a very informative resource on "XMP metadata in InDesign scripting" in some of tomaxxi’s blog posts: https://indisnip.wordpress.com/?s=xmp Especially this one: https://indisnip.wordpress.com/2010/09/07/storing-custom-data-into-indesign-file-xmp/ Thanks a lot, Tobias
... View more