I wanted to write an Automator Workflow to take the selected contacts in Address Book and add to their “Note” section a “tag” of sorts… like a category (ex: “Family”) so that I can take better advantage of the new Smart Groups Feature and be able to apply tags to multiple contacts at once, since Address Book won’t let you edit multiple contacts at once.
Unfortunately, the automator actions for address book don’t include editing contacts, just searching and listing.
I know this is possible with Apple Script, but being a beginner at Apple Script, I have no clue how to do this:
I whipped up an attempt (that has a runtime error):
-- Append tags to selected Address Book contacts
tell application "Address Book"
repeat with curPerson from 1 to number of items in selection
set newNote to the note of person curPerson & " [tag]"
set note of person curPerson to newNote
end repeat
end tell
Any thoughts? Can anyone help me fix this and make it work??
tell application "Address Book"
set thePeople to selection
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 & " [tag]"
set note of aPerson to newNote
end repeat
end tell
Model: Mac mini
AppleScript: 1.10
Browser: Safari 412
Operating System: Mac OS X (10.4)
I was able to take it from there and make it do what I wanted it to (take a specified tag string and append it to each contact):
Feel free to use this script for yourself!
tell application "Address Book"
set thePeople to selection
display dialog "What tag would you like to append?" 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
Yay, I found some people who might be able to help me! Okay, I’m not good with scripting and I’m just learning with Automator. I’ll tell you what I’m trying, and then maybe someone can help me make it happen.
In Automator, there is an action (for Address Book) called “Get Contact Information.” The problem is, when I use this, I doesn’t have “Notes” as an option. What I’m wanting is to create a spreadsheet (using “Get Contact Information”) that shows First and Last name and their appropriate notes. Here’s my current workflow:
Now, there is another Automator action that allows me to insert an applescript. I’m assuming that’s where I can tell it to extract Note information. Anyway, I hope I haven’t confused anyone. If anyone can help me, please let me know!!!
Model: Mac Mini
Browser: Safari 412.2.2
Operating System: Mac OS X (10.4)
WOW… that’s absolutely amazing. i’ve been trying to figure out how to add notes to multiple address book entries for ages. i finally emailed a script developer who suggested i look here and BINGO !
being very VERY new to scripts, is there an easy way to add a dialogue box that asks for an address book group, that then applies the tag to the group you’ve entered ?
also, i find that when i’ve run the script, for the new notes tags to show up i need to click out of the contacts then back to them. is there a way to script an address book refresh ?
anyway, thanks again for the help here scott and bruce.
So, I selected the contacts I wanted to add text to, ran this, changed the [tag] in the box to what I wanted to add to all of them, but then nothing happened!