Copy link to clipboard
Copied
Hi,
I've encountered the above error when doing
var xmp = new XMPMeta(xmpBlob);
The strange thing is, after I call other function with the exact code (which somehow works), calling the same code in the original function works.
I don't where to begin debug... it's not consistent.
Thanks!
I think I found it!
I guess every time that some "services" or "dependencies" are going to be used (which one, I don't know ...) - you have to initialize it or declare it.
The code I used is:
if (ExternalObject.AdobeXMPScript === undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
If only there was documentation... It'd be some much easier.
Copy link to clipboard
Copied
I think I found it!
I guess every time that some "services" or "dependencies" are going to be used (which one, I don't know ...) - you have to initialize it or declare it.
The code I used is:
if (ExternalObject.AdobeXMPScript === undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
If only there was documentation... It'd be some much easier.
Copy link to clipboard
Copied
Thank you for sharing this information. Now it does not throw error about constructor but it does not read or set the value either.
here is what I am doing
if (ExternalObject.AdobeXMPScript === undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
var docXmp = new XMPMeta(app.activeDocument.XMPString);
var nodeValue = docXmp.getProperty(XMPConst.NS_XMP, nodeName);
Do you see any obvious mistake?
Copy link to clipboard
Copied
found the gap : need to add .toString()
var nodeValue = xmp.getProperty(XMPConst.NS_XMP, nodeName).toString();