I know this may be a simple question to answer, but I am stuck. I am not a programmer, but I am trying to learn, and I am working with an actual programmer on this project, but he is not very familiar with scripting in InDesign, so I am trying to get him the high-level information he needs and he in turn helps me understand how to use that programmatically. So far this has worked really well within InDesign, but now I am venturing into the uncharted waters of XMP.
I am trying to write a script that will add XMP metadata to images. The idea is to run a script that will allow me to manually position the images in InDesign and then store that information in the XMP of the image so that the next time I use that image (running a different script), it will automatically position itself according to the XMP metadata. The image's XMP needs to hold position data for a number of material types and it needs to be extensible (hence the XMP), but looking through the documentation I am not able to decipher how to inject XMP data with multiple children into the image file, or how to add a child later on. I have been successful in putting a single property into a file's XMP data using the following script:
new ExternalObject('lib:AdobeXMPScript'); xmpFile = new XMPFile( 'file.png', XMPConst.FILE_PNG, XMPConst.OPEN_FOR_UPDATE ); xmpData = new XMPMeta(); xmpData.setProperty( XMPConst.NS_PNG, 'propertyName', 'data' );
I have a schema in mind for the data and I am trying to keep it human-readable so that it can be more easily used in the future. I just can't figure out how to inject a parent --> child --> etc. type schema into the XMP.
Thanks in advance for any help you can give.
A really wild guess: createContainerItem. It seems you can add a new container of type 'BAG', which may be what you need here.