User defined - two values in one column

Started by pedro22, February 02, 2017, 12:04:44 PM

Previous topic - Next topic

pedro22

Is it possible to use two values in one column, but not the same time - I have a column Quality and wants to use -PhotoshopQuality and -Quality that is, if there is no value PhotoshopQuality let it display Ducky quality.

Phil Harvey

Yes.  You can do this by creating a user-defined Composite tag which is based on PhotoshopQuality and Quality.  The ValueConv for this tag would be simple:

    ValueConv => '$val[0] || $val[1]',

See the sample config file for documentation and examples of user-defined tags.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedro22

Thanks Phil - but not what I continue to do with it, insert this file into the folder ExifToolGUI?

pedro22

Can anyone help me - I really do not like to use it, still learning ExifTool.

Phil Harvey

Did you read the instructions starting with "To activate this file,..." in the comments of the sample config file I linked?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedro22

OK, I changed the name to ".ExifTool_config" and put the file in the folder ExifTool - what next?

Phil Harvey

You're supposed to put it in your home directory.

Then edit the file to add a definition like this to the Composite tags section:

        MyQuality => {
            Require => {
                0 => 'PhotoshopQuality',
                1 => 'Quality',
            },
            ValueConv => '$val[0] || $val[0]',
        },


Then use "MyQuality" in ExifToolGUI.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedro22

Unfortunately, it does not work - I put the file ".ExifTool_config" in the C:\Windows and changed a sample entry to the specified by you. Then in ExifToolGUI I entered "MyQuality" or "-MyQuality" without the quotes, and does not work.

Phil Harvey

Not in C:\Windows.  I said in your home directory.  (Something like "C:\Documents and Settings\USERNAME" or something, depending on what Windows version you are running.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedro22

#9
It also does not work - I put the file in "C:\Documents and Settings\Michał"

Phil Harvey

OK.  Try this from the command line to see what happens and if it gives any errors:

exiftool -myquality -quality -photoshopquality FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedro22

Done:

C:\Documents and Settings\Michał>exiftool -myquality -quality -photoshopquality
"C:\Documents and Settings\Michał\Moje dokumenty\Moje obrazy\351001.jpg"
Unterminated <> operator at C:\Documents and Settings\Micha│/.ExifTool_config li
ne 347.
Photoshop Quality               : 6

C:\Documents and Settings\Michał>exiftool -myquality -quality -photoshopquality
"C:\Documents and Settings\Michał\Moje dokumenty\Pobieranie\lol012IGD_145316017.
jpg"
Unterminated <> operator at C:\Documents and Settings\Micha│/.ExifTool_config li
ne 347.
Quality                         : 66%

Phil Harvey

Ah.  You had this at the bottom on the file:

<-- Back to ExifTool home page

The attached config file should work for you (I also fixed an error of mine: "Require" should have been "Desire" for the new tag).

(Note: you'll have to rename the config file to ".ExifTool_config" -- also, remove any old versions you have lying around in C:\Windows, etc)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedro22

I noticed a difference in the codes that you provided:

1.    ValueConv => '$val[0] || $val[1]',
2.MyQuality => {
            Require => {
                0 => 'PhotoshopQuality',
                1 => 'Quality',
            },
            ValueConv => '$val[0] || $val[0]',
        },

perhaps by it does not work?

Phil Harvey

Oops.  You're right.  Here is a fixed version.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).