ExifTool Forum

ExifTool => Developers => Topic started by: herb on October 20, 2023, 07:13:43 AM

Title: composite tag with flag 'avoid'
Post by: herb on October 20, 2023, 07:13:43 AM
Hello Phil,

I have a short question:
Is it possible to create a user-defined composite tag and also to assign flag: avoid => 1

I want to create a composite tags that
- is only used together with an user-param and
- only within an -if condition on command-line.
So I thought this tag need not be created e.g. for display of all tags with -all:all

To define the tag is not a problem, but to assign flag
- avoid => 1
does not seem to work

Thank for your help
Best regards
herb 
Title: Re: composite tag with flag 'avoid'
Post by: StarGeek on October 20, 2023, 11:00:08 AM
The Avoid setting on a tag just means it should not be written to unless it is explicitly set on the command line.

This post (https://exiftool.org/forum/index.php?topic=11944.msg64529#msg64529) tells how to avoid generating a tag unless it is called for.  But I don't think calling for it in an -if is enough, I haven't tested for that. Phil could verify one way or the other.

The -api RequestTags option (https://exiftool.org/ExifTool.html#RequestTags) would probably be the solution if true.


Edit: Realized that I could easily check, as I have several tags set to generate only if called.  Placing them in the -if expression is enough.

For example, I have a tag called MyMissingTags, which checks if my metadata is filled out correctly and lists the tags I still need to fix.  It is set to be generated only if called. 
Example output:
C:\>exiftool -G1 -a -s -if "$MyMissingTags" -filename y:\!temp\Test4.jpg
[System]        FileName                        : Test4.jpg
Title: Re: composite tag with flag 'avoid'
Post by: Phil Harvey on October 20, 2023, 11:18:53 AM
Composite tags generally aren't writable anyway (unless you are using the WriteAlso feature), so the Avoid flag wouldn't have an effect.

StarGeek's suggestion may do what you want.  Putting a tag in a -if condition should automatically add it to the RequestTags list.

- Phil

Edit:  StarGeek did some Ninja-editing while I was typing my response. :P
Title: Re: composite tag with flag 'avoid'
Post by: herb on October 22, 2023, 08:40:53 AM
Hello StarGeek, hello Phil,

thanks for your help.

Best regards
herb