setting Iptc:Caption-Abstract to some text that contains part of the filename

Started by msdobrescu, March 19, 2013, 03:00:23 PM

Previous topic - Next topic

StarGeek

What version of exiftool are you using (exiftool -ver)?  I can't remember the exact version the advanced formatting was added but it has to be at least in the 9s.

I'm using a variant cmd line (PowerCmd, which I don't recommend for anyone using Win 8 or higher), but the command works fine in a regular CMD.  Powershell tries to interpret the quoted part as a variable and throws back an error before it even runs :( 
* 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).

muesli

I think you got the point. Exiftool came installed with Geosetter (maybe you know that) and within Geosetter ist says version 10.10. But your command gets me 8.47. Maybe the installation path changed and I use the old one. I will check this out tomorrow and post the result.

All the best, Müsli

StarGeek

Geosetter places a copy of exiftool in it's appdata folder (for example, under windows 8.1, it's C:\Users\<USERNAME>\AppData\Roaming\GeoSetter\tools\exiftool.exe or just %appdata%\GeoSetter\tools) (Your post got me to finally add %appdata%\GeoSetter\tools to my PATH env var so now I'll always use the version that Geosetter has installed).

You can figure out where the exiftool you're using by the windows command where:
where exiftool

* 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).

muesli

The old version which I used was in C:\Program Files (x86)\GeoSetter\tools, with the new one in %appdata% everything works fine  :)
Thank you very much for your help and patience!

Best wishes, Müsli

P.S.: Just in case someone is interested, as written in Geosetter help I put

# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    # Composite tags are added to the Composite table:
    'Image::ExifTool::Composite' => {
        # Composite tags are unique: The Require/Desire elements list
        # tags that must/may exist, and the keys of these hashes are used
        # as indices in the @val array of the ValueConv expression to
        # derive the composite tag value.  (See the Composite table in
        # Image::ExifTool::Exif for more examples.)
        BaseName => {
            Require => {
                0 => 'FileName',
            },
            # remove the extension from FileName
            ValueConv => 'my $name=$val[0]; $name=~s/\..*?$//; $name',
        },
        # the following examples demonstrate simplifications which may be
        # used if only one tag is Require'd or Desire'd:
        # 1) the Require/Desire lookup may be replaced with a simple tag name
        # 2) "$val" may be used to represent "$val[0]" in the expression
        Extension => {
            Require => 'FileName',
            ValueConv => '$val=~/\.([^.]*)$/; $1',
        },
    },
);


into the .exiftool_config and replaced filename with BaseName in StarGeek's command line to get rid of the .jpg in the caption. Probably there is a better way to do so as I am not familiar with the ExifTool commands but it works ;)

StarGeek

Quote from: muesli on February 03, 2016, 09:36:22 AM
into the .exiftool_config and replaced filename with BaseName in StarGeek's command line to get rid of the .jpg in the caption. Probably there is a better way to do so as I am not familiar with the ExifTool commands but it works ;)

Using BaseName is probably the best way.  It's easier to work with than the other way of using the advanced formatting and mistakes are less likely to happen.
* 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).