Add info to street address in Address Book

I’m trying to outsmart Address Book in printing mailing labels for the Holiday Card list.

If I have records with both Home & Work addresses, I can print both (for all entries) or choose to print one or the other. There is a “distribution list” option, but it refuses to print the Company name for those entries which I’ve selected a Work address.

So, to fix the problem, I want to add the company name as the first line of the street address.

I’ve got a script put together, but can’t quite get the syntax correct to update that field. I get an error of “Can’t make this_address of item 1 of every person of group "Test" into type reference.” This occurs at the “set the value” line just before the end if.

Can somebody tell me what boneheaded mistake I’ve made this time? I’ve looked at numerous code samples, but can’t find one that does something similar that works in my case.

I’m running this currently on 10.5.8 (Address Book 4.1.2).



tell application "Address Book"
	repeat with this_person in every person in group "Test"
		repeat with this_address in every address of this_person
			if label of this_address is "work" and this_address is not missing value then
				set theCO to the organization of this_person as string
				set currentWorkAddr to the street of this_address as string
				set newWorkAddr to (theCO & return & currentWorkAddr)
				set the value of street of this_address of this_person to newWorkAddr
			end if
		end repeat
	end repeat
end tell


this_address is a reference to a list item of every address, you need the reference to the person. The keyword contents dereferences the list item. this_address contains also this_person

set the value of street of contents of this_address to newWorkAddr

The missing value check and both as string coercions are not necessary


Thank you! That worked perfectly.

I should have posted here two hours ago and saved myself some time.