Copy metadata

General Discussion of Scripting for Adobe Bridge

Moderators: Tom, Kukurykus

pierrelabbe

Copy metadata

Post by pierrelabbe »

Hi all,
I want to create a script that allows me to copy the metadata "Caption" (or "description") in the metadata "Author".
I am a beginner in scripting. I found the beginning of the script but I can not finish it.
Thank you for your help.
Code: Select all#target bridge 
   if( BridgeTalk.appName == "bridge" ) { 
copy_meta = MenuElement.create("command", "Caption_to_Author", "at the end of Thumbnail");
}
copy_meta.onSelect = function () {
     copy_Description();
     }

function copy_Description(){
var sels = app.document.selections;
  for (var i = 0; i < sels.length; i++){
var md = sels.synchronousMetadata;
var str = md.Description;
    md.namespace = "http://purl.org/dc/elements/1.1/";
    md.Author = str;

  }
};
Paul MR

Copy metadata

Post by Paul MR »

Please try this now..
Code: Select all#target bridge 
   if( BridgeTalk.appName == "bridge" ) { 
copy_meta = MenuElement.create("command", "Caption_to_Author", "at the end of Thumbnail");
}
copy_meta.onSelect = function () {
     copy_Description();
     }
function copy_Description(){
var sels = app.document.selections;
  for (var i = 0; i < sels.length; i++){
var md = sels.synchronousMetadata;
md.namespace = "http://purl.org/dc/elements/1.1/";
var str = md.description[0];
md.namespace = "http://ns.adobe.com/photoshop/1.0/
    md.Author = str;
  }
};
pierrelabbe

Copy metadata

Post by pierrelabbe »

Génial !
It works perfectly.
Thank you very much Paul.