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

Is it possible to modify this script to include subfolders?

Explorer ,
Nov 11, 2014 Nov 11, 2014

Copy link to clipboard

Copied

I have tried to do this with no luck. This script works great, but how to I make it apply to all sub-folders? Thanks for any suggestions.

#target bridge  

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

descToTitle = MenuElement.create("command", "Keys 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, "keywords");

        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();

        }

    }

}

TOPICS
Scripting

Views

737

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
Enthusiast ,
Nov 11, 2014 Nov 11, 2014

Copy link to clipboard

Copied

There is no need to modify the script as it works on selected files, all you need to do is have "show Items from Subfolders" ticked in the view menu and select the files you want the script to modify.

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
Explorer ,
Nov 11, 2014 Nov 11, 2014

Copy link to clipboard

Copied

I have done that, but for some reason that feature is not working in my copy of Bridge.

Not to mention, I need to do this on thousands of images. That is why the subfolder feature would be helpful.

However, I also thought about creating a collection with all of the images in 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
Explorer ,
Aug 20, 2015 Aug 20, 2015

Copy link to clipboard

Copied

Any luck? I have around 5000 folders, with about 200 images in each so showing items from subfolders tends to crash Bridge

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
Explorer ,
Sep 28, 2015 Sep 28, 2015

Copy link to clipboard

Copied

LATEST

No—there was no luck with that. Try Lightroom Metadata Transporter—I was able to get it to work for my purposes.

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