AppleScript设置"我的卡"在OS X 10.12.3下的联系人中定义的名称或电子邮件地址

时间:2017-02-18 02:58:57

标签: macos applescript

首先,我必须为我糟糕的英语道歉。我来自德国,我在这里的不同社区找不到任何帮助或想法。

我看起来并尝试写一个小脚本,其中一张将我的卡片设置给有电子邮件地址的人" johndoe @ ...",或者来自名为" John Doe&的人#34; 两者都可以,但我更喜欢电子邮件地址。

我希望我能在这里找到一些帮助。

这只有一个脚本,我发现它不起作用。

tell application "Contacts"
activate
try
set my card to people whose first name is "John" and last name is "Doe"
end try
quit
end tell

感谢您的帮助和问候 安迪

2 个答案:

答案 0 :(得分:1)

你非常接近

tell application "Contacts"
    activate
    try
        set my card to 1st person whose first name is "John" and last name is "Doe"
        save
    end try
    quit
end tell

您必须获得与参数匹配的1st人,您必须保存地址簿。

或搜索电子邮件

tell application "Contacts"
    activate
    try
        set my card to 1st person whose value of emails contains "johnn@doe.com"
        save
    end try
    quit
end tell

答案 1 :(得分:0)

tell application "Safari" to activate
tell application "System Events"
    click menu item "Verlauf löschen …" of menu 1 of menu bar item "Verlauf" of menu bar 1 of process "Safari"
    try
        click button "Verlauf löschen" of front window of process "Safari"
    on error
        try
            click button "Verlauf löschen" of sheet 1 of window 1 of process "Safari"
        end try
    end try
end tell
tell application "Safari" to close every window
tell application "Safari"
    make new document with properties {URL:"https://www.startpage.com/deu/#hmb"}
end tell