title: Add custo IPTC Keywords to jpg using Automator & exiftools
body: <p>I have searched my <em>*</em> off but couldn't find anything that made sense to me.</p>
  
  <p>I would like to select jpgs in the Finder and use the services option in the context menu to attach a keyword to the images.
  I use Automator to ask for the Keywords and store it in a variable.</p>
  
  <p>Next thing would be to use a shell script with exiftool to attach the keyword.</p>
  
  <p>Problem is to write a shell script that works with those two variables (one of them is an array of course containing the file names)</p>
  
  <p>I have found one very interesting blog entry:
  <a href="http://coreygilmore.com/blog/2010/05/07/passing-multiple-automator-variables-to-a-shell-script/" rel="nofollow">http://coreygilmore.com/blog/2010/05/07/passing-multiple-automator-variables-to-a-shell-script/</a></p>
  
  <p>but I find Shell code too confusing to do this:    </p>
  
  <p>for everyFile<br>
  exiftool IPTC:Keywords+="$MyKeywordsString" $file</p>
  
  <p>Please help me!
  I guess Applescript would work too but I don't know how to write it either…</p>
  
  <p>Thanks in advance!</p>
  
  <p>@shellter:
  It didn't work, here is my Terminal output:</p>
  
  <pre><code>Last login: Thu Jul 28 19:57:54 on ttys000
  localhost:~ benjamin$ echo $PATH
  /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
  localhost:~ benjamin$ export Keywords=testKeyword
  localhost:~ benjamin$ echo $Keywords
  testKeyword
  localhost:~ benjamin$ /Users/benjamin/Desktop/myKeyWords.sh /Users/benjamin/Desktop/image.jpg /Users/benjamin/Desktop/image2.jpg 
  /Users/benjamin/Desktop/myKeyWords.sh: line 1: $: command not found
  File not found: Keywords=
  ======== /Users/benjamin/Desktop/image.jpg
  ExifTool Version Number         : 8.61
  File Name                       : image.jpg
  Directory                       : /Users/benjamin/Desktop
  File Size                       : 128 kB
  File Modification Date/Time     : 2011:07:27 10:41:49+02:00
  File Permissions                : rw-r--r--
  File Type                       : JPEG
  MIME Type                       : image/jpeg
  JFIF Version                    : 1.01
  Resolution Unit                 : None
  X Resolution                    : 1
  Y Resolution                    : 1
  Current IPTC Digest             : c76c591fd016b068e1b44202c9f1996c
  Keywords                        : MeinNeuerTag, MeinNeuerTag
  Application Record Version      : 4
  Comment                         : CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90.
  XMP Toolkit                     : XMP Core 4.4.0
  Image Width                     : 600
  Image Height                    : 601
  Encoding Process                : Baseline DCT, Huffman coding
  Bits Per Sample                 : 8
  Color Components                : 3
  Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
  Image Size                      : 600x601
      1 image files read
      1 files could not be read
  </code></pre>
  
  <p>Why does it treat Keywords as a file??
  And where do I have to put the script to just type "script argument argument" instead of the path? Sorry I don't know anything about the stuff my Terminal echoed when I typed in "echo $PATH" maybe you can help me with that.</p>
  
  <p>Thank you again! Much appreciated!</p>