Hi,
I try to modify xmp files if they have a spezial keyword with this command
exiftool -if "$Subject eq 'Vermerk, Defekt'" "-$xmp-onone:UserFlag+=3" _rr_3117.xmp -overwrite_original
but I receive: Warning: Tag '$XMP-onone:UserFlag' is not defined. And its not true, because
exiftool -a -s -G1 _rr_3117.xmp give me
[XMP-tiff] Model : Canon EOS 5D Mark III
[XMP-tiff] Orientation : Horizontal (normal)
[XMP-onone] UserFlag : 2
Any Idea what I can do?
Robert
The tag not defined warning means that exiftool doesn't know the schema for how that tag is to be written. It can read it and output the data easily enough due to the way XMP tags work, but without a definition on how to write the tag, it can't do so.
If you want to write that tag, you'll have to create a User-Defined Tag. See the example config file (https://exiftool.org/config.html) for instructions on how to do so.
Thanks for the answer. I think I did not understand the description completely or wrongly.
I downloaded the sample.config and changed some lines
# new XMP namespaces (eg. xxx) must be added to the Main XMP table:
'Image::ExifTool::XMP::Main' => {
# namespace definition for examples 8 to 11
## xxx => { # <-- must be the same as the NAMESPACE prefix
onone => { # <-- must be the same as the NAMESPACE prefix
SubDirectory => {
## TagTable => 'Image::ExifTool::UserDefined::xxx',
TagTable => 'Image::ExifTool::UserDefined::onone',
# (see the definition of this table below)
},
},
## %Image::ExifTool::UserDefined::xxx = (
%Image::ExifTool::UserDefined::onone = (
## GROUPS => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' },
GROUPS => { 0 => 'XMP', 1 => 'XMP-onone', 2 => 'Image' },
## NAMESPACE => { 'xxx' => 'http://ns.myname.com/xxx/1.0/' },
NAMESPACE => { 'onone' => 'http://www.ononesoftware.com/vcb/1.0/' },
WRITABLE => 'string', # (default to string-type tags)
# Example 8. XMP-xxx:NewXMPxxxTag1 (an alternate-language tag)
# - replace "NewXMPxxxTag1" with your own tag name (eg. "MyTag")
## NewXMPxxxTag1 => { Writable => 'lang-alt' },
UserFlag => { Writable => 'lang-alt' },
nothing else, but it will not work :(
You config file looks OK to me.
What was the command you used and what was the config file named and where was it located?
See FAQ 11 (https://exiftool.org/faq.html#Q11) for some tips.
- Phil
Hi Phil,
exiftool -config onone.config -m -f -if "$Subject eq 'Vermerk, Defekt'" "-$XMP-onone:UserFlag+=3" _rr_3117.xmp -overwrite_original
Warning: Tag '$XMP-onone:UserFlag' is not defined
config file is saved in same directory as the XMP file
Ah. That's the problem.
Try this:
exiftool -config onone.config -m -f -if "$Subject eq 'Vermerk, Defekt'" "-XMP-onone:UserFlag+=3" _rr_3117.xmp -overwrite_original
You shouldn't have a "$" before the tag name -- that is just used when interpolating tags within a -if condition, etc.
But note that you have used += on a non-list tag. So in this case it will be an interger increment, and will only have an effect if UserFlag already exists and is an integer.
- Phil
Thank you Phil,
[EDIT]
All works perfect !!!
[/EDIT]
its work now but not I want
This is my command
exiftool -config onone.config -m -f -if "$Subject eq 'Vermerk, Defekt'" "-XMP-onone:UserFlag=3" _rr_3117.xmp -overwrite_original
This writes exiftool
<rdf:Description rdf:about=''
xmlns:onone='http://www.ononesoftware.com/vcb/1.0/'>
<onone:UserFlag>
<rdf:Alt>
<rdf:li xml:lang='x-default'>3</rdf:li>
</rdf:Alt>
</onone:UserFlag>
</rdf:Description>
But I need this
<onone:UserFlag>3</onone:UserFlag>