Skip to content

BusyContacts

BusyContacts 是一款 macOS 联系人应用。Protocol Launcher 可以生成官方 BusyContacts URL handler 链接。

使用

这个库有两种使用方式:

  • 从子路径按需导入,支持 Tree Shaking 并保持较小的包体积。
  • 从根包完整导入更适合快速脚本或演示,但会包含所有应用模块。

生产构建建议选择按需导入;完整导入适合快速脚本或演示。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

BusyMac 官方文档列出了 busycontacts://show/busycontacts://open/busycontacts://new/busycontacts://filter/busycontacts://backup。本模块只覆盖这些已记录的 handler。

显示联系人

通过 UID、X-ABUID 或邮箱地址显示联系人。

On-Demand
ts
import { show } from 'protocol-launcher/busycontacts'

const url = show({
  identifier: 'test@apple.com',
})

打开联系人窗口

在单独的浮动窗口中打开联系人。

On-Demand
ts
import { openContact } from 'protocol-launcher/busycontacts'

const url = openContact({
  identifier: 'B8FB81A6-659D-4E66-B1B7-97A95A144C83:ABPerson',
})

新建联系人

使用 BusyContacts 的自然语言字符串创建新联系人。需要通讯录提示时,将官方记录的 /Hint 后缀包含在同一个字符串里。

On-Demand
ts
import { newContact } from 'protocol-launcher/busycontacts'

const url = newContact({
  text: 'Bob Jones 555-1212',
})

选择筛选器

按精确名称选择 BusyContacts Smart Filter。

On-Demand
ts
import { selectFilter } from 'protocol-launcher/busycontacts'

const url = selectFilter({
  name: 'friends',
})

备份

在 BusyContacts 配置的默认备份位置创建备份。由于该 URL 会触发后台备份,这里只展示生成的字符串,不提供启动按钮。

On-Demand
ts
import { backup } from 'protocol-launcher/busycontacts'

const url = backup()

生成的 URL

ts
show({ identifier: 'test@apple.com' })
// => 'busycontacts://show/test@apple.com'

show({ identifier: 'f90221ac-84a8-4f40-a699-5930b59a24d1' })
// => 'busycontacts://show/f90221ac-84a8-4f40-a699-5930b59a24d1'

openContact({ identifier: 'B8FB81A6-659D-4E66-B1B7-97A95A144C83:ABPerson' })
// => 'busycontacts://open/B8FB81A6-659D-4E66-B1B7-97A95A144C83:ABPerson'

newContact({ text: 'Bob Jones 555-1212' })
// => 'busycontacts://new/Bob%20Jones%20555-1212'

newContact({ text: 'Bob Jones 123 Main Street, Anytown USA /iCloud' })
// => 'busycontacts://new/Bob%20Jones%20123%20Main%20Street,%20Anytown%20USA%20/iCloud'

selectFilter({ name: 'friends' })
// => 'busycontacts://filter/friends'

selectFilter({ name: 'Team Contacts' })
// => 'busycontacts://filter/Team%20Contacts'

backup()
// => 'busycontacts://backup'

官方文档