• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script : how to copy xmpDM:logComment into DC:Description ?

New Here ,
Dec 17, 2013 Dec 17, 2013

Copy link to clipboard

Copied

Hi !

I'm fiddling with this code to copy the xmpDM:logComment field into the DC:Description field and each time i run it, it fails saying an error relating to : Unregistred Namespace.

Code comes from here : http://forums.adobe.com/message/3847726

#target bridge  

if( BridgeTalk.appName == "bridge" ) { 

descToTitle = MenuElement.create("command", "Log Comment to Description", "at the end of Tools");

}

descToTitle.onSelect = function () {

if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

var thumb = app.document.selections;

    for(var s in thumb){

if(thumb.hasMetadata){

        var selectedFile = thumb.spec;

  var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);

  var myXmp = myXmpFile.getXMP();

         var LogComment = getProperty.(XMPConst.NS_DM, "logComment");

        myXmp.deleteProperty(XMPConst.NS_DC, "description");

        myXmp.appendArrayItem(XMPConst.NS_DC, "description", LogComment, 0, XMPConst.ALIAS_TO_ALT_TEXT);

        myXmp.setQualifier(XMPConst.NS_DC, "description[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");

    }

function getArrayItems(ns, prop){

var arrItem=[];

try{

var items = myXmp.countArrayItems(ns, prop);

for(var i = 1;i <= items;i++){

arrItem.push(myXmp.getArrayItem(ns, prop, i));

     }

return arrItem;

}catch(e){alert(e +" Line: "+ e.line);}

}

        if (myXmpFile.canPutXMP(myXmp)) {

        myXmpFile.putXMP(myXmp);

        myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);

         } else {

  xmpFile.closeFile();

        }

    }

}

Can anyone point me where my error is ?

thx!

TOPICS
Scripting

Views

837

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
community guidelines

correct answers 1 Correct answer

Enthusiast , Dec 17, 2013 Dec 17, 2013

It should be getProperty, also it requires a reference to the metadata, try this.

var LogComment = myXmp.getProperty(XMPConst.NS_DM, "logComment");

Votes

Translate

Translate
Enthusiast ,
Dec 17, 2013 Dec 17, 2013

Copy link to clipboard

Copied

It should be getProperty, also it requires a reference to the metadata, try this.

var LogComment = myXmp.getProperty(XMPConst.NS_DM, "logComment");

Votes

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
community guidelines
New Here ,
Dec 18, 2013 Dec 18, 2013

Copy link to clipboard

Copied

LATEST

Thx ! That was it.

Votes

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
community guidelines