[Originally posted by heiko on 2007-11-29 16:01:52-08]
Hello,
I'm trying to fill my Exif UserComment with IPTC values. Therefore I'm starting ExifTool with the following command line within a .BAT file:
ExifTool.exe -P -m -L "-UserComment<$IPTC:Country-PrimaryLocationName $IPTC:City $IPTC:Caption-Abstract" *.jpg
The result in the UserComment is:
Country City Caption
How can I inclue a linefeed between the single values, so that each value is among eatch other?
Any idea?
Regards
Heiko
[Originally posted by exiftool on 2007-11-29 17:52:06-08]Hi Heiko,
This is a command-line problem, and is a bit tricky.
In Unix you can insert linefeeds in a command by putting "\" at
the end of a line, then continuing on the next one. But I doubt
this will work in Windows. There may be a different way to do
it in Windows, but I'm not a Windows expert and don't know how.
It would also be possible to write a simple Perl script to call the
ExifTool functions since linefeeds are easy to insert into strings
in Perl, but this can't be done with the Windows executable.
Another option would be do this in a 2-step process where you
use the
-p option to output the tags in the exact format
you want to a second file, then use "-UserComment<=FILE" to
set the UserComment from the contents of this file. The
-pformat file could look like this:
$IPTC:Country-PrimaryLocationName
$IPTC:City
$IPTC:Caption-Abstract
This isn't very convenient, but will do what you want.
Note that
if you get this working you will also have trouble using exiftool
to extract the values with linefeeds because by default all control
characters are translated to '.' on output. The usual work-around
is to use
-b to extract the value, but you can't do this here
because the binary value of UserComment isn't a simple string.
- Phil
[Originally posted by exiftool on 2007-11-29 18:03:31-08]One more thing. In Unix the 2-stage process can be performed on a single
command line without the need for a temporary file. Something like this may
also work in Windows, but again I'm no expert there. In Unix, the command
would be:
exiftool a.jpg -p p.fmt | exiftool -usercomment"<=-" FILE
where "p.fmt" is the file listed in my previous post.
- Phil
[Originally posted by heiko on 2007-11-30 08:19:07-08]
Hello Phil,
thank you for your answer, and I will try your suggestions. And you are right, this should run with Windows. I hoped, that I can use a single sign for the linefeed, because my excample was only the half of the what I want to do.
in the commandline are also settings like this:
"-UserComment<$UserComment Heiko" -if "$Keywords=~/Heiko/"
Heiko
[Originally posted by exiftool on 2007-11-30 12:49:40-08]
OK Heiko,
I have come up with a solution. In the next release (6.04) I will add
the ability to insert a newline into the expression using "$/". This
version should be released in about a week or so.
- Phil
[Originally posted by heiko on 2007-12-03 07:22:50-08]
Hi Phil,
that's great. Thank you very much.
Heiko