我想知道如何在 Applescript 中显示联系人。基本上,我需要打开“联系人”,然后打开我想要的联系人。我不知道联系人的语法。
基本上,我所拥有的就是
tell application "Contacts"
activate
end tell
所以,是的。基本上没什么哈哈。我也尝试过:
tell application "Contacts"
set theContact to "Jason Wells"
open person theContact
end tell
但是,这不起作用。
感谢任何帮助。
谢谢。
最佳答案
联系人有点奇怪,至少就我而言,似乎有点错误。
如果“通讯录”打开,则会显示其窗口;如果关闭窗口,它就会关闭应用程序。这意味着只要你选择你想要的人,那个人就会显示出来。
所以这应该能让你继续:
--AppleScript seems to need Address Book as the application name
--it will rename it to Contacts on save or compile.
tell application "Address Book"
activate
set theContact to the first person whose name is "Jerold Stratton"
--first group appears to be "card".
set theGroup to second item of groups of theContact
--first, move to a group that contains this contact
set selected of theGroup to true
--second, select the contact
set selection to theContact
end tell
现在,就我而言,存在一个错误:应用程序名为“联系人”,但 AppleScript 找不到名为“联系人”的应用程序。它会发现它名为“地址簿”。然后,它会将其重命名为“联系人”,这意味着下次您在“联系人”关闭时编辑脚本时,它将无法找到该应用程序或其术语,直到您将其从“联系人”编辑回“地址簿”为止。这是在 OS X 10.9.4 上。
关于macos - 在 Applescript 中显示联系人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25496791/