Shoutbox

Getting Contacts name. - 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: Getting Contacts name. (/showthread.php?tid=86489)

Getting Contacts name. by apex on 10-08-2008 at 06:49 PM

Hey all,

i made a (very) tiny script to change my psm.

The script auto detects if i use any smiley's like

code:
:) :D :P and (A)
and changes my psm according to the smiley.

Example:

When i say :) at the beginning of my sentence, the script changes my PSM to: "I am happy now."

BUT

I want to change it so that if i type :) in a convorsation with john, the psm will say:

Thx to John i am happy now!

I made it like this:

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    var cmd;
    var msg;
    var param = new Array();
    var sitem;
    var sarray = new Array();
    sarray = Message.split(" ");
    msg = "";   
    for (sitem in sarray)
    {
        switch(sitem)                 
        {
            case "0":   
                cmd = sarray[sitem].toLowerCase();
            break;
            default:
                param[sitem] = sarray[sitem].toLowerCase();
                msg += " " + sarray[sitem];
            break;
        }
    }
    if(cmd == ":)")
    {
    Messenger.MyPersonalMessage = "Huidige Stemming: Blij! :)" + name + "test";
    }
        else if(cmd == ":(")
    {
    Messenger.MyPersonalMessage = "Huidige Stemming: Niet blij! ";
    }
        else if(cmd == ":d")
    {
    Messenger.MyPersonalMessage = "Huidige Stemming: Erg blij!! ";
    }
        else if (cmd == ":'(")
    {
    Messenger.MyPersonalMessage = "Huidige Stemming: Verdrietig. ";
    }
        else if(cmd == ":@")
   
    Messenger.MyPersonalMessage = "Huidige Stemming: Boos! ";
    }
        else if(cmd == ":o")
    {
    Messenger.MyPersonalMessage = "Huidige Stemming: Verast. ";
    }
        else if(cmd == "(l)")
    {
    Messenger.MyPersonalMessage = "Huidige Stemming: Verliefd! ";
    }
        else if(cmd == "(u)")
    {

}

But i don't know how to get the contacts name?

p.s.  Some parts are dutch but their not important for the script.
RE: Getting Contacts name. by matty on 10-08-2008 at 06:58 PM

the ChatWnd parameter has a Contacts object which you need to iterate through

code:
for(var oContact = new Enumerator(ChatWnd.Contacts); !oContact.atEnd(); oContact.moveNext()){
    Debug.Trace(oContact.item().Name);
}