Find replace text in title and description tags

Started by kakakhan, November 01, 2014, 01:44:43 PM

Previous topic - Next topic

kakakhan

Hi

I have images in which tag objectname (which is shown in abobe bridge as Title) have word drawing. I want to replace word drawing with word illustration. After reading forum and documentation, I come to know that it can be possible using config file. I have create my own config file in notepad namely findreplace and place following in it

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        nkDesc => {             
            Require => 'Caption-Abstract',
            ValueConv => q{ $val=~s/drawing/illustration/g ? $val : undef },
        },
    },
);

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        nkTitle => {             
            Require => 'ObjectName',
            ValueConv => q{ $val=~s/drawing/illustration/g ? $val : undef },
        },
    },
);


For changing descirption I use command
exiftool -config findreplace "-Caption-Abstract<nkDesc" pic.jpg

For changing title I use command
exiftool -config findreplace "-ObjectName<nkTitle" pic.jpg

Above two userDefine tag can't work if both are in same config file. But individually they work fine. I have also appended these above in default
.ExifTool_config and encounter same problem. I did'nt figure out, what I am missing.

Thanks for such great and powerful tool.

Kaka

Hayo Baan

The one statement overrides the other, you need to properly combine them like so:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        nkDesc => {             
            Require => 'Caption-Abstract',
            ValueConv => q{ $val=~s/drawing/illustration/g ? $val : undef },
        },
        nkTitle => {             
            Require => 'ObjectName',
            ValueConv => q{ $val=~s/drawing/illustration/g ? $val : undef },
        },
    },
);
Hayo Baan – Photography
Web: www.hayobaan.nl

kakakhan

Bravo Hayo Baan. Thank a lot for your prompt help. Highly appreciated. It's working great. 

StarGeek

Quote from: kakakhan on November 01, 2014, 01:44:43 PM
I have images in which tag objectname (which is shown in abobe bridge as Title) have word drawing. I want to replace word drawing with word illustration. After reading forum and documentation, I come to know that it can be possible using config file.


You can also used the advanced formatting option and skip the config file altogether.  This command will do the substitution on both items at once without a config file.

ExifTool -if "$ObjectName=~/drawing/ or $Caption-Abstract=~/drawing/" "-ObjectName<${ObjectName;s/drawing/illustration/g}" "-Caption-Abstract<${Caption-Abstract;s/drawing/illustration/g}" <FILE/DIR>
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

kakakhan

Quote
You can also used the advanced formatting option and skip the config file altogether.  This command will do the substitution on both items at once without a config file.

ExifTool -if "$ObjectName=~/drawing/ or $Caption-Abstract=~/drawing/" "-ObjectName<${ObjectName;s/drawing/illustration/g}" "-Caption-Abstract<${Caption-Abstract;s/drawing/illustration/g}" <FILE/DIR>

WOW. One exiftool tool command without any config, which is also using if condition. Amazing man. Working perfectly. Many thanks for all quick reply. You are really star ;-)