如何使用 iChat 和 AppleScript 发送消息

发布于 2025-01-07 01:44:14 字数 431 浏览 3 评论 0 原文

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

我遇到的问题是我知道我需要使用 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”的好友”,然后只是向这两个联系人发送消息。

I have a need to send a message to a number of people to let them know when an event is occurring. It is always the same list of people, and always the same event, so I would like to script it.

The problem that I have is that I know that I need to use the send command to send the message. And the format of that command is

tell application iChat to send "message" to _buddy_

The problem is how to get that buddy. I know how to get the list of all buddies, and to loop over them:

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

What I can't seem to find is how to just get the buddies that I care about, for example those with name "Pietje Piet" and "Joe Anonymous", and then just to send messages to these two contacts.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

还如梦归 2025-01-14 01:44:14

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

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

You'll have to aquire a list of the buddies you care about in a separate list somehow. Here's a suggestion:

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文