K, you have a few problems we need to address.
quote:
Originally posted by Vexor
function OnEvent_ChatWndCreated(Origin)
OnEvent_ChatWndCreated doesn't have an Origin parameter, just ChatWnd.
quote:
Originally posted by Vexor
if (Origin = Messenger.MyName)
If you're comparing two things, use == instead of =. But this if statement isn't needed anyway because there's no Origin to check.
quote:
Originally posted by Vexor
MsgPlus.DisplayToastContact(Origin ,"Opened a Chat Window With", Origin ,"CHIMES.WAV");
With that, you're saying "Open a toast with the title 'Origin' (which doesn't exist), have text of 'Opened a Chat Window With', play the sound 'Origin' and run the function 'CHIMES.WAV' when you click the toast." Also, you don't need to use DisplayToastContact. Ignore that, didn't realize DisplayToastContact used different params.
I'd still suggest using DisplayToast instead.
code:
function OnEvent_ChatWndCreated(ChatWnd)
{
var Contacts = ChatWnd.Contacts; //Get names of contacts in newly created window.
var e = new Enumerator(Contacts); //iterate ChatWnd.Contacts (see: http://m00.cx/mpl/docs/ref-contacts-iterator.htm)
var Contact = e.item();
MsgPlus.DisplayToast(Messenger.MyName,"Opened a Chat Window With\n" + Contact.Email,"CHIMES.WAV"); //create the toast.
}
(Won't work with multi-user convos, but it works fine for the creating of a single person window. However, this toast will appear when someone sends a message to you if you do not have a window open with them before.)
EDIT: Use markee's script because I was too lazy to add a ChatWnd.Count check. My above points still stand though
EDIT2:
code:
function OnEvent_ChatWndCreated(ChatWnd)
{
var ChatWndContacts = ChatWnd.Contacts;
if(ChatWndContacts.Count == 1)
{
var e = new Enumerator(ChatWndContacts);
var Contact = e.item();
MsgPlus.DisplayToast(Messenger.MyName,"Opened a Chat Window With\n" + Contact.Email,"CHIMES.WAV");
}
}
Use that.