Well yes, in a way this question could be better placed in an AppleScript forum. But maybe some of you encountered a similar problem before:
Do you know if there is a way to open Mac OS Contacts and tell it to show a certain person retrieved from a Xojo app? I can read and add to Contacts and found out how to install and communicate with an AppleScript, but I cannot figure out how to “show” a certain entry there seems to be no show command, and setting the selection to some properties doesnt work. I try to avoid creating a complete contact window in Xojo when Contacts can do this fine, but currently it seems to me Ill have to in order to show all the details or is there another way to convince Contacts into cooperation?
As always a lot of thanks in advance!
Contacts (formerly Address Book) has a custom URL handler for the addressbook:// URI space.
I dont recall the syntax to show a contact card but I believe you can find this in Apple Developer Library. If I remember properly, you must get the UniqueID of a person and use this in the URL.
I already used this in past (its working since Mac OS X 10.4 at least), and you dont need AppleScript, just the ShowURL() method from Xojo. Additionally, Im certain you can add a &edit parameter to the URL to show the contact card in edit mode.
Thanks for the hint, Massimo! Thats a clue Ill follow soon.
To make the forum more workable as a programming dictionary (in case someone else searches for this topic), heres the link to the URL scheme:
https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AddressBook/Tasks/URLScheme.html
EDIT - I edited so everyone could SEE the URL
Hmm, but it doesnt work for me. The following opens Contacts, but it will not show the currently selected person. Any ideas?
if CallData.CallerPhoneBookContact<>NIL then
dim s as string = "addressbook://%@"+CallData.CallerPhoneBookContact.UniqueID
ShowURL(s)
end if
You dont need to include the %@ in the string. This is the formatting placeholder for the NSStrings stringWithFormat method from which you copied (Objective-C language).

Did I write already I never got accustomed to C syntax?
Works like a charm without it. Thanks a lot, Massimo!