Printing Customized Lists From Contacts

OS X Contacts.app provides limited capability to customize a printed list of contacts, and, no capability to format the list.

I am searching for an AppleScript that will print a list of contacts (to PDF), from either selected contacts or from an entire group, in a predefined format, that is to be determined.

My Mac runs OS X 10.11.

Thank you.

Hi. You need to first determine the desired information then arrange it in order. The output can be saved as a text file with the write command.


set peepData to {}

tell application "Contacts" to repeat with aPerson in group (my (choose from list (get groups's name))'s item 1)'s people
	tell aPerson to set peepData's end to {(last name & "")'s text, ",", space, first name} & return --person parameters from Contacts' dictionary
end repeat
tell application "Finder" to write (peepData as text) to ((make file) as alias)

  • Edited to include removal of a potential missing last name value and to escape silent errors from the inline standard addition.

Hello, Marc.

Thank you for providing this script. Nicely done.

Does AppleScript provide for providing writing no data output, instead of writing “missing value”, if the respective field contains no data?

Does AppleScript provide for using line breaks, tabs, flush left/center/right, et al., in writing the data to the text file? (The text file contains the respective line breaks, that occur in the “Note” field.)

Does AppleScript provide for formatting the text (for example, bold for last name)?

Does AppleScript provide for sorting the data by field (for example, sort by last name)?

On a sidebar, I update and send my PDF list of three-hundred people (and growing, quickly), to each of the persons, who appear in the list, from time to time. Contacts’ built-in list template is a good starting point, however, I need to adapt it to the needs of my project, just as many people do. I used After Hours Software Touchbase Pro, as my first contact manager, nearly three decades ago. Its built-in template management capability was very robust. I miss it, a lot. I wish that Apple would add this capability to Contacts.app. I sent this suggestion, to them, a few of years ago.

Thank you.

You can pass over fields with using an if consideration, or, you can remove it by concatenating with a null string and coercing to text; I updated the code to reflect an example of the latter method.

Linefeed and tab are reserved words that represent those text items; you can use them in the same way as I used space. Formatting”such as alignment, bold, color, etc.”are properties that are settable only in a text editor or special ASOC window.

You can sort results in a text editor, or use one of the umpteen sorting algorithms on the forum.

Hello, Marc.

Thank you for providing the scripts.

Best wishes.