What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Toast Box Help

Pages: (2): « First [ 1 ] 2 » Last »
Toast Box Help
Author: Message:
Vexor
Full Member
***

Avatar
Pure Capital Gain

Posts: 162
Reputation: 7
42 / Male / –
Joined: Jan 2006
O.P. Toast Box Help
code:
function OnEvent_ChatWndCreated(Origin)
{
if (Origin = Messenger.MyName)
{
MsgPlus.DisplayToastContact(Origin ,"Opened a Chat Window With", Origin ,"CHIMES.WAV");
}
}


Ok you can see what code I have, now, I am trying to get it so that My name shows up at the top of the Toast Box (does that fine), Has a message (does that fine), and also shows the name of the person that I open a ChatWindow with (That I have spend 3 days trying to do. and it wont)

can someone help me?

code:
Vexor

Opened a Chat Window With
Contact


That is what I want it to basically look like.
[Testing A Bunch Of Different Betas']
[Image: DaFuca.png]
07-20-2006 11:03 AM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: Toast Box Help
Try this instead
code:
function OnEvent_ChatWndCreated(ChatWnd)
{
var ChatWndContacts = ChatWnd.Contacts;
  if(ChatWndContacts.Count == 1)
  {
    var e = new Enumerator(ChatWndContacts);
    var Contact = e.item();
{
MsgPlus.DisplayToastContact(Messenger.MyName ,"Opened a Chat Window With", Contact.Name ,"CHIMES.WAV");
}
}
}
Though it doesn't matter if it is you or your contact that creates the window it will always say it's you.  I really don't know how to change this so it only happens on you opening the chat window (like i think you want gthered by your code)

EDIT: Ddunk's post explains it better and so does his code, I just used the DisplayToastContact because I keep forgetting how to do the extra line stuff :P also I have it only come up if there is only one contact in the chat (this is done by the fourth line)

This post was edited on 07-20-2006 at 11:26 AM by markee.
[Image: markee.png]
07-20-2006 11:20 AM
Profile PM Find Quote Report
ddunk
Veteran Member
*****

Avatar

Posts: 1228
Reputation: 51
35 / Male / Flag
Joined: Mar 2004
RE: Toast Box Help
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. :P 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 :P

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.

This post was edited on 07-20-2006 at 11:29 AM by ddunk.
07-20-2006 11:21 AM
Profile E-Mail PM Web Find Quote Report
Vexor
Full Member
***

Avatar
Pure Capital Gain

Posts: 162
Reputation: 7
42 / Male / –
Joined: Jan 2006
O.P. RE: Toast Box Help
Thankx Markee that seems to work for now..

Ddunk, I looked as the link you sent and it was just more confuzing.. and with the
code:
function OnEvent_ChatWndCreated(Origin)
in there it seemed to work with it having

code:
vexor

has opened a chat windows with
vexor


so it worked, just did not (no matter what i changed or what way i went) allow me to have a contacts name, and with origin not in this
code:
function OnEvent_ChatWndCreated(Origin)
it did not work at all.
[Testing A Bunch Of Different Betas']
[Image: DaFuca.png]
07-20-2006 11:29 AM
Profile PM Find Quote Report
ddunk
Veteran Member
*****

Avatar

Posts: 1228
Reputation: 51
35 / Male / Flag
Joined: Mar 2004
RE: Toast Box Help
quote:
Originally posted by Vexor
in there it seemed to work with it having
The reason it worked was because with "Origin = Messenger.MyName", you were setting the variable 'Origin' to be Messenger.MyName.
07-20-2006 11:32 AM
Profile E-Mail PM Web Find Quote Report
Vexor
Full Member
***

Avatar
Pure Capital Gain

Posts: 162
Reputation: 7
42 / Male / –
Joined: Jan 2006
O.P. RE: Toast Box Help
that might be why.. but thank you anyway.
[Testing A Bunch Of Different Betas']
[Image: DaFuca.png]
07-20-2006 11:33 AM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: Toast Box Help
I think I can make something to show it from the different contacts, all depending on if your contact sent you the message, but that is going to become longer.  I'll try it out for you and see what I can do for you.

Btw Ddunk
quote:
Originally posted by Ddunk
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. (Smilie) I'd still suggest using DisplayToast instead.
Really it only needed the DisplayToast, the difference between them is that DisplayToastContact allows you to have the likes of colour, bold, italics, etc in the first line and automatically puts the next lot of quotes on the next line.
[Image: markee.png]
07-20-2006 11:39 AM
Profile PM Find Quote Report
Vexor
Full Member
***

Avatar
Pure Capital Gain

Posts: 162
Reputation: 7
42 / Male / –
Joined: Jan 2006
O.P. RE: Toast Box Help
Now is there a way to get it to show when a contact opens a chat with you,

code:
ContactName
Has opened a chat with you.

This will be useful, As I have my toasts so that they are visable while I am in some games, and if I can see when a contact opens a chat window with me, then I can Minimize the game to talk if i want to talk to that person..
[Testing A Bunch Of Different Betas']
[Image: DaFuca.png]
07-20-2006 11:53 AM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: Toast Box Help
This should do what you want it to do, though I haven't been able to test it when a contact opens a message I must say (all are either offline or I dont want to talk to them anyway :P).  I trust that part of the code anyway.  I hope you like it.  I must also add that this script does not show when they open a window with you but more when they send you a message which opens a window on your computer.
code:
var cont;
function OnEvent_ChatWndCreated(ChatWnd)
{
var ChatWndContacts = ChatWnd.Contacts;
  if(ChatWndContacts.Count == 1)
  {
    var e = new Enumerator(ChatWndContacts);
    var Contact = e.item();
    cont = 1
    MsgPlus.AddTimer('TimerId', '100')
  }
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
  if (cont == 1)
  {
    MsgPlus.DisplayToastContact(Contact.Name ,"Opened a Chat Window With", Messenger.MyName ,"CHIMES.WAV");
    cont = ''
  }
}

function OnEvent_Timer(TimerId)
{
  if (TimerId == "TimerId")
  {
    if (cont == 1)
    {
      var Windows = Messenger.CurrentChats;
      var e = new Enumerator(Windows);
      for(; !e.atEnd(); e.moveNext())
      {
        var ChatWnd = e.item();
        var ChatWndContacts = ChatWnd.Contacts;
        if(ChatWndContacts.Count == 1)
        {
          var e = new Enumerator(ChatWndContacts);
          var Contact = e.item();
          MsgPlus.DisplayToastContact(Messenger.MyName ,"Opened a Chat Window With", Contact.Name ,"CHIMES.WAV");
          cont = ''
        }
      }
    }
  }
}
Hope it's what you were looking for. :)
[Image: markee.png]
07-20-2006 01:02 PM
Profile PM Find Quote Report
Vexor
Full Member
***

Avatar
Pure Capital Gain

Posts: 162
Reputation: 7
42 / Male / –
Joined: Jan 2006
O.P. RE: Toast Box Help
Na it only toasts when i open a chat window form my start bar.
[Testing A Bunch Of Different Betas']
[Image: DaFuca.png]
07-20-2006 01:24 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« 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