What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » New Messages Popup

New Messages Popup
Author: Message:
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. New Messages Popup
Hey All,
sorry to ask for help so soon again but my script ran into a small brick wall.  I'm looking for how to call an event only on first  contact.

I'm not explaining it very well.  Basically I mean that when you recieve a message for the first time, WLM creates a popup telling you the contacts, and their message.  I'm looking to call a function when this happens, but not when subsequent messages are recieved, unless the window has been closed again.

is there any Event Handler or way to do this?

Cheers guys
[Image: adsig.jpg]
03-23-2007 11:48 PM
Profile E-Mail PM Web Find Quote Report
Jesus
Scripting Contest Winner
****

Avatar
Koffie, my cat ;)

Posts: 623
Reputation: 15
37 / Male / Flag
Joined: Jul 2005
RE: New Messages Popup
I'm not sure whether you want to call your function only if the contact initiates the chat or also when you start a convo and your contact responds for the first time.
My most logical guess is the first (contact initiates chat), so i wrote a bit of code for that:
code:
var aNewChat = new Array();
var aSent = new Array();

function OnEvent_ChatWndCreated(oChatWnd)
{
    aNewChat[oChatWnd.Handle] = 1;    //mark the convo as a new one
    MsgPlus.AddTimer("NewChat" + oChatWnd.Handle, 100);  //set a timer to remove "new" mark
}

function OnEvent_Timer(sTimerId)
{
    if (sTimerId.substr(0, 7) == "NewChat")
    {
        delete aNewChat[sTimerId.substr(7)];  //remove "new" mark
    }
}

function OnEvent_ChatWndSendMessage(oChatWnd, sMessage)
{
    aSent[oChatWnd.Handle] = sMessage;  //store last sent message for the chat window
}

function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, eMessageKind)
{
    if (sMessage == aSent[oChatWnd.Handle])  //check if you sent the message yourself
    {
        delete aSent[oChatWnd.Handle];  //if it was your message, delete it from the array
    } else {
        if (aNewChat[oChatWnd.Handle] == 1)  //check if it's a "new" convo
        {
            //do your stuff here
        }
    }
}
This code will do your stuff there if a contact sends a message which opens a chat on your side, or in the quite unlikely scenario where a contact sends you a message within 100ms after you opened a convo with them.

This post was edited on 03-24-2007 at 12:26 PM by Jesus.
Man is least himself when he is in his own person. Give him a mask and he will tell you the truth. (Oscar Wilde)
03-24-2007 12:25 PM
Profile PM Find Quote Report
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. RE: New Messages Popup
I'll give it a try, thanks mate.
[Image: adsig.jpg]
03-25-2007 04:38 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On