Global find and replace on Exif Data

Dear Forum,
Is it possible to do a global find and replace on the "Title" field of jpg files? I have some additional info I want to add to a group of files (same for each file) without losing the existing data that is different from file to file.
I guess ideally I am looking for something like the file rename features applied to other columns of the lister.

I have tried to create a button to do the update to the exif data.
See screenshots below.

A few things to note here:
The @set seems to pick up literal text not the intended command.
The SetAttr META title: does not seem to strip the inverted comers correctly.
It would be great if someone could point me in the right direction.

For this kind of string manipulation you'll need a script.

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var tab = clickData.func.sourcetab;
    cmd.deselect = false;

    for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
        var item = e.item();
        var itemMeta = item.metadata;
        if (itemMeta != 'image') continue;
        var itemTitle = itemMeta.image.title;
        if (typeof itemTitle == 'undefined') itemTitle = '';
        itemTitle += 'text to add';
        cmd.RunCommand('SetAttr FILE="' + item + '" META "title:' + itemTitle + '"');

Update Image Title.dcf (1.3 KB)


Thanks lxp. I'll have a play with your script and see how I go.

Thanks again lxp for taking the time to help me. That has got me started and on to where I needed to go.
Have a good one! :slightly_smiling_face:


This script I've just uploaded may be of use to you: Image Meta

1 Like

Wow! that looks to be a great tool. Many thanks. I'll check it out.
Yes will be very useful. Thanks. Programmers rock!

1 Like