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

Create Address Book Smart Groups for the iPhone via an app iOS devices
This is an enhancement to this previous hint, which only syncs contacts with phone numbers to the iPhone (because Smart Address Book groups are not synchronized to the iPhone).

Because people forget to call that script every time they add a new contact with a phone number, this process must be automated. This hint creates a tool that monitors the Address Book file, and calls a command line app every time it changes. This hint was tested on 10.5 and 10.6.


The AppleScript solution takes too long and opens the Address Book which can be irritating. This small Objective-C app (download: binary [8KB] source [6KB]) is fast and configurable.

(To compile this app yourself, with Xcode installed, do this in Terminal after downloading and expanding the source file: gcc ABGroupUpdater.m -o ABGroupUpdater -framework Foundation -framework AddressBook.) The calling syntax is:
./ABGroupUpdater -property Phone -group Phones -v
Where -property Phone means that all contacts with a phone number are added to the group Phones. WARNING: If this group already exists in your Address Book, it will be modifed. The -v argument is verbose mode, which can be removed in the final call.

You can replace the phone property with other values defined in this file: /System » Library » Frameworks » AddressBook.framework » Headers » ABGlobals.h. For example if you want a group with contacts which have an email address, use the kABEmailProperty:
ABGroupUpdater -property Email -group Emails -v
To trigger ABGroupUpdater, we install a LaunchAgent. Save the following to a file named com.macosxhints.addressbookGroupUpdater.plist in the ~/Library/LaunchAgents folder (create it if necessary):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
        <string>/Users/USER/Library/Application Support/ABGroupUpdater/ABGroupUpdater</string>
        <string>/Users/USER/Library/Application Support/AddressBook/AddressBook-v22.abcddb</string>
Change the two paths with USER to your short username, and make sure the ABGroupUpdater executable exists in the specified path -- feel free to change the location. ThrottleInterval is set to 60 seconds, so the ABGroupUpdater app is called at least every minute. To install the agent without rebooting, call sudo launchctl load PATH_TO_PLIST. To check if is is active, call launchctl list and check for the label.
  • Currently 2.06 / 5
  You rated: 2 / 5 (18 votes cast)

Create Address Book Smart Groups for the iPhone via an app | 1 comments | Create New Account
Click here to return to the 'Create Address Book Smart Groups for the iPhone via an app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: mael on Aug 25, '10 10:41:19AM

GREAT!! Just what I was looking for to update the addresses of my FRITZ!Box Routers' Telephone Book!

[ Reply to This | # ]