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

Script to move description metadata information into title field

Explorer ,
Oct 01, 2012 Oct 01, 2012

I have tried for 2 days (off and on) to try to get Bridge CS6 to copy the information from the Description field to the Title field in the metadata. I can get it into the menu, but nothing happens when I modify other scripts. Any suggestions would be greatly appreciated.

If you want a good laugh, I can post my previous attempts.

TOPICS
Scripting
2.6K
Translate
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

Valorous Hero , Oct 01, 2012 Oct 01, 2012

This is one way to copy the information ...

#target bridge  
if( BridgeTalk.appName == "bridge" ) { 
descToTitle = MenuElement.create("command", "Description to Title", "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 XMPF

...
Translate
Valorous Hero ,
Oct 01, 2012 Oct 01, 2012

This is one way to copy the information ...

#target bridge  
if( BridgeTalk.appName == "bridge" ) { 
descToTitle = MenuElement.create("command", "Description to Title", "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 Description =  getArrayItems(XMPConst.NS_DC, "description");
        myXmp.deleteProperty(XMPConst.NS_DC, "title");
        myXmp.appendArrayItem(XMPConst.NS_DC, "title", Description, 0, XMPConst.ALIAS_TO_ALT_TEXT);
        myXmp.setQualifier(XMPConst.NS_DC, "title[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();
        }
    }
}
   

Translate
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
Explorer ,
Oct 01, 2012 Oct 01, 2012

100% What I needed! It worked flawlessly- thank you very much. Now, it will be interesting to compare yours with what I did to see where, exactly, I went wrong.

Translate
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
Community Beginner ,
Feb 27, 2013 Feb 27, 2013

Paul Riggott

I came across this solution and thought it might fit my needs.

This is the first time I have seen Bridge scripting as I usually stay in the Illustrator scripting arena.

Would it be possible to get this code to move a text item in the Sublocation field to the GPS field?

I currently have several thousand photos with GPS information in the Sublocation field that I would like to move to the GPS fields.

Sublocation:  48.286848, -122.986450

GPS

     Latitude:  48,17.21N

     Longitude:  122,59.187W

The conversion is easy enough given the Sublocation can be broken into the two components, assigned to variables operated on and them moved to the GPS fields.

I can do the math, but am unfamiliar with the code to get the data and put it where I want.

Thanks for any help you can give me...

Translate
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
Community Beginner ,
May 09, 2019 May 09, 2019

Can you tell me what the process is to save this as a .jsx? I understand which folder it goes into, and I have the code copy/pasted into Script Editor, but that utility doesn't like the copied code and I'm unable to save.

Translate
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
LEGEND ,
Jul 19, 2019 Jul 19, 2019
LATEST

Can you post more information? What operating system? Script Editor on the Mac is for AppleScript, not Adobe Extendscript.

Translate
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