Hi,
I'm having some troubles to understand how to add and read XMP metadata on a psd file. I followed the Panel developer guide tutorial, and try to look on the internet for some answers, but I'm still stuck ...
Here is the simple example I'm trying to make (using part of the code from the panel developer guide) :
/** The function loads the XMP Script Library. @returns True if the XMP Script Library was loaded successfully. @type Boolean */ function loadXMPLibrary(){ if ( !ExternalObject.AdobeXMPScript ){ try{ ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript'); }catch (e){ alert("Can't load XMP Script Library"); return false; } } return true; } /** The function unloads the XMP Script Library. */ function unloadXMPLibrary(){ if( ExternalObject.AdobeXMPScript ) { try{ ExternalObject.AdobeXMPScript.unload(); ExternalObject.AdobeXMPScript = undefined; }catch (e){ alert("Can't unload XMP Script Library"); } } } /** Try to put a new property into the metadata */ if( app.activeDocument || !loadXMPLibrary()){ var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData); xmp.setProperty( XMPConst.NS_EXIF, "myProperty", "test" ); activeDocument.xmpMetadata.rawData = xmp.serialize(); unloadXMPLibrary(); Window.alert(activeDocument.xmpMetadata.rawData); }
I don't really know where I'm wrong, could you help me please ?
Thanks,
Julien