Retrieving XMP data from Cloud-Asset throws error

Community Beginner ,
Oct 20, 2020

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.

TOPICS
Scripting, SDK

Views

54

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Retrieving XMP data from Cloud-Asset throws error

Community Beginner ,
Oct 20, 2020

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.

TOPICS
Scripting, SDK

Views

55

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 20, 2020 0

Have something to add?

Join the conversation