Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Create a classification feature in Address Book Apps
Tiger only hintEver since I started using Address Book, I have wanted to be able to use some kind of feature classification of records (like enum types in Java/C, or value lists in File Maker). Using Smart Groups and a previous hint on Mac OS X Hints, I managed to set up an acceptable system.

It's not perfect (for example, I have not been able to get iSync to understand Smart Groups), but it works reasonably well.

Here's how I did it...
  1. Set up a category field:
    • Open Preferences -> Template, and add one of the fields you never use (I picked "Maiden Name"). This will be your categorisation field.

    • Switch to Finder and navigate to /System -> Library -> FrameworksAddressBook.framework -> Versions -> Current -> Resources, and pick your localisation folder. (I assume that is English.proj for US Americans.)

    • Open the file ABLabelsAndProperties.strings in a text editor of your choice (if you want to play it safe, make a copy of it first), and find the row where the string for your chosen field is defined. In my (Swedish) case, there was a row like this:
          "MaidenName"    =    "Namn som ogift"
      Change that to, for example:
          "MaidenName"    =    "Categorisation"
    • Do the corresponding change in the file ABLabels.strings.
    • Save the files (administrator password needed), and restart your computer. When you open Address Book, you should see a field named Categorisation in the record template.

  2. Choose categorisation labels:
    • Choose categories. Well, this is at you own choice. In this example, I will assume the categories Friends, Family, Colleagues, and Inactive.

    • Design categorisation labels. If you have chosen one of the more-common fields as your category field, you can restrict the Smart Group search to that field. But if you, as I, have chosen "Maiden Name," then the Smart Group search will have to be for the entire record.

      Therefore, the labels you use to categorise the records must be unique strings. The search engine used for the Smart Groups (Spotlight) is quite focused on words, and so you cannot use dashes, underscores, or something similar to make the category labels unique. My solution was to prefix each word with a letter that rarely starts a Swedish word. For English, that could be the letter x. The resulting labels are thus xfriends, xfamily, xcolleagues, and xinactive.

  3. Set up Smart Groups:
    • Create one Smart Group for each category, or for each combination of categories that you like to have. In this example, there is one Smart Group for Friends ('card contains xfriends and card does not contain xinactive'), one for Family ('card contains xfamily and card does not contain xinactive'), etc.

  4. Categorising your records:
    • If you already have a lot of records categorised in 'stupid' groups, then there is some work for you to do. Basically, you have to go through all records and add categorisation labels to them. If you like AppleScript, you can probably write a script to do the job for you. Otherwise, copy-and-paste will have to do.

      If you want to put a single record in more than one category, just put blanks between the category labels.
Bonus hint #1: If you are unsure if you have categorised all records, create a Smart Group with criteria that excludes all records containing any of the labels.

Bonus hint #2: If you do not want to have all records in Address Book on your iSynced device (cell phone, iPod, ...), you can have a separate 'stupid' group in Address Book, for example called 'My Cell Phone.' Before iSyncing, empty that group, and then drag-and-drop (or copy-and-paste) the contents of the relevant Smart Groups to 'My Cell Phone.' Then restrict the iSyncing to that group.

[robg adds: I haven't tested this one...]
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)

10.4: Create a classification feature in Address Book | 10 comments | Create New Account
Click here to return to the '10.4: Create a classification feature in Address Book' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Create a classification feature in Address Book
Authored by: TC!! on Jan 03, '06 09:43:54AM

For the first part of this hint I think there may be an easier way to create a category field.
It is possible in the preferences to change which fields appear in the the default template. If you choose for example "friend", click on the double arrows next to it and choose "Custom…" you can then change friends to category.

I don't understand why you need to put the x in front of each category name.

Anyway, a very good hint, thanks!

