Using program output to set Tag Values

Started by BonanzaMan, February 06, 2011, 12:23:12 PM

Previous topic - Next topic

BonanzaMan

I have a DOS application that provides the moon phase as a string given a date as a command line argument.

I would like to use the application to set tag values in a .jpg file ie.

exiftool -MoonPhase=[moon 09/21/2010] file.jpg

where [moon 09/21/2010] is a DOS exe that returns the moon phase as a string for the provided date.  Further, the argument that I'd like to pass to moon is a exiftool provided value, ie. exiftool -CreateDate.

I am sure that there is an obvious way to do this, but I can't seem to figure it out reading the FAQs or documentation... not much of a command lind guy - thanks for the help.

Greg

Phil Harvey

Hi Greg,

This is simple in Mac/Unix, where it can be done with a script like this:

date=`exiftool -datetimeoriginal -s -S $1`
exiftool -moonphase=`moon $date` $1


But it doesn't seem to be so simple (or obvious) in DOS.  I'm not a Windows/DOS batch file expert, but it seems like this is possible, although alot more difficult, and involves using "for /f" in a BAT file.  I found a number of references by searching for "backticks in DOS".

Good luck.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).