10.3: A script to copy iChat buddy icons to Address Book

Nov 05, '03 09:34:00AM

Contributed by: antonichan

Your iChat buddies can set up their own picture icons in iChat, but unfortunately these icons do not appear in your Address Book. To solve this problem, I wrote an Applescript that copies the buddy pictures in iChat into their corresponding entries in Address Book. Here's the Applescript code:


tell application "iChat"
 set modifiedList to {}
 set modifiedListRef to a reference to modifiedList
 repeat with curAccount from 1 to number of items in accounts
   set nameVar to the name of account curAccount
   if exists image of account nameVar then
     set theImage to the image of account nameVar
     tell application "Address Book"
       -- don't overwrite my own picture
       if ¬
       (last name of my card is not equal to last name of person nameVar) ¬
       or ¬
       (first name of my card is not equal to first name of person nameVar) ¬
       then
         set image of person nameVar to theImage
         copy nameVar to end of modifiedListRef
       end if
     end tell
   end if
 end repeat
 -- output the list of modified entries
 set AppleScript's text item delimiters to {", "}
 display dialog "The following entries were modified: " & modifiedList
end tell
Cut and paste the above into Script Editor, and then run it to copy the iChat pictures into Address Book. The pictures will now appear in Mail.app too! Huge!

Note: The script won't copy your own buddy icon into Address Book.

Comments (15)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031031034212734