Shoutbox

Won't display toasts - 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: Won't display toasts (/showthread.php?tid=86445)

Won't display toasts by Addenorw on 10-06-2008 at 05:08 PM

MSN won't display my toasts in my script.

code:
function OnEvent_Initialize(MessengerStart)
{
      Debug.Trace("Hello World!");
}

function OnEvent_Signin(Email)
{
if (email == "andvibeto@msn.com")
{
   var Message = "Hello Master " + Messenger.MyName + "!";
   Message = MsgPlus.RemoveFormatCodes(Message);
   MsgPlus.DisplayToast("", Message);

}

function OnEvent_ContactSignin(Email)
{
var Message = "Latest INTEL:" + Messenger.ContactName + "has just signed in";
Message = MsgPlus.RemoveFormatCodes(Message);
MsgPlus.DisplayToastContact("", CtcName, message);
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind)
{
var Message = Messenger.ContactName + "vil snakke, plage deg eller bare si hallo. Your choice";
Message = MsgPlus.RemoveFormatCodes(Message);
MsgPlus.DisplayToast("", CtcName, message);
}

function OnEvent_Signout(Email)
{
if (email == "andvibeto@msn.com")
{ var Message = "Until next time Master" + Messenger.MyName + ", have a good time!";
   Message = MsgPlus.RemoveFormatCodes(Message);
   MsgPlus.DisplayToast("", Message);
}
}

function OnEvent_Uninitialize(MessengerExit)
{
     Debug.Trace ("Goodbye World!");
}


Do anyone see what is wrong?
RE: Won't display toasts by Spunky on 10-06-2008 at 05:22 PM

Yes, you're not getting the variable CtcName from anywhere... You need to iterate through a contact object (from using the email and GetContact function) to get a name


RE: Won't display toasts by Addenorw on 10-06-2008 at 05:27 PM

What function should I use then? My intention with that one was to show the original "x has just signed in". Email won't be right, because then I would be having to write an email for everybody i want it to show for, or?

Edit: It won't show any toasts at all. Some of the toast was showen before I added some more


RE: Won't display toasts by roflmao456 on 10-06-2008 at 07:54 PM

to iterate through a Contacts object, first you must start a for statement:

code:
for(
then, add the enumerator object as a variable (and the parameters as the Contacts object):
code:
var e = new Enumerator(ChatWnd.Contacts);
loop through the enumeration while it isn't at the end:
code:
!e.atEnd; e.moveNext()
end the for statement and add braces.
code:
){
// some code here (occurs for each item)..
}

then get the Contact Object items by using
code:
e.item();
.

:P


but then also, since you're doing that in the ChatWndReceiveMessage, it has an Origin parameter which has the contact's (or your) name in it (depending on who just sent a message)

RE: Won't display toasts by matty on 10-06-2008 at 08:20 PM

quote:
Originally posted by Addenorw
Messenger.ContactName
And this doesn't exist

You need to use

code:
var sName = Messenger.Contacts.GetContact(Email).Name;