photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: Rene Toepfer on August 15, 2023, 01:24:14 PM

Title: [2023.1.22] Setting up Metadata depending on...
Post by: Rene Toepfer on August 15, 2023, 01:24:14 PM
Is it possible to set values for tags depending on conditions? I would like to set several values in a TIFF/JPG different compared to RAW. Therefore, I am looking for a possiblity to create some IF conditions.
It should look like this:
IF FileExt=TIFF or JPG then
{File.MD.XMP::tiff\Software\Software\0}="..."

If it is possible, where do I have to set such IF condition? Datadriven collections? My assumption was Metadata template but there seems no field for this purpose.
Title: Re: [2023.1.22] Setting up Metadata depending on...
Post by: Mario on August 15, 2023, 01:33:27 PM
Metadata Templates, the Metadata Mechanic and AutoFill all allow you to set tag values bases on variables.
And this is where your condition must go.
The variable checks for a condition and returns different values for different results.
See is:Value,TV,FV,case (https://www.photools.com/help/imatch/var_basics.htm?dl=h-201) for example.

{File.Ext|is:jpg,A,B,false}

returns A for JPG files, else B.
A can be a variable, B can be another variable.
If/else constructs can be handled by nesting multiple if: expressions.

Or you use regexp:Regular Expression/g,TV,FV,case (https://www.photools.com/help/imatch/var_basics.htm?dl=h-203)  to deal with multiple file extensions and set TV and FV accordingly.
Very powerful.

{File.Ext|regexp:(jpg|tif)//!,A,B,false}

You can try your variable out comfortably in the VarToy app and then use it in one of the aforementioned tools and features.
Title: Re: [2023.1.22] Setting up Metadata depending on...
Post by: Rene Toepfer on August 15, 2023, 06:33:21 PM
The RegExp works very well (tested with VarToy). How can I set a value? I'd like to set {File.MD.XMP::tiff\Software\Software\0} depending on the file types. I have tried to set {File.MD.XMP::tiff\Software\Software\0|replace...} and {File.MD.XMP::tiff\Software\Software\0}=... but nothing works.
Where can I get information how to set a value using variables?
Title: Re: [2023.1.22] Setting up Metadata depending on...
Post by: Mario on August 15, 2023, 06:39:48 PM
You have tried to use a variable where?
Metadata Templates, for example, fill a tag like ...tiff\Software\Software from a variable.
Use the variable I have provided above and replace A an d B with whatever you want to put into tiff:Software, depending on the file format. Like any other Metadata Template:


Image3.jpg

If this is new to you, I recommend reading Metadata Templates (https://www.photools.com/help/imatch/md_templates.htm?dl=hid-1) to learn about Metadata Templates.
Title: Re: [2023.1.22] Setting up Metadata depending on...
Post by: Rene Toepfer on August 16, 2023, 10:26:23 AM
Great, it works as expected! I was not aware that I can add formulas and variables into "Dieses Tag wird gefüllt mit" field.

Addendum: For Copyright year I already use a formula within Metadata template... Sometimes "Not seeing the wood for the trees".

BTW, VarToy is great!