[2023.1.22] Setting up Metadata depending on...

Started by Rene Toepfer, August 15, 2023, 01:24:14 PM

Previous topic - Next topic

Rene Toepfer

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.

Mario

#1
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 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  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.

Rene Toepfer

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?

Mario

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 to learn about Metadata Templates.

Rene Toepfer

#4
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!