![从终端或 applescript 切换 iCloud 偏好设置](https://linux22.com/image/1613847/%E4%BB%8E%E7%BB%88%E7%AB%AF%E6%88%96%20applescript%20%E5%88%87%E6%8D%A2%20iCloud%20%E5%81%8F%E5%A5%BD%E8%AE%BE%E7%BD%AE.png)
我正在寻找一个脚本来在系统偏好设置中切换 iCloud 偏好设置。
我需要自动取消选中所有声音(照片、邮件、联系人等),只留下 iCloud Drive 和“查找我的 Mac”。
在 iCloud Drive 设置中,我还需要取消选中所有内容,只留下桌面和文档文件夹
有没有办法通过终端或 applescript 来实现?
谢谢!
答案1
看这个答案在 Apple.SE 上,它建议:
tell application "System Preferences" to set current pane to pane "iCloud"
tell application "System Events"
tell window "iCloud" of process "System Preferences"
set btmmBox to checkbox 1 of UI element 1 of row 1 of table 1 of scroll area 1 of group 1
tell btmmBox
if not (its value as boolean) then click btmmBox
end tell
--get value of btmmBox
end tell
end tell
这只会检查第一个元素,即 iCloud Drive,但您可以根据语法检查其他元素。