watch ichat rooms for variables and reply via IM

i’m trying to find/create a script that will give an audible alert when someone types “#help” and will make a popup so I can hit a button if I want to help the person and it will post “#persons name” in the chat room and send them an IM saying “what’s wrong”. Any input on this would be greatly appreciated.

ok so far i have managed to get it so that i can send a new message to an individual. i am still unsure of how to watch ichat for the string “#help” and how to determine the username of the person who typed it

on GUIScripting_status()
	-- check to see if assistive devices is enabled
	tell application "System Events"
		set UI_enabled to UI elements enabled
	end tell
	if UI_enabled is false then
		tell application "System Preferences"
			activate
			set current pane to pane id "com.apple.preference.universalaccess"
			display dialog "This script utilizes the built-in Graphic User Interface Scripting architecture of Mac OS x which is currently disabled." & return & return & "You can activate GUI Scripting by selecting the checkbox \"Enable access for assistive devices\" in the Universal Access preference pane." with icon 1 buttons {"Cancel"} default button 1
		end tell
	end if
end GUIScripting_status



tell application "iChat"
	activate
	tell application "System Events"
		tell process "iChat" to set frontmost to true
		tell process "iChat" to click menu item 1 of menu "File" of menu bar 1
		tell application "System Events" to keystroke "+15024248838"
		tell process "iChat" to click button "Chat" of window 1
		tell application "System Events" to keystroke "What's shakin?"
		tell application "System Events" to keystroke return
	end tell
end tell