【问题标题】:How to send a message using iChat and AppleScript如何使用 iChat 和 AppleScript 发送消息
【发布时间】:2012-03-08 16:04:33
【问题描述】:

我需要向许多人发送消息,让他们知道事件何时发生。它总是相同的人员列表,总是相同的事件,所以我想编写脚本。

我遇到的问题是我知道我需要使用 send 命令来发送消息。该命令的格式是

tell application iChat to send "message" to _buddy_

问题是如何得到那个伙伴。我知道如何获取所有好友的列表并遍历它们:

tell application "iChat"
    repeat with myBuddy in buddies
    end repeat
end tell

我似乎找不到的是如何找到我关心的好友,例如名字为“Pietje Piet”和“Joe Anonymous”的好友,然后只向这两个联系人发送消息。

【问题讨论】:

    标签: scripting applescript ichat


    【解决方案1】:

    您必须以某种方式在单独的列表中获取您关心的好友列表。这是一个建议:

    set peopleICareAbout to {"Pietje Piet", "Joe Anonymous"}
    
    tell application "iChat"
        repeat with myBuddy in buddies
            --get properties of myBuddy
            if full name of myBuddy is in peopleICareAbout then
                send "dfgdgdf gdg dfg dfg" to myBuddy
            end if
        end repeat
    end tell
    

    【讨论】:

    • 这正是我想要的!尽管我当然必须更改消息;-)
    • 这在 OS X Yosemite 上效果很好,只需要将应用程序更改为“消息”。
    猜你喜欢
    • 2015-09-02
    • 2011-06-19
    • 1970-01-01
    • 2014-04-30
    • 2015-03-26
    • 2021-05-11
    • 2023-01-22
    • 2011-07-05
    • 1970-01-01
    相关资源
    最近更新 更多