apple-contacts

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Apple Contacts

Apple Contacts

Query Contacts.app via AppleScript.
通过AppleScript查询Contacts.app。

Quick Lookups

快速查询

bash
undefined
bash
undefined

By 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'
undefined
osascript -e 'tell application "Contacts" to get name of every person'
undefined

Full Contact Info

完整联系信息

⚠️ Don't use
first person whose
— buggy. Use this pattern:
bash
undefined
⚠️ 不要使用
first person whose
——存在bug。请使用以下模式:
bash
undefined

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'
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'
undefined
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'
undefined

Phone Lookup

电话号码查询

⚠️ Exact string match required — must match stored format exactly.
StoredSearchWorks?
+1XXXXXXXXXX
+1XXXXXXXXXX
+1XXXXXXXXXX
XXXXXXXXXX
Try with
+1
prefix first. If fails, search by name instead.
⚠️ 需要精确字符串匹配——必须与存储格式完全一致。
存储格式搜索内容是否有效?
+1XXXXXXXXXX
+1XXXXXXXXXX
+1XXXXXXXXXX
XXXXXXXXXX
先尝试带
+1
前缀的搜索。如果失败,请改用姓名搜索。

Name Search

姓名搜索

  • Case-insensitive
  • Partial match with
    contains
  • Exact match: use
    is
    instead of
    contains
  • 不区分大小写
  • 使用
    contains
    进行部分匹配
  • 精确匹配:用
    is
    替代
    contains

Output

输出结果

Returns comma-separated:
name, phone1, [phone2...], email1, [email2...]
No match = empty output (not an error).
返回逗号分隔的内容:
姓名, 电话1, [电话2...], 邮箱1, [邮箱2...]
无匹配项时返回空输出(并非错误)。