Skip to main content
frroy
Participant
February 18, 2016
Answered

Add text to Description field without replacing existing content in multiple images

  • February 18, 2016
  • 3 replies
  • 1631 views

Hello,

I am desperately searching for a way to prefix some keyboard inputted data into the IPTC Description field (without clearing existing data) of a number of images selected in Bridge. I have searched this forum but cannot find an existing thread.

Can anyone help with a script please?

Thanks in advance.

This topic has been closed for replies.
Correct answer SuperMerlin

This should do it.

#target bridge;

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

prefixDesc = new MenuElement("command", "Add Prefix to Description", "at the end of Tools");

}

prefixDesc.onSelect = function () {

var sels = app.document.selections;

prefixName = Window.prompt("Please enter description prefix","","Prefix Description");

if (prefixName == 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.description ? md.description[0] : "";

md.description='';

md.description = prefixName + Caption;

}

app.document.chooseMenuItem('PurgeCache');

};

3 replies

Participant
April 20, 2016

Hello

Sorry for the (very) late reply.

I can confirm both ways for suffixes are work.

frroy
frroyAuthor
Participant
February 19, 2016

Many thanks. Works perfectly.

SuperMerlin
SuperMerlinCorrect answer
Inspiring
February 18, 2016

This should do it.

#target bridge;

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

prefixDesc = new MenuElement("command", "Add Prefix to Description", "at the end of Tools");

}

prefixDesc.onSelect = function () {

var sels = app.document.selections;

prefixName = Window.prompt("Please enter description prefix","","Prefix Description");

if (prefixName == 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.description ? md.description[0] : "";

md.description='';

md.description = prefixName + Caption;

}

app.document.chooseMenuItem('PurgeCache');

};

Participant
March 2, 2016

Hello!

Could you please help me too?

I don't understand this script, but I need to write suffixes (not prefixes).

What should be modified?

Also, this should be saved in .js file?

Thanks a lot!

SuperMerlin
Inspiring
March 2, 2016

Save the file with a jsx extension

The correct folder can be found by

Prefenences - Startup Scripts - Revel My Startup Scripts (button)

This will open the folder where the script is to be saved.

Close and restart Bridge, accept the new script.

To use: select your documents, then Tools - Add Suffix to Description

#target bridge;  
   if( BridgeTalk.appName == "bridge" ) {   
suffixDesc = new MenuElement("command", "Add Suffix to Description", "at the end of Tools"); 
suffixDesc.onSelect = function () {  
var sels = app.document.selections; 
suffixName = Window.prompt("Please enter description suffix","","suffix Description"); 
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.description ? md.description[0] : ""; 
md.description=''; 
md.description = Caption + " " + suffixName ; 

for(var z in sels){

app.document.select(new Thumbnail(sels));

}

app.document.chooseMenuItem('PurgeCacheForSelected'); 

};