Need help with ChatWnd::SendMessage |
Author: |
Message: |
Jacen
New Member
Posts: 8
Joined: May 2007
|
O.P. Need help with ChatWnd::SendMessage
Okay, I admit to being new with MSGPLus Live scripts and Jscript itself.
I'm trying to get my script to send a message in the current chat session. I'm looking at the ChatWnd: endMessage page in the help guide thing but every code piece I try doesn't work, returning errors in the debug window. Can someone give me an example on how to properly do this? Thanks.
|
|
05-01-2007 04:23 PM |
|
|
Felu
Veteran Member
Posts: 2223 Reputation: 72
30 / /
Joined: Apr 2006
Status: Away
|
RE: Need help with ChatWnd::SendMessage
What code are you using? We cannot help without that.
|
|
05-01-2007 04:27 PM |
|
|
Jacen
New Member
Posts: 8
Joined: May 2007
|
O.P. RE: Need help with ChatWnd::SendMessage
code: function OnEvent_MenuClicked(sMenuId){
*snip*
if(sMenuId=="mnuItem7"){
*snip*
ChatWnd.SendMessage("Test");
}
}
|
|
05-01-2007 04:29 PM |
|
|
Felu
Veteran Member
Posts: 2223 Reputation: 72
30 / /
Joined: Apr 2006
Status: Away
|
RE: Need help with ChatWnd::SendMessage
Whats "*snip*"? Remove it! Also make sure ChatWnd is defined.
|
|
05-01-2007 04:33 PM |
|
|
Huhu_Manix
Full Member
Upload me again... *salivate*
Posts: 106
– / / –
Joined: Jul 2006
|
RE: Need help with ChatWnd::SendMessage
You must specify what is the ChatWnd like that :
code: the_wnd=null;
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
the_wnd = ChatWnd;
}
function OnEvent_MenuClicked(sMenuId){
if(sMenuId=="mnuItem7"){
the_wnd.SendMessage("Test");
}
}
Yes and like Felu said, what's "*snips*" ?
This post was edited on 05-01-2007 at 04:37 PM by Huhu_Manix.
|
|
05-01-2007 04:35 PM |
|
|
Paril
Junior Member
Admin of Paril's Projects
Posts: 69
31 / /
Joined: Jul 2006
|
RE: Need help with ChatWnd::SendMessage
He's trying to use ChatWnd when it's undefined from what I can see.
-Paril
|
|
05-01-2007 04:36 PM |
|
|
Jacen
New Member
Posts: 8
Joined: May 2007
|
O.P. RE: Need help with ChatWnd::SendMessage
*snips* is where I removed code from the posting that was unrelated to my request.
code: function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
the_wnd = ChatWnd;
}
Since you defined the_wnd here, does this mean my script can't create a conversation? (It must have recieved one message from my contact?)
|
|
05-01-2007 04:44 PM |
|
|
vikke
Senior Member
Posts: 900 Reputation: 28
31 / /
Joined: May 2006
|
RE: RE: Need help with ChatWnd::SendMessage
quote: Originally posted by Jacen
code: function OnEvent_MenuClicked(sMenuId){
*snip*
if(sMenuId=="mnuItem7"){
*snip*
ChatWnd.SendMessage("Test");
}
}
You will have to add all parameters for OnEvent_MenuClicked, not just sMenuId. There is one called OriginWnd, which is the ChatWnd object.
Code:
code: function OnEvent_MenuClicked(sMenuId, Location, OriginWnd){
*snip*
if(sMenuId=="mnuItem7"){
*snip*
if(Location == 2){ // we are in chat window, not in contact list
OriginWnd.SendMessage("Test");
}
}
}
Changes are made in bold.
This post was edited on 05-01-2007 at 04:51 PM by vikke.
|
|
05-01-2007 04:48 PM |
|
|
Paril
Junior Member
Admin of Paril's Projects
Posts: 69
31 / /
Joined: Jul 2006
|
RE: Need help with ChatWnd::SendMessage
Is the function being called after you set the_wnd? If you tried clicking the menu beforehand it would just crash the script. I forget the function to get a chat window...
-Paril
|
|
05-01-2007 04:49 PM |
|
|
vikke
Senior Member
Posts: 900 Reputation: 28
31 / /
Joined: May 2006
|
RE: RE: Need help with ChatWnd::SendMessage
quote: Originally posted by Paril
Is the function being called after you set the_wnd? If you tried clicking the menu beforehand it would just crash the script. I forget the function to get a chat window...
-Paril
Use my code instead, it's how it should be.
|
|
05-01-2007 04:52 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|