Address Book - print custom mailing labels in Address Book

Print custom mailing labels in Address Book
Address Book’s label print feature is a great one step way to print out labels for things like Christmas cards and newsletters but it has one fatal flaw: you can’t edit the way it prints the names of the recepients. This script allows you to print whatever you want in the name field of the printed contact label (such as Dr. Brian Smith and Mrs. Sue Jones) which is impossible in the current version of Address Book (4.04).

Backup before running the script
This is VERY important. Remember to back up your Address Book Database right before running the script by choosing ‘File: Backup Address Book’. You need this backup for two reasons: in case anything goes wrong, and once you finish the script you must revert to Address Book Backup to use the address book with the original data in it (because once the script finishes, the data in the Title, Middle, First and Last names fields are deleted).

How it works and what to do
Create a custom user field in each of your address book entries called ‘Mailing Label’, by adding a new ‘relationship’ field (the list of things like father, mother, assistant… etc.) and choosing ‘Custom’, and then typing in ‘Mailing Label’ for the name of this custom field. In the newly created custom user field named ‘Mailing Label’ type the desired field data such as “Dr. Brian Smith and Mrs. Sue Jones”. After finishing adding the ‘Mailing Label’ field data to the contacts you want to send custom labels to, Back up the Address Book (as described above: by choosing ‘File: Backup Address Book’). After backing up your data, in Address Book select the contacts you want to print labels for. Open Script Editor and copy and paste the script below. Press the ‘Run’ button. After the script runs (it takes a bit of time), you can then choose to print the labels using the ‘File:Print’ command in Address Book, then choosing Style: Mailing Labels in the top right of the window. Once your labels are printed, revert back to the Address Book Backup that you created by choosing the ‘File: Revert to Address Book Backup’ command in Address Book. Assuming you backed up right before you ran the script, you now have your original data back with the Mailing Labels also there as well.

Notes:
You will have to (1)backup your Address Book database, (2) run this script, and (3)revert to your Address Book Backup everytime you want to print custom labels.

The “Mailing Label” name is just the name I choose for my custom field, but you can use any name assuming that you change the script below and have a custom field of the same name.

I am not responsible if this script hoses your data. I am providing this as my best attempt to try to help others overcome the shortcomings of Address Book. If you didn’t back up your data and something goes wrong, it is your own fault. :slight_smile:

If anyone wants to improve this script, have at it! One idea would be to print the labels in Address Book directly from this script, and then once they print, to revert back to previous data that was in the first, middle and last name and title fields (maybe held in temporary variables? although this would be very memory intensive?).

Enjoy!
Patrick

tell application "Address Book"
	set mylist to selection
	repeat with thisperson in mylist
		if ((related names whose label is "Mailing Label") of thisperson) exists then
			set ML_name to ((value of related names whose label is "Mailing Label") of thisperson) as Unicode text
			set first name of thisperson to ML_name
			delete middle name of thisperson
			delete last name of thisperson
			delete title of thisperson
		end if
	end repeat
end tell