Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Queries macOS Contacts.app via AppleScript to look up names, phone numbers, and emails.
Use this skill ↓64% 86%+23 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 14 of 22 without it.
3 of 3 safety checks passed
Not used yet
Query Contacts.app via AppleScript.
# By phone (name only)
osascript -e 'tell application "Contacts" to get name of every person whose value of phones contains "+1XXXXXXXXXX"'
# By name
osascript -e 'tell application "Contacts" to get name of every person whose name contains "John"'
# List all
osascript -e 'tell application "Contacts" to get name of every person'
⚠️ Don't use first person whose — buggy. Use this pattern:
# By phone
osascript -e 'tell application "Contacts"
set matches to every person whose value of phones contains "+1XXXXXXXXXX"
if length of matches > 0 then
set p to item 1 of matches
return {name of p, value of phones of p, value of emails of p}
end if
end tell'
# By name
osascript -e 'tell application "Contacts"
set matches to every person whose name contains "John"
if length of matches > 0 then
set p to item 1 of matches
return {name of p, value of phones of p, value of emails of p}
end if
end tell'
Next to this one in the catalogue, plus more from the same author.