Image-ExifTool - Re: How to do a compound IF statement

Posted on Thu Dec 20 14:20:18 2007 by exiftool in response to 6731 (See the whole thread of 3)
Re: How to do a compound IF statement
The way to do this is with user-defined tags. Doing this with an argfile is clumsy and inefficent. Here is the Composite tag definition:

GoodDateTimeOriginal => { Require => { 0 => 'DateTimeOriginal', 1 => 'CreateDate', 2 => 'ModifyDate', 3 => 'FileModifyDate', }, ValueConv => q{ return undef if $val[0] and $val[0] =~ /^[12]/; return $val[1] if $val[1] and $val[1] =~ /^[12]/; return $val[2] if $val[2] and $val[2] =~ /^[12]/; return $val[3]; }, },

You would define a similar tag for each of the other date tags you want to set, then use arguments like this to do the work:

"-datetimeoriginal<gooddatetimeoriginal"

This will not change datetimeoriginal if the value is OK, and will set it to createdate or modifydate if they are OK, otherwise it will set it to filemodifydate.

- Phil
Write a response