[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: fitzgunnar on Jan 03, '06 10:41:12AM

1. TC!!, it seems like both of us are right - some fields can be customized directly in the Settings, some cannot. 'Maiden Name' is one that cannot be customized in the Settings.

So 'Maiden Name' is perhaps not such a good choice. (Then again, it is positioned quite nicely on the card, above the phone numbers. 'Friend' is positioned between email address and postal address.)

2. The initial x in category labels: I first did not have any x, but used ordinary words. The problem is that the Smart Group search setting does not let me restrict the search to the particular field I use (Maiden Name), so I have to define the search as one in the entire card. And if I happen to use one of these categorization words in some card (for example in some comment), then that card will show up in the smart group for that category. If the categorization word is "xprivate", it is very unlikely that I will use that for any other purpose.

However, if you use one of the fields that *can* be specified in the Smart Group search definition, you can skip the x. Personally, I was not absolutely sure that I would not want to use any of those fields in any of my cards.


[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: Bluecoat93 on Jan 03, '06 01:40:52PM
Great idea! I did something similar, but I used the URL field and created a Custom URL type called "Category". The nice thing is, you can have multiple "Category" URLs for a single contact, allowing one entry to belong to multiple categories. Then, you simply create Smart Groups for "URL is myCategory" and your entry will show up in every category you add to it. For tagging multiple contacts, I use the following AppleScript:

display dialog "Category to set?" default answer ""
copy the result as list to {myCat, buttonPressed}

tell application "Address Book"
  set thePeople to selection
  repeat with aPerson in thePeople
    set bFound to false
    set theCats to the urls of aPerson
    repeat with aCat in theCats
      if the label of aCat is "Category" then
        set the value of aCat to myCat
        set bFound to true
      end if
    end repeat
    if bFound is false then
      make new url at beginning of aPerson's urls with properties {label:"Category", value:myCat}
    end if
  end repeat
end tell

[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: fitzgunnar on Jan 04, '06 04:13:57AM

About the same idea as TC!! had, but URL is available in the search criteria dialog, which friends ('associated people'?) are not. If you use the URL for real urls, though, there may be clashes between category labels and actual urls, which means you have to use initial xs for the labels anyway.

An advantage with the URL field is that the values are underlined and made blue in the address card, which makes the labels easily spotted in the card. This could of course be a disadvantage too...


[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: thiefhunter on Jan 04, '06 04:15:09AM

Bluecoat, your script is fantastic. Just what I needed. Works brilliantly! Thanks to you and the guy who started this hint.

[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: fitzgunnar on Jan 04, '06 04:19:08AM

Since other people actually seem interested in this feature, I must take the chance to ask if anybody has (or can) come up with a way to restrict the values for the categorisation to a specified set of labels. Some way to prevent that the user accidentally misspell the label 'private' as 'privat', for example.

Any idea?


[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: Lutin on Jan 04, '06 08:01:38AM
I wanted, as suggested, restrict the values for the categorisation to a specified set of labels (and don't have to type / paste-and-copy them each time).

Here we go!

To extend the dialog capabilty of Applescript, this script uses 24U Appearance OSAX from It must be installed before use.

Select one or more cards in AddressBook and run the script.

-- Script by Lutin
-- Sat Dec 17 2005

-- To extend the dialog capabilty of Applescript
-- this script uses 24U Appearance OSAX from
-- Must be installed before use

-- Define the categories used to sort the contacts
-- Second field determines if the checkbox is already checked when asked
set myFirst to {"xFamily", true}
set mySecond to {"xFriend", true}
set myThird to {"xSchool", true}
set myFourth to {"xWork", false}
set myFifth to {"xInactive", false}

	-- Set up the dialog box with 24U Appearance
	set myResult to display better dialog ¬
		"And, of course, also checkboxes:" fields {¬
		{kind:check box, name:(first item of myFirst), selected:(second item of myFirst)}, ¬
		{kind:check box, name:(first item of mySecond), selected:(second item of mySecond)}, ¬
		{kind:check box, name:(first item of myThird), selected:(second item of myThird)}, ¬
		{kind:check box, name:(first item of myFourth), selected:(second item of myFourth)}, ¬
		{kind:check box, name:(first item of myFifth), selected:(second item of myFifth)}} ¬
		buttons {"OK", "Cancel"}
	-- Get in a list all checked checkboxes
	set myChoices to choices returned of myResult
	tell application "Address Book"
		-- Get all the cards selected in Address Book
		set thePeople to selection
		repeat with aPerson in thePeople
			set aNote to the note of aPerson
			if aNote is missing value then set aNote to ""
			-- For each category selected add it to the field note
			repeat with aChoice in myChoices
				if (aNote does not contain aChoice) then
					set note of aPerson to aChoice & "
" & aNote
					set aNote to aChoice & "
" & aNote
				end if
			end repeat
		end repeat
	end tell
on error myErr number myErrNum
	if myErrNum = -1708 then
		display dialog "Sorry, an error has occured, probably because " & ¬
			" 24U Appearance OSAX was not installed properly. See" buttons {"Quit"} default button 1
		error myErr number myErrNum
	end if
end try
It sure has many ways of improvement. Please share your modifications.

[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: jacobolus on Jan 06, '06 03:36:48AM

Personally, I use the "notes" field at the bottom, and enter things like "Family", or "School: Apple University", etc., and then build smart folders from that.

[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: taxi on Jan 07, '06 12:18:53AM

I'm leaning more towards Smart Groups and Notes too.

Originally, I was co-opting the 'Related Names' field to reference other attributes, like coach or referee levels for members of my sporting club. But there is not a way to easily access this information from Smart Groups, wheras Referee:2 can be easily accessed.

Unfortunately, I can't get "All referees who are level 2 or above, and not coaches" very easily. Address Book can only have (all) or (any) matches, so you need to start using combinations of smart groups very quickly. Except that you can't seem to do this, either.

Note: I don't actually need to solve this problem - I just made it up as an example! :)

It is possible to add other fields to Address Book records, but I don't have the coding skill to write an application to do this!

(By this, I mean other fields that aren't co-opted like as listed above)

[ Reply to This | # ]
10.4: Create a classification feature in Address Book
Authored by: Alfeo on Mar 07, '06 06:07:22AM

this is the closest i've found to my problem... which is that my industry (film) is all about job titles and I have over 2K address book entires already. I need to make a Smart Group for the address book field Job Title.

this way i can have a group which is Production, which will include and auto update Production people.

So... anyway to include Job Tile into a Smart Group search?

[ Reply to This | # ]