Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Viewing keywords for Illustrator files

New Here ,
Sep 07, 2011 Sep 07, 2011

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.

TOPICS
Scripting
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Mentor ,
Sep 07, 2011 Sep 07, 2011

You have posted both here in the Illustrator Scripting forum & in the Bridge Scripting forum yet you are using neither of these apps to write your file EXIF… I would suspect that it is due the the XMP namespaces and their schema… Some sharing the same bags of data… Bridge should be able to access the XMP metadata for all your file types AI & PS but you would need to do this with ExtendScript… You would need to contact Phil about problems relating to exiftool… I have the feeling its developed for use with most 'image' formats…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 17, 2011 Oct 17, 2011
LATEST

It turns out that keywords in an Illustrator file are indeed stored under the "Subject" field. I reworked the script, creating a separate lane of traffic for Illustrator files. I need to keyword my images using  data from an ever-changing Filemaker database, so ExtendScript didn't seem like the right tool. I suppose I could have exported my keywords to a csv and read that within Bridge, but I am trying to make a one-stop shop folder action that will add metadata and copy images onto the correct folders on the file server in one fell swoop. Admittedly, my ExtendScript is pretty sub-par and I was on a deadline. Anyway, here's a nice little scriptlet that will add keywords to an .ai or .tif that are readable in bridge.

--* IMAGE METADATA* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

-- 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

--separate line of traffic for .ai files

--requires the exif tool, available at http://www.sno.phy.queensu.ca/~phil/exiftool/index.html

on TagThisImage(thisImage, theseKeywords)

    --set hfs to POSIX file thisImage

   

    set hfs to (POSIX file thisImage) as Unicode text

    --log hfs

    tell application "Finder"

        set myfiletype to kind of alias hfs as string

    end tell

   

    set quotedImage to quoted form of thisImage

    --for testing- shows all info about an image

    do shell script "exiftool -a -g1 " & quotedImage

   

    if (myfiletype is "Adobe Illustrator Document") then

       

        --get the keywords that are already in the image

        set ImageKeywords to (do shell script "exiftool -Subject " & quotedImage)

        --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 & ¬

                " -Subject+=" & "\"" & item j of theseKeywords & "\""

        end repeat

       

        do shell script "exiftool -Subject= " & quotedImage

        set myShellScript to "exiftool " & keywordslist & " " & quotedImage

        set output to do shell script myShellScript

    else --its a tif

       

        --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

    end if

    try

        do shell script "rm " & quoted form of (thisImage & "_original")

    end try

end TagThisImage

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines