add URL to Contact

How do I add a URL to a Contact card in Contact Application?

Extracted from. http://www.mactech.com/articles/mactech/Vol.21/21.10/ScriptingAddressBook/index.html

Adding URL’s

The method for adding a URL to a person is generally the same as that for adding an email address. The following example code demonstrates how to add a work URL to a specified person in Address Book.

make new url at end of urls of thePerson with properties
{label:“Work”, value:“http://www.automatedworkflows.com”}

This method doesn’t seem to work in my script?

tell application "Contacts"
	set thePerson to selection as specifier
	tell thePerson
		make new url with properties {label:"Work", value:"http://www.automatedworkflows.com"}
	end tell
end tell

The script complete, but no URL is shown updated in the Contact card.

Hi,

to display the update immediately you have to save the address book explicitly.
This is a more reliable version to handle the selection


tell application "Contacts"
	set sel to selection
	if sel is not {} then
		set thePerson to item 1 of sel
		tell thePerson
			make new url with properties {label:"Work", value:"http://www.automatedworkflows.com"}
		end tell
	end if
	save
end tell