broadcast message with ichat script

Hi there.

I’m wanting to broadcast messages to selected users in ichat. I’m using openfire as my chat server and ichat does not seem to be able to broadcast messages across openfrire.

So what I want to do is make a script that would send a message individually to all the users I have selected from my ichat buddy list.

I can send a message to all those users already, but what it does is creates a chat room that people need to accept and then enter to see what the message was.

So I thought a way around this was to create a script that would take a message you typed and then send it to each person you had selected one at a time so effectively sending out for instance 10 separate messages instead of 1 message to 10 people.

Any one have any idea how to do this?

So I’ve manage the following so far which works to a single user if I add there account name to the script


display dialog "Please type your message" default answer ""
set theMessage to text returned of result

tell application "iChat"
	
	send theMessage to buddy "jabberUsername" of service 2
end tell

So my next question would be how would I go about generating a list of users to feed to as a variable to JabberUsername.

Any help would be great.

Made a bit more progress.


display dialog "Please type your message" default answer ""
set theMessage to text returned of result

tell application "iChat"
	set nameList to (name of buddy of service 2)
	repeat with currentNumber from 2 to (length of nameList)
		send theMessage to buddy currentNumber of service 2
	end repeat
end tell

So now the script will search my buddy list and send the same message will be sent to all users in the buddy list. Really only two other bits I need to do to finish this off.

When it sends a message it opens a new chat window for each buddy it sends to. So I need to initiate a close on each window after it sends the message.

Then the next part would be for me to get to list buddies that are only part of specific groups on my list.

For instance I have a Support Team and a Marketing group. I would want to choose if I want to send the message to all users or just users in the Marketing Group or just users in the Support Group.

Any help would be appreciated.