如何发送使用的iChat和AppleScript消息 [英] How to send a message using iChat and AppleScript

查看:204
本文介绍了如何发送使用的iChat和AppleScript消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有需要将消息发送到若干人让当一个事件发生时他们知道。它始终是人的同一个列表,始终相同的事件,所以我想剧本吧。

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

我似乎无法找到的是如何只得到我在乎的死党,比如那些名为Pietje皮特和乔·无名氏,然后只将消息发送到这两个触点。

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.

推荐答案

您必须将收购你在一个单独的列表关心莫名其妙的好友列表。这里有一个建议:

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

这篇关于如何发送使用的iChat和AppleScript消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