Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use AppleScripts to remake the AIM buddy list Internet
So I just switched from iChat to Adium the other day. I like Adium better; the problem is that I was stupid about groups on the AIM buddy list. iChat ignores groups; Adium does not. I wanted groups ignored, but didn't realize I could just drag everybody into one group in Adium. My solution was to write/modify a couple of AppleScripts: one to grab all of the AIM handles from Address Book and the other to populate the buddy list in AIM (using AOL's actual client), putting everyone in the same gruop.

Again, if you have the exact same problem I did, this is certainly not the best way to solve the problem -- but maybe the AppleScripts will help people out there who want a glance at how Address Book and AIM could be scripted usefully. The first script borrows much from a previous hint, and the second is a modification of a script that comes with AOL's AIM client.

Script 1: Get AIM handles from the Address Book and put them in a text file:
-- Config this to your liking
set saveExport to "/Users/me/Desktop/contacts.csv"

set resultText to ""

tell application "Address Book"
  repeat with x from 1 to the count of people
    set thePerson to person x
    if (count of AIM Handle of thePerson) > 0 then
      repeat with q from 1 to the count of AIM Handle of thePerson
        set my resultText to my resultText & 
         value of the AIM Handle [q] of thePerson & return
      end repeat
    end if
  end repeat
  my writeToFile(saveExport, saveExport as POSIX file)
end tell

-- Write a string in a file; overwites if exists
on writeToFile(theUFile, theFile)
  set touch to "touch " & theUFile
  do shell script touch
    open for access file theFile with write permission
    set eof of theFile to 0
    write (my resultText) to theFile starting at eof
    close access theFile
  on error
      close access theFile
    end try
  end try
end writeToFile
Script 2: Populate an AIM buddy list from a plain text file:
set myFile to (choose file with prompt "Select a file: ")
open for access myFile
set theFile to (read myFile)
close access myFile

tell application "AOL Instant Messenger (SM)"
  if online then
    set theGroup to group "Buddies" of buddy list
    repeat with theIndex from 1 to 198
      set theBuddyName to word theIndex of theFile
      set the clipboard to theBuddyName
      make new buddy of theGroup with data theBuddyName
      delay 0.5
    end repeat
  end if
end tell
Caveats: In the second script, each of your screen names must be one word. AIM screen names are spacing- and capitalization-independent; just remove spaces from the names. Also, if you screw around too much with your AIM buddy list, the nice people at AIM will not let you edit it for a little while, and you'll get rather cryptic errors about it for a day or so.

Hope this helps somebody.
  • Currently 2.60 / 5
  You rated: 3 / 5 (5 votes cast)

Use AppleScripts to remake the AIM buddy list | 3 comments | Create New Account
Click here to return to the 'Use AppleScripts to remake the AIM buddy list' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: peragrin on Mar 22, '05 01:01:52PM


I haven't adjusted my buddies in a long time. AIM, Yahoo, ICQ all store my contacts online. When i setup a new client, I simply log in and it retrieves those contacts.

I know Fire, Kopete(linux), gaim all support this, i haven't tried Ichat(needed more than just AIM support)but I would assume both programs you mentioned support this.

I thought once I was found but it was only a dream

[ Reply to This | # ]
Re: Why?
Authored by: robophilosopher on Mar 22, '05 03:24:44PM
As disclaimed in the hint, this is not useful as it stands. The reason I did it was that I had earlier used AIM's client, which grouped my buddies, then shifted to iChat, which ignored groups (though the groups still existed on the AIM buddy list server), then moved to Adium, which uses groups, but I wanted everyone in the same group.

The correct answer would be to drag all of the buddies into one group on Adium.

I was less than swift about this, didn't discover the correct answer until it was too late, and submit these scripts as nothing more than a few demonstrations of how to interface AppleScript with Address Book and the AIM client. Maybe someone will find a good use for it.

[ Reply to This | # ]
Use AppleScripts to remake the AIM buddy list
Authored by: noleli on Mar 22, '05 07:09:35PM

I know it's a bit late for this info, but the next version of Adium (0.8) allows you to ignore groups like iChat.

[ Reply to This | # ]