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

Add meta data to existing

Community Beginner ,
Oct 12, 2017 Oct 12, 2017

Copy link to clipboard

Copied

Hi,

is there a way how i could add some text to an existing meta data title of several files?

I have hundreds of files with meta data titles as "red - ", "green - ", "big - ", "new - " already set as title and i like to add some text to the end of the title. Is it possible to only add some words instead of deleting the titles just named.

The final result should look like this:

file 1 title: "red - house"

file 2 title: "green - house"

file 3 title: "big - house"

file 4 title: "new - house"

or if I like to change the word it could look like this:

file 1 title: "red - building"

file 2 title: "green - building"

file 3 title: "big - building"

file 4 title: "new - building"

or like this:

file 1 title: "red - special pencils"

file 2 title: "green - special pencils"

file 3 title: "big - special pencils"

file 4 title: "new - special pencils"

Thanks a lot for your help.

Daniel

Views

709

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

Community Expert , Jan 05, 2023 Jan 05, 2023

Give this a try. It combines the prompt script above and @Lumigraphics FilenamtoTitle script. Look for "Append Title" in the Tools menu.

 

Test it on some copy files first!

 

#target bridge

/*
Terms and Conditions of Use:
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, pub
...

Votes

Translate

Translate
Community Expert ,
Oct 13, 2017 Oct 13, 2017

Copy link to clipboard

Copied

I just hacked a Description script into a Title script to do what you are asking (thanks to SuperMerlin for the original Description script):

// https://forums.adobe.com/thread/2094964

// https://forums.adobe.com/thread/2394497

#target bridge;  

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

suffixDesc = new MenuElement("command", "Add Suffix to Title", "at the end of Tools"); 

suffixDesc.onSelect = function () {  

var sels = app.document.selections; 

suffixName = Window.prompt("Please enter title suffix","","suffix Title"); 

if (suffixName == null)  return;     

for(var a in sels){ 

var thumb = sels

md = thumb.synchronousMetadata; 

md.namespace =  "http://purl.org/dc/elements/1.1/"; 

var Caption = md.title ? md.title[0] : ""; 

md.title=''; 

md.title = Caption + suffixName; 

app.document.chooseMenuItem('PurgeCache'); 

};

Copy the 20 lines of code above, then paste into a plain text file and save with a .jsx extension, not .txt (use ExtendScript Toolkit or a plain text editor such as notepad on Windows, TextEdit or TextWrangler on Mac etc).

In Bridge, use the Preferences > Startup Scripts menu command, then press the “Reveal My Startup Scripts” button. Move the newly saved .jsx file into this folder. Go back and quit Bridge, then reopen Bridge and answer “yes” when asked about activating the newly installed script.

To use, select files in Bridge, then use the Tools menu, Add Suffix to Title command.

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
Community Expert ,
Oct 13, 2017 Oct 13, 2017

Copy link to clipboard

Copied

Another option is to use ExifTool:

Mac OS:

exiftool -m -r -overwrite_original '-title<$title #####' 'INPUT FILE OR DIRECTORY'

Win OS:

exiftool -m -r -overwrite_original "-title<$title #####" "INPUT FILE OR DIRECTORY"

Simply changing ##### to the word that you wish to append as a suffix to the existing title tag.

Another option is to use a regular expression find/replace to change any occurance of say “House” to “Building” or whatever search and replace terms that you need (Mac OS example, Windows users change the single straight quotes to double straight quotes):

exiftool -m -r -overwrite_original '-title<${title;s/House/Building/}' 'INPUT FILE OR DIRECTORY'

NOTE: Whether using a Bridge script or ExifTool or any other software, work on copies of the original files until you are sure of what you are doing and that the files are OK afterwards.

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
Community Expert ,
Oct 13, 2017 Oct 13, 2017

Copy link to clipboard

Copied

I have adapted/hacked this script to find/replace in the Title metadata field (there may be a dependency on the font Georgia being installed, if this is a problem you may need to either install the font or change line 18 to use a different installed font):

#target bridge

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

ReplaceTitle = new MenuElement("command", "Find and Replace in Title", "at the end of tools");

}

ReplaceTitle.onSelect = function () {

var win = new Window( 'dialog', 'Find & Replace' );

g = win.graphics;

var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]);

g.backgroundColor = myBrush;

win.orientation='column';

win.p1= win.add("panel", undefined, undefined, {borderStyle:"black"});

win.p1.preferredSize=[380,100];

win.g1 = win.p1.add('group');

win.g1.orientation = "row";

win.title = win.g1.add('statictext',undefined,'Caption Editor');

win.title.alignment="fill";

var g = win.title.graphics;

g.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);

win.p6= win.p1.add("panel", undefined, undefined, {borderStyle:"black"}); //Replace

win.p6.preferredSize=[380,100];

win.g600 =win.p6.add('group');

win.g600.orientation = "row";

win.g600.alignment='fill';

win.g600.st1 = win.g600.add('statictext',undefined,'Replace');

win.g600.st1.preferredSize=[75,20];

win.g600.et1 = win.g600.add('edittext');

win.g600.et1.preferredSize=[200,20];

win.g610 =win.p6.add('group');

win.g610.orientation = "row";

win.g610.alignment='fill';

win.g610.st1 = win.g610.add('statictext',undefined,'With');

win.g610.st1.helpTip="Leave this field blank if you want to remove the characters";

win.g610.st1.preferredSize=[75,20];

win.g610.et1 = win.g610.add('edittext');

win.g610.et1.preferredSize=[200,20];

win.g620 =win.p6.add('group');

win.g620.orientation = "row";

win.g620.alignment='fill';

win.g620.cb1 = win.g620.add('checkbox',undefined,'Global');

win.g620.cb1.helpTip="Replace all occurrences of";

win.g620.cb2 = win.g620.add('checkbox',undefined,'Case Insensitive');

win.g620.cb2.value=true;

win.g1000 =win.p1.add('group');

win.g1000.orientation = "row";

win.g1000.alignment='center';

win.g1000.bu1 = win.g1000.add('button',undefined,'Process');

win.g1000.bu1.preferredSize=[170,30];

win.g1000.bu2 = win.g1000.add('button',undefined,'Cancel');

win.g1000.bu2.preferredSize=[170,30];

win.g1000.bu1.onClick=function(){

if(win.g600.et1.text == ''){

    alert("No replace value has been entered!");

    return;

    }

win.close(0);

var sels = app.document.selections;

for(var a in sels){

var thumb = sels;

md = thumb.synchronousMetadata;

if(win.g620.cb1.value && !win.g620.cb2.value) var patt = new RegExp (win.g600.et1.text.toString(),"g");

if(!win.g620.cb1.value && win.g620.cb2.value) var patt = new RegExp (win.g600.et1.text.toString(),"i");

if(win.g620.cb1.value && win.g620.cb2.value) var patt = new RegExp (win.g600.et1.text.toString(),"gi");

if(!win.g620.cb1.value && !win.g620.cb2.value) var patt = new RegExp (win.g600.et1.text.toString());

md.namespace =  "http://purl.org/dc/elements/1.1/";

var Caption = md.title ? md.title[0] : "";

if(Caption == "") continue;

var result=patt.test(Caption.toString());

if(result == true){

    var newCaption = Caption.replace(patt,win.g610.et1.text.toString());

    setTitle( sels.spec,newCaption);

        }

    }

}

win.show();

function setTitle( file,Caption){

if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

        var xmpf = new XMPFile( File(file).fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE );

        var xmp = xmpf.getXMP();

        xmp.deleteProperty(XMPConst.NS_DC, "title");

        xmp.setLocalizedText( XMPConst.NS_DC, "title", null, "x-default", Caption );

      if (xmpf.canPutXMP( xmp )) {

         xmpf.putXMP( xmp );

      }

      xmpf.closeFile( XMPConst.CLOSE_UPDATE_SAFELY );

}

};

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
Community Beginner ,
Jan 03, 2023 Jan 03, 2023

Copy link to clipboard

Copied

is it still working? because nothing is happing if i use the script in adobe bridge 2022

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
Community Beginner ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

edit: on the imac/bridge 2022 after typing a suffix with the script nothing is changing  in the meta title 😕 

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
LEGEND ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

This is an old thread with a script from 2017, a lot has changed and scripts of that age may not work in the current versions.

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
Community Beginner ,
Jan 05, 2023 Jan 05, 2023

Copy link to clipboard

Copied

okay, i tried if the gpt chat could code it for the new version of adobe bridge 2022 or 2023 but it didnt work out.

// Set the title of the prompt window
var promptTitle = "Enter New Text";

// Set the message displayed in the prompt window
var promptMessage = "Enter the new text that you want to add to the end of the metadata title:";

// Display the prompt window and get the user's input
var newText = prompt(promptMessage, "", promptTitle);

// Check if the user clicked "OK" and entered some text
if (newText != null && newText != "") {
  // Get the selected files in Adobe Bridge
  var selectedFiles = app.document.selections;

  // Loop through the selected files
  for (var i = 0; i < selectedFiles.length; i++) {
    // Get the current metadata title of the file
    var currentTitle = selectedFiles[i].synchronousMetadata.getProperty("xmp", "dc:title");

    // Add the new text to the end of the current title
    var updatedTitle = currentTitle + newText;

    // Set the updated title as the new metadata title for the file
    selectedFiles[i].synchronousMetadata.setProperty("xmp", "dc:title", updatedTitle);
  }
}

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
LEGEND ,
Jan 05, 2023 Jan 05, 2023

Copy link to clipboard

Copied

Copy the existing title contents, modify it, clear the field, then write the new content.

I have some utility scripts that work with the title field, open source/free.

https://www.dropbox.com/sh/mg817g9a9ymbasi/AADTmXUVxmFfM58bcyYE7yiwa?dl=0

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
Community Beginner ,
Jan 05, 2023 Jan 05, 2023

Copy link to clipboard

Copied

thanks lumigraphics but i really dont can coding. i have the same peoblem like the thread startet. 10.000 of png files with diverse titel in the meta and now i wanna qee some text on the end of the the existing meta data titles

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
LEGEND ,
Jan 05, 2023 Jan 05, 2023

Copy link to clipboard

Copied

I don't currently have time to do a bespoke script for you, you'll need to find or hire someone to write/modify a script. Most of it is there with existing scripts in circulation.

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
Community Expert ,
Jan 05, 2023 Jan 05, 2023

Copy link to clipboard

Copied

Give this a try. It combines the prompt script above and @Lumigraphics FilenamtoTitle script. Look for "Append Title" in the Tools menu.

 

Test it on some copy files first!

 

#target bridge

/*
Terms and Conditions of Use:
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

if( BridgeTalk.appName == "bridge" ) {    
menuAppTitle = new MenuElement("command", "Append Title", "at the end of Tools");
}  

menuAppTitle.onSelect = appendTitle;
// version 2023-01-05
function appendTitle(){
    try{
        var thumbs = app.document.selections; //get selected thumbnails
        if (!thumbs.length) return; //nothing selected
        if (ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
        
        appendText = Window.prompt("Enter text to add to end of the Title","","Append Title"); // prompt for suffix text
        if (appendText == null)  return; // no text entered, close prompt    

        for(var a in thumbs){ //loop through thumbs
            if(!thumbs[a].container){ //exclude folders
                var thumbMeta = thumbs[a].synchronousMetadata; // get metadata
                var xmp = new XMPMeta(thumbMeta.serialize()); // serialize metadata
                var currentTitle = "";
                var count = xmp.countArrayItems(XMPConst.NS_DC, "title"); // check if there is an existing title
                if(count > 0){ // if there is an existing title, get the value, otherwise currentTitle will be empty
                    currentTitle = xmp.getLocalizedText (XMPConst.NS_DC, "title","","x-default"); 
                    }
                var newTitle = currentTitle+appendText;
                xmp.deleteProperty(XMPConst.NS_DC, 'title'); //delete old title
                xmp.appendArrayItem(XMPConst.NS_DC, 'title', newTitle, 0, XMPConst.ALIAS_TO_ALT_TEXT); //write new title
                xmp.setQualifier(XMPConst.NS_DC, 'title[1]', 'http://www.w3.org/XML/1998/namespace', 'lang', 'x-default');
                var ftUpdatedPacket = xmp.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
                thumbs[a].metadata = new Metadata(ftUpdatedPacket); //write to file
                }
            }
        }
    catch(e){
        alert(e + ' ' + e.line);
        }
    }

  

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
Community Beginner ,
Jan 06, 2023 Jan 06, 2023

Copy link to clipboard

Copied

LATEST

work fantastic! thank you so much!

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