Scripting a Find in Contacts
Scripting a Find in Contacts
- Subject: Scripting a Find in Contacts
- From: Christian Boyce via AppleScript-Users <email@hidden>
- Date: Fri, 10 Apr 2020 15:49:50 -0700
Howdy. I'm using AppleScript to find a person in Contacts when I feed in the
person's name (from a FileMaker database).
It's easy to do this:
tell application "Contacts"
set thePerson to the first person whose name is "Joe Smith"
set the selection to thePerson
end tell
But… if some Group is selected, and Joe Smith is not in the Group, the script
doesn't find anything— because it is only searching within the members of the
Group.
It's not hard to specify a group, as long as it's not the All Contacts group:
tell application "Contacts"
set theGroup to first group whose name is "Dee's wedding"
set the selected of theGroup to true
end tell
The problem is, I can't figure out how to specify the "All Contacts"
group(because I guess it's not really a group).
tell application "Contacts"
set theGroups to name of every group
end tell
The script above returns a list of groups, but "All Contacts" is not in it.
I worked around this by making my own Smart Group called "Everybody" which is
set to be "every person whose name is not zzzzzz." So then I can do this:
tell application "Contacts"
set theGroup to first group whose name is "Everybody"
set the selected of theGroup to true
set thePerson to first person whose name is "Joe Smith"
set the selection to thePerson
end tell
And it works. But it is not satisfying.
So I wonder: is there a way to tell Contacts to search the entire list of
contacts, regardless of the group that is currently selected? It seems as there
ought to be.
—
Socially distantly yours,
Christian Boyce
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden