When I feel most alive … go ahead, take your shoes off!

May 17, 2005

Fixing Address Book’s lack of good metadata editing (adding tags easily)

Filed under: General, Mac OS X

With such power in Spotlight to search metadata, why wouldn’t Apple not allow easy entry of metadata into contacts? You can easily add a tag like [Family] to the Note section one by one to all your family members contact cards, but why not be able to select them all and do it at once. Since I know that Address Book is scriptable and I wanted to play around with Automator I decided that this was a suitable problem worth attacking.

So I go into Automator and find out that none of the Automator actions for Address Book let you EDIT contact info, only search, filter, and show contacts. SO I had to venture into another world of scripting, one slightly more complicated: AppleScript.

After a little help from someone on the MacScripters forums I got a working piece of code. Here it is; it works just like it should! Feel free to copy this and use it yourself!

–*************************
— Multiple Contact Tagger
— How to use this script: Select multiple contacts in Address Book, then run this script (via the script menu or Quicksilver are the best ways), and it will let you enter the tag (ex: [Family] ) you want and then apply it to the selected contacts by appending it into the Note section of each contact. You may then want to create Smart Groups that search for that tag in its criteria, and then Smart Folders in Mail that use the Smart Groups in its criteria

— Author: Scott Paulis
— Last Modified: May 17, 2005

tell application “Address Book”
set thePeople to selection
display dialog “What tag would you like to apply to the selected contacts?” buttons {”Cancel”, “Apply”} default button “Apply” default answer “[tag]”
set dialogInfo to result

set selectedButton to button returned of dialogInfo
set tagString to text returned of dialogInfo

if selectedButton is “Apply” then
repeat with aPerson in thePeople
set currentNote to the note of aPerson
if currentNote is missing value then set currentNote to “”
set newNote to currentNote & tagString
set note of aPerson to newNote
end repeat
end if
end tell
–**************************

Comments »

The URI to TrackBack this entry is: http://scottyp.blogsome.com/2005/05/17/fixing-address-books-lack-of-good-metadata-editing-adding-tags-easily/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


Get free blog up and running in minutes with Blogsome | Theme designs available here