简体   繁体   English

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

[英]AppleScript to set “my card” to a defined name or e-mail address in Contacts under OS X 10.12.3

First i must say sorry for my bad english. 首先,我必须为我的英语不好对不起。 I come from Germany and i can't find any help or idea for my problem in different Communitys here. 我来自德国,在这里的不同社区中找不到我所遇到问题的任何帮助或想法。

I look and try to write a little script, which one set my card to the person with email address "johndoe@...", or alternatively from the person named "John Doe" Both is ok but i prefer email address. 我查看并尝试编写一个小脚本,该脚本将我的卡设置给电子邮件地址为“ johndoe @ ...”的人,或者从名为“ John Doe”的人那里得到。两个都可以,但我更喜欢电子邮件地址。

I hope i can find some help here. 希望我能在这里找到帮助。

This only one script, which one i found doesn't work. 这只是一个脚本,我发现一个脚本不起作用。

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

Thank's for help and greetings Andy 感谢您的帮助和问候安迪

You are pretty close 你很近

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

You have to get the 1st person who matches the arguments and you have to save the address book. 您必须找到匹配参数的1st个人,并且必须保存地址簿。

Or searching for email 或搜索电子邮件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM