Copy link to clipboard
Copied
Hello Community,
I'm having a problem with a Javascript I wrote to retrieve XMP data from Assets.
Ultimately, the script retrieves the Creditline of all the linked graphics in an InDesign-file / InDesign-files in a folder by bulk processing.
I'm accessing the XMP, because the method to retrieve copyrightinfo with Out-of-the-box-Extendscript is not helpful; retrieves the wrong field (Link.linkXmp.copyrightNotice). (@adobe this is not enough)
The Script I'm running works perfectly fine for links, that are located on my local drive or server but it doesn't work for Assets that are linked in the document from Adobe Creative Cloud.
My Script looks something like this:
if ( !ExternalObject.AdobeXMPScript ){
try{ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');}
catch (e){alert('Unable to load the AdobeXMPScript library!');}
}
var myFile = File(app.selection[0].graphics[0].itemLink.filePath);
alert(myFile.fsName);
xmpFile = new XMPFile(myFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
var myXmp = xmpFile.getXMP();
xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
var myPsCredit = myXmp.getProperty(XMPConst.NS_PHOTOSHOP,"Credit");
var myDcCredit = myXmp.getProperty(XMPConst.NS_DC,'rights[1]');
if (myPsCredit) {
var output = myPsCredit;
} else{
var output = myDcCredit;
}
alert(output);
if( ExternalObject.AdobeXMPScript ){
try{ExternalObject.AdobeXMPScript.unload(); ExternalObject.AdobeXMPScript = undefined;}
catch (e){alert('Unable to unload the AdobeXMPScript library!');}
}
In this line I'm getting an error:
errornumber: 1000
errorstring: XMP Exception: OpenFile returned false
xmpFile = new XMPFile(myFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
I'm reading from this, that the XMP of that file which is located in the Creative Cloud, cannot be opened.
Is there a way for still retriving the XMP from those files?
Unless there is a way to bulk-download all the Assets from the cloud and automatically re-link them in all the files i want to check, I have to access the XMP in the Cloud-stored files.
Copy link to clipboard
Copied
Same error here
Copy link to clipboard
Copied
Hi @24406309 , What's the filePath string that myFile is returning?