Custom XMP schema - add programatically
Hi,
I am trying to create custom XMP schema programatically and insert some properties with values there. Not completely sure if it’s possible, but this is how I try to do it:
var namespace = "http://ns.adobe.com/MyName/1.0/";
var prefix = "MyNameShort";
var registered = XMPMeta.registerNamespace(namespace, prefix);
var projectItem = app.project.rootItem.children[0];
if (projectItem) {
if (ExternalObject.AdobeXMPScript === undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
if (ExternalObject.AdobeXMPScript !== undefined) {
var xmpBlob = projectItem.getXMPMetadata();
var xmp = new XMPMeta(xmpBlob);
xmp.setProperty(namespace, "creator", "Team");
xmp.setProperty(namespace, "fruit", "apple");
var xmpAsString = xmp.serialize();
projectItem.setXMPMetadata(xmpAsString);
}
}
This does not do anything obvious to me, doesn’t throw an error, but I don’t find a new schema with the given namespace or the new properties. What am I doing wrong?
Additionaly - if this is possible and the custom schema is created and new properties are inserted - on second attempt to use it - how will I check if the schema does already exist or should be created?
Thank you in advance!
