4

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.

Paul Wagland
  • 27,756
  • 10
  • 52
  • 74

1 Answers1

3

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
tompaman
  • 104
  • 4