SendMessage is a child function of the ChatWnd object. Therefore, to use this function, you first need the object. There are plenty of functions which return a ChatWnd object instance, it's up to you in what situation you need to send the message!
- You can send a message when a chat window is created by using the ChatWnd parameter of OnEvent_ChatWndCreated.
- You can send a message when the user sends or receives a message by using the ChatWnd parameter of OnEvent_ChatWndSendMessage or OnEvent_ChatWndReceiveMessage.
- You can send a message when the user clicks the Scripts button in a chat window and selects a menu-item from the script menu by using the OriginWnd parameter of OnEvent_MenuClicked.
- You can send a message after you've opened a chat window with Messenger.OpenChat():
code:
var ChatWnd = Messenger.OpenChat("someone@hotmail.com");
ChatWnd.SendMessage("Hello Someone!");
- You can loop through the opened chat windows by enumerating the Messenger.CurrentChats collection and send messages.
- ...
Or in other words: please be a bit more specific
when you want your script to send a message.