quote:
Originally posted by A06
Hi !
i've a problem with my script...
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
if (Message.match(/^!massmsg$/))
{
MsgPlus.DisplayToast("Mass Message :: Usage","!massmsg <message>");
return "";
}
else if (Message.match(/^!massmsg .+/))
{
var strMessage = Message.substr(9);
Debug.trace(strMessage);
var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
var Contact = e.item();
for(; !e.atEnd(); e.moveNext())
{
var Contact = e.item();
if (Contact.Status != 1)
{
var ChatWnd2 = Messenger.OpenChat(Contact.Email);
Debug.trace(strMessage);
ChatWnd2.SendMessage(strMessage);
}
}
return "";
}
}
The Error : Erreur : 'null' a la valeur Null ou n'est pas un objet..
~= 'null' egal Null or is not an object.
The line where is signaled the error : ChatWnd2.SendMessage(strMessage);
The both Debug.trace(strMessage) are Ok
Maybe you have added your Address in your contacts list....(i mean that maybe you have added yourself contact...example:if your email is mmm@hotmail.com..you have added a contact with mmm@hotmail.com address...)if it's so...you must change your code like this because you can't send yourself a message :
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
if (Message.match(/^!massmsg$/))
{
MsgPlus.DisplayToast("Mass Message :: Usage","!massmsg <message>");
return "";
}
else if (Message.match(/^!massmsg .+/))
{
var strMessage = Message.substr(9);
Debug.trace(strMessage);
var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
var Contact = e.item();
for(; !e.atEnd(); e.moveNext())
{
var Contact = e.item();{
if (Contact.Email!=Messenger.MyEmail){
if (Contact.Status != 1)
{
var ChatWnd2 = Messenger.OpenChat(Contact.Email);
Debug.trace(strMessage);
ChatWnd2.SendMessage(strMessage);
}}}
}
return "";
}
}
EDIT:MOREOVER PAY ATTENTION THAT A WLM SERVERS HAVE A LIMITATION YOU CAN'T SEND A MESSAGGE TOO YOUR CONTATCS IN A MINUTE.THE SERVER REFUSES IT