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


Click here to return to the '10.3: A script to copy iChat buddy icons to Address Book' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: A script to copy iChat buddy icons to Address Book
Authored by: jstrope on Nov 05, '03 10:12:36PM
At first I was getting the same errors that others were getting, but I realized that it happens when you have iChat buddies that do not have correspnding address book cards. I had a bunch from Buddies that I had added years ago using AOL IM. To track it down I deleted the checking for myself code (since I wanted it to add my icon) and inserted a new line to display a dialog of what entry it was working on. My final edited code looked like this:

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"
				display dialog nameVar
				set image of person nameVar to theImage
				copy nameVar to end of modifiedListRef
				
			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
NOTE that I removed the code that checked for your own name/card, but it did not replace my image anyway... You will be prompted with a dialog box after every entry that it wants to make, so if you have a large buddy list it could take a while to click through them all :) But at least this way you will know which name the script is busting out on and can then create an address card for the offending name (by control or right-clicking on the buddy name in question, and Get Info. From there you can create a card and re-run the script. Of course, you could eliminate all of this just by making sure all of your buddies in iChat have an address card. Hopefully that helps some others who want to import their pics into Address Book.

[ Reply to This | # ]
10.3: A script to copy iChat buddy icons to Address Book
Authored by: antonichan on Nov 05, '03 10:52:12PM
You can also add an "if" clause at the beginning of the "tell application Address Book" block. It will look something like this:

...
tell application "Address Book"
	if person nameVar exists then
		...
	end if
end tell
...


[ Reply to This | # ]