How to retrieve URL information of contact in Address Book

I recently used Address Book Sync to update my address book with information from my contacts on facebook. The problem with this is it would only update the image and adds their facebook URL. I would like to write an applescript that finds their URL, loads that URL in safari, clicks the send message, and then asks that particular contact for their contact information, sends the message, and then moves onto the next contact.

I am fairly certain I will be able to accomplish this but I seem to be having issues with Address Book. I have used the applescript dictionary for iTunes in the past, and I understood that… For some reason I am unable to follow the Address Book dictionary.

Address Book Sync created a custom URL field called Facebook, but all of my contacts only have one URL. This is what I have so far.

set listURL to {}
set listName to {}
tell application "Address Book"
	set thePeople to selection
	repeat with aPerson in thePeople
		set currentURL to the url of aPerson
set currentName to the Name of aPerson
		set end of listURL to currentURL
set end of listName to currentName
	end repeat
end tell

Hi,

url in AddressBook is an element, that means, one person can have multiple URL.
an URL contains the properties class, id, label and value.

To get the literal URL string, write


.
set currentURL to value of url 1 of aPerson
.

Thanks Stefan!

Another question that doesn’t warrant another thread:

If I use automator I can get the list of people. I would like however this to be purely applescript. How can I set the selection in applescript?

This isn’t very important, so if no one answers I will have to just put my thinking cap on.

+edit

see thinking cap =)

repeat with aPerson in people