Viewing keywords for Illustrator files
I posted this into the Bridge scripting forum as well, but maybe someone over here has thoughts.
Hey folks,
I have been using this applescript to add keywords to a .tif file, and I want to expand the workflow to include Illustrator files. Problem is, the keywords that the script adds to an Illustrator file are not visible in Bridge! If I call up the exif metadata, the Keywords field contains the correct information, but any keywords I've added in Bridge are located under the "Subject" and "Heirarchical Subject" fields. I'd assumed that .ai files' metadata was organized in the same way as a .tif file, but that doesn't appear to be the case. Thoughts?
--* IMAGE TAGGING* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-- takes a list of keywords and a POSIX path to an image. Then it appends the EXIF keywords to the image
--it also eliminates duplicate keywords
--requires the exif tool, available at http://www.sno.phy.queensu.ca/~phil/exiftool/index.html
on TagThisImage(thisImage, theseKeywords)
set quotedImage to quoted form of thisImage
--for testing- shows all info about an image
do shell script "exiftool -a -u -g1 " & quotedImage
--get the keywords that are already in the image
set ImageKeywords to (do shell script "exiftool -keywords " & quotedImage)
log "Image Keywords " & ImageKeywords
--split these keywords into a list, remove the "Keywords:" from the beginning
if ImageKeywords is not equal to "" then
set myOldDelimeters to AppleScript's text item delimiters
set text item delimiters to ", "
set ImageKeywords to my RemoveDuplicateListItems(every text item of ImageKeywords)
set text item delimiters to myOldDelimeters
try
set (item 1 of ImageKeywords) to words 2 thru end of (item 1 of ImageKeywords)
end try
end if
--make one big list, and purge the duplicate entries
set theseKeywords to theseKeywords & ImageKeywords
set theseKeywords to my RemoveDuplicateListItems(theseKeywords)
log "Keywords I am putting in this image " & (theseKeywords as list)
set keywordslist to ""
repeat with j from 1 to the count of theseKeywords
set the keywordslist to keywordslist & ¬
" -keywords+=" & "\"" & item j of theseKeywords & "\""
end repeat
do shell script "exiftool -keywords= " & quotedImage
set myShellScript to "exiftool " & keywordslist & " " & quotedImage
set output to do shell script myShellScript
try
do shell script "rm " & quoted form of (thisImage & "_original")
end try
end TagThisImage
I should also mention that this script calls the function, RemoveDuplicateListItems() which removes any duplicate keywords.
