Selecting a person in Address Book

  • I'd like to tell the Address Book application to select a specific
    person (given by its id).

    As far as I can see, the Cocoa Address Book Objective-C Framework
    does not provide methods to do this. Ok, with the exception of
    -[ABPeoplePickerView editInAddressBook:], but I do want to achieve
    this without having a selection in an ABPeoplePickerView and I do not
    want to go to edit mode.

    I thought AppleScript might be the way to go, and it almost is: you
    can set the selection to a person by its id. Unfortunately this only
    works if the person is a member of the currently selected group. And
    there seems to be no way to change the group selection. I already
    searched the applescript-users list to no avail.

    Now I hope I simply overlooked something in the Address Book
    Objective-C Framework.

    Thanks
    Kai
  • On 11/28/07 7:47 PM, Kai Brüning said:

    > I'd like to tell the Address Book application to select a specific
    > person (given by its id).

    Look at the comments at the top of ABAddressBook.h:

    // ================================================================
    //      OpenURL support
    // ================================================================
    // An application can open the AddressBook app and select (and edit) a
    specific
    // person by using the -[NSWorkspace openURL:] API.
    //
    // To launch (or bring to front) the Address Book app and select a given
    person
    //
    // NSString *urlString = [NSString stringWithFormat:@"addressbook://%@",
    [aPerson uniqueId]];
    // [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlString]];
    //
    // To launch (or bring to front) the Address Book app and edit a given person
    //
    // NSString *urlString = [NSString stringWithFormat:@"addressbook://%@?
    edit", [aPerson uniqueId]];
    // [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlString]];

    --
    ____________________________________________________________
    Sean McBride, B. Eng                <sean...>
    Rogue Research                        www.rogue-research.com
    Mac Software Developer              Montréal, Québec, Canada
  • > On 11/28/07 7:47 PM, Kai Brüning said:
    >
    >> I'd like to tell the Address Book application to select a specific
    >> person (given by its id).
    >
    > Look at the comments at the top of ABAddressBook.h:

    Thanks a lot! Good that AppleScript wasn't up to the task, I would have spend a lot of useless time doing it that way. ;-)

    Kai
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today