Skip to main content
Adobe Photoshop Family

4 Messages

 • 

150 Points

Fri, Oct 4, 2013 9:13 AM

4

Bridge: Add a "find and replace" function for quick caption corrections.

Add a "find and replace" function to Bridge so that if you spot a spelling mistake in 200 image captions they don't need to be altered one by one.

Responses

14 Messages

 • 

230 Points

3 years ago

Anyone here can modify this script to work on Headlines and Keywords?

631 Messages

 • 

9.6K Points

In Paul Riggott script you are linked in 8th post of this theard change lines 66 - 75 to:

    for(i = 0; i < (arr = ['description', 'Headline', 'Keywords']).length; i++) {
      md.namespace = i ? 'http://ns.adobe.com/photoshop/1.0/' :
      'http://purl.org/dc/elements/1.1/'; Caption =

        if (!Caption.length) continue;
        if (patt.test(Caption = Caption.toString())) {
          newCaption = Caption.replace(patt, win.g610.et1.text.toString())
          if (win.g620.cb3.value) newCaption = newCaption.replace(/["'\(\)]/g, '')
          function cap(v) {!i ? md.description = v : (i < 2 ? md.Headline = v : md.Keywords = v)}
          cap(''), cap(newCaption)
      }
    }

361 Messages

 • 

6.9K Points

Thanks Kukurkus if anyone wants to change the code they can do. I like to keep it simple so a novice can add/amend to thier own needs.

631 Messages

 • 

9.6K Points

I came too late with my script :) I wrote it right after Brian Fiskar request - but went to sleep without testing. When I visitied this forum again I noticed you replied one hour earlier, but since tests didn't fail I eventually posted my vers. as well. Cerntainly everything is based on your many years work :D

361 Messages

 • 

6.9K Points

3 years ago

Hi Brian,  I have modified the script and it now will support:
Description, Headline, Title and Keywords
It can be downloaded from:-
http://www.ps-bridge-scripts.talktalk.net/download/Find%20and%20Replace.zip

P.S.
Don't forget to remove the old version!

Champion

 • 

882 Messages

 • 

19.2K Points

14 Messages

 • 

230 Points

3 years ago

There are two small problems that could be related.
1. The menu is blank unless I put the Cursor on the selection. Then it appears in the slot.
2. After the function run the field in the IPTC appears to be empty like everything was erased. No, it wasn't . After closing and restarting Bridge everything that was there before is there with the change (searched and replaced) of course.
Thanks.

631 Messages

 • 

9.6K Points

Try my version as well and say how it works before Paul Riggott will update his script ;)

14 Messages

 • 

230 Points

Where can I download your script?

361 Messages

 • 

6.9K Points

Hi Brian can you download the script again, it seems that it was CS6 that had a problem, this has now been fixed.

631 Messages

 • 

9.6K Points

It seems Paul Riggott already did great job again, but answering to your question I already posted a code 8 posts higher that you put in previous version of script (link to is in this theard)

14 Messages

 • 

230 Points

Kukurykus, I saw the code but I have no idea what to do with it. Paul, has it in downloadable link. But thank you for trying.

14 Messages

 • 

230 Points

To Paul,
It has more fields but the same problem still there. I am attaching the screen shot. As you can see fields are empty. If I click on the arrow down each field appears in the highlight but not all at once. 2 pictures attached. Thanks.

631 Messages

 • 

9.6K Points

I already wrote in that post where you see code what to do, I'm quoting:
In Paul Riggott script you are linked in 8th post of this theard change lines 66 - 75 to:
Then I posted a code, you should copy and do what is said in that sentence. If you still don't know where to download that script, however I said it's in 8th post of this theard here you have a link:

http://www.ps-bridge-scripts.talktalk.net/download/Find%20Replace%20In%20Description.zip

To make it easier for you (as I assume you use notepad where lines are with no numbers) I post here also exact part you should replace to that you're finding in my original post:

md.namespace =  "http://purl.org/dc/elements/1.1/";
var Caption = md.description ? md.description[0] : "";
if(Caption == "") continue;
var result=patt.test(Caption.toString());
if(result == true){
  var newCaption = Caption.replace(patt,win.g610.et1.text.toString());
  if(win.g620.cb3.value)  newCaption = newCaption.replace(/["'\(\)]/g, "");
  md.description='';
  md.description = newCaption;
}

If you still don't know how to use it let me know ;)

361 Messages

 • 

6.9K Points

3 years ago

In that case please remove lines 7 to 12
///////////////////////
var ver = app.version.match(/^\d/);
if (ver != 5){
g = win.graphics;
var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]);
g.backgroundColor = myBrush;
}
////////////////////////////
As some versions do not like setting the color. This should fix the problem.

14 Messages

 • 

230 Points

3 years ago

I did but it did not help. I removed the lines using the notepad. Restarted the Bridge but did not help.
Edit: Actually that is not what happened. What happened is that Bridge did not load the new script. It came up with an error saying that "too many braces" and something about line 176.
Another edit: It is all good now. I did not remove line 12. 7-12 is 6 lines, not 5. Thank you again!!!!

14 Messages

 • 

230 Points

3 years ago

Ok. So the first problem is fixed. But the second problem is still there. I think it only happens when there are "multiple values" in the same field if many photos are selected. After running Find and Replace script the field completely disappears. I need to restart the Bridge to get it back. Take a look, Description field is gone.

361 Messages

 • 

6.9K Points

3 years ago

Have you tried to do a "Purge cache for selection" as sometimes the cache does not get updated for some reason.

14 Messages

 • 

230 Points

3 years ago

Nope, I don't know where it is. Under "Cache" I have options "Compact Cache Now" and "Purge all cache now" but not "Purge cache for selection".

361 Messages

 • 

6.9K Points

3 years ago

Ah, that is in the Context menu (Right Mouse Click)

361 Messages

 • 

6.9K Points

3 years ago

I have added a couple more fields...

14 Messages

 • 

230 Points

3 years ago

Thanks, it works.

14 Messages

 • 

230 Points

3 years ago

One more question if you don't mind. What does "Global" do.

361 Messages

 • 

6.9K Points

3 years ago

If you have a word more than once it will change them all, otherwise it just changes the first one it finds.
I have also added a couple more fields so please download the latest zip file.
All the best Brian.

14 Messages

 • 

230 Points

3 years ago

Are you saying that in the same field if the word repeated more than once and if Global is NOT selected it will only change the first instance?

361 Messages

 • 

6.9K Points

3 years ago

Yes.