0

Example:

  • First Name: "Sandu"
  • Middle Name: "D."
  • Last Name: "Serban"

The result would be something like: "Sandu_D._Serban"

For all the contacts in my Mac Address Book.

Thanks

gideon
  • 19,329
  • 11
  • 72
  • 113
  • Mayhap this should be migrated to http://superuser.com – froeschli Mar 26 '11 at 14:05
  • @Jared: I suspect that this task cannot easily be accomplished without programming. – Gabe Mar 26 '11 at 14:07
  • @Gabe - I don't doubt it, since it's difficult to accomplish much on a computer without programming. However, since the poster did not include a programming language, I'm left to wonder how much help the poster needs (tutorial on obj-c?). Or if they would be better off asking on superuser.com if anyone knows how to do this. IE, a program already written to do it, not a from-scratch piece of code. – Jared Farrish Mar 26 '11 at 14:17
  • AppleScript is probably the way to go. – Anne Mar 27 '11 at 09:40

1 Answers1

0

With applescript you can do it like this (use script editor to run):

    tell application "Address Book"
        set allNames to ""
        set peopleCount to (count every person)
        repeat with i from 1 to peopleCount
            set firstName to (get first name of person i)
            set middleName to (get middle name of person i)
            set lastName to (get last name of person i)
            set oneName to ""
            if firstName is not missing value then
                set oneName to oneName & firstName
            end if
            if middleName is not missing value then
                set initial to first character of middleName
                set oneName to oneName & "_" & initial & "."
            end if
            if lastName is not missing value then
                set oneName to oneName & "_" & lastName & "
    "
            end if
            if firstName is missing value or lastName is missing value then
                set oneName to ""
            end if
            set allNames to allNames & oneName
        end repeat
        set the clipboard to allNames
    end tell

This script copies the name list to clipboard. Next time you paste you get the name list (wait a bit if you have a lot of names in your address book).

br,

Juha

Juha
  • 2,053
  • 23
  • 44