apple-contacts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseApple Contacts
Apple Contacts
Query Contacts.app via AppleScript.
通过AppleScript查询Contacts.app。
Quick Lookups
快速查询
bash
undefinedbash
undefinedBy phone (name only)
通过电话号码(仅获取姓名)
osascript -e 'tell application "Contacts" to get name of every person whose value of phones contains "+1XXXXXXXXXX"'
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"'
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'
undefinedosascript -e 'tell application "Contacts" to get name of every person'
undefinedFull Contact Info
完整联系信息
⚠️ Don't use — buggy. Use this pattern:
first person whosebash
undefined⚠️ 不要使用——存在bug。请使用以下模式:
first person whosebash
undefinedBy 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'
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'
undefinedosascript -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'
undefinedPhone Lookup
电话号码查询
⚠️ Exact string match required — must match stored format exactly.
| Stored | Search | Works? |
|---|---|---|
| | ✅ |
| | ❌ |
Try with prefix first. If fails, search by name instead.
+1⚠️ 需要精确字符串匹配——必须与存储格式完全一致。
| 存储格式 | 搜索内容 | 是否有效? |
|---|---|---|
| | ✅ |
| | ❌ |
先尝试带前缀的搜索。如果失败,请改用姓名搜索。
+1Name Search
姓名搜索
- Case-insensitive
- Partial match with
contains - Exact match: use instead of
iscontains
- 不区分大小写
- 使用进行部分匹配
contains - 精确匹配:用替代
iscontains
Output
输出结果
Returns comma-separated:
name, phone1, [phone2...], email1, [email2...]No match = empty output (not an error).
返回逗号分隔的内容:
姓名, 电话1, [电话2...], 邮箱1, [邮箱2...]无匹配项时返回空输出(并非错误)。