Fixing Address Book’s lack of good metadata editing (adding tags easily)
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, 2005tell 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 resultset selectedButton to button returned of dialogInfo
set tagString to text returned of dialogInfoif 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
–**************************


