Shoutbox

Selecting a chat window - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Selecting a chat window (/showthread.php?tid=87604)

Selecting a chat window by rukuro on 12-05-2008 at 01:36 AM

I am looking for a way to find out what window was selected. I was looking for something like a onmouseclick event.

Basically I have created a new window that pops up with a few buttons, depending on the button a different message is sent. The window is selected if a message was just received from them or I send a message, or alternatively if they use the menu I get the window selection via OnEvent_MenuClicked.

What other options are there that I can use? I am somewhat new to this and have searched but have been unable to find anything so far.

Thanks in advance.


RE: Selecting a chat window by matty on 12-05-2008 at 02:38 AM

You can store the chat window in a variable on message sent/received and do it that way.

Example:

JScript code:
// Variable to store the chat window
var oChatWnd;
 
function OnEvent_ChatWndDestroyed(pChatWnd) {
    // If a chat window is closed check to see if it is the current stored window, if so remove it
    if (typeof oChatWnd === 'object' && oChatWnd.Handle === pChatWnd.Handle) oChatWnd = null;
}
 
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
    oChatWnd = pChatWnd;
}
 
function OnEvent_ChatWndReceiveMessage(pChatWnd, sOrigin, sMessage, nMessageKind) {
    oChatWnd = pChatWnd;
}


Therefore when you go to send a message using your script make sure you check that
JScript code:
typeof oChatWnd === 'object'

Or else your script will fail.