Address Book script not working with Snow Leopard

I have an Address Book script which worked perfectly in Leopard but one part is not working under Snow Leopard. Grateful if knows if anything has changed in Snow Leopard and how to correct it.

The script will search for address book entries with the same company name as the current selected entry and put a URL to link to the company entry. This allows me to have multiple people from a company but not repeat the company address every time because I can just click on the URL to see the company details.

Everything is working fine except that the script no longer creates the URL entry (see “make new url…” in last few lines of the script). I’ve proven that the script is getting to the relevant code by inserting “display dialogs” before and after the “make new url…” command.

Help to get this working again would be most appreciated.

Full script code below:

using terms from application "Address Book"
	-- Link action to the address property
	on action property
		return "address"
	end action property
	-- Set message to be displayed on click on address
	on action title for p with e
		if (company of p) then
			error number -128
			if (organization of p) is missing value then
				error number -128
				set textMessage to "Look up entry for " & (organization of p)
			end if
		end if
		return textMessage
	end action title
	-- Enable action
	on should enable action for p with e
		return true
	end should enable action
	-- Action when clicked
	on perform action for p with e
		-- Find if any company entries with same company name
		set listCompany to (every person whose organization starts with organization of p ¬
			and company is true ¬
			and name ≠ name of p)
		set lengthList to length of listCompany
		-- If no matching entries, display dialog
		if lengthList = 0 then
			display dialog "No entries found for " & organization of p ¬
				buttons {"OK"} cancel button {"OK"}
			-- If only one matching entry, set company ID to that entry
			if lengthList = 1 then
				set companyID to id of item 1 of listCompany
				-- If more than one entry, get list, select required entry & then
				-- set company ID to selected entry
				if lengthList > 1 then
					set listCompanyName to {}
					-- Set entries to company name & city to make selection easier
					repeat with oneCompany in listCompany
						set end of listCompanyName to name of oneCompany & ", " & ¬
							city of first address of oneCompany
					end repeat
					-- Select company
					set selectedCompany to choose from list listCompanyName with prompt ¬
						"Select company to link" without empty selection allowed
					-- Loop through list to get selected company & id for URL
					repeat with i from 1 to lengthList
						if item i of listCompanyName as string = selectedCompany as string then
							set companyID to id of item i of listCompany
							exit repeat
						end if
					end repeat
				end if
			end if
		end if
		-- Create the URL for the link to the company
		make new url at end of urls of p with properties ¬
			{label:"company", value:"addressbook://" & companyID}
	end perform action
end using terms from