Shoutbox

[Solved] Problem with ChatWndSendMessage event (i guess) - 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: [Solved] Problem with ChatWndSendMessage event (i guess) (/showthread.php?tid=62459)

[Solved] Problem with ChatWndSendMessage event (i guess) by Blaggi on 07-03-2006 at 08:51 PM

Alright, so i got this PHP Miniature picture wich is always refreshed like a little chat..

I want MsgPlus to read the last entry from it, i prepared another PHP File for that, and the reading works with no problem

So here is the code:

code:
function OnEvent_Initialize(MessengerStart)
{
     MsgPlus.DisplayToast("Loaded", "Sigchat updater loaded!");
}

function OnEvent_Uninitialize(MessengerExit)
{
     MsgPlus.DisplayToast("Unloaded", "Sigchat updater unloaded!");
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
     if (Message == '#check') {
          var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          xmlhttp.open("GET", "http://flippeh.de/minichat_last.php", true);
          xmlhttp.onreadystatechange=function() {
               if (xmlhttp.readyState==4) {
                    Debug.Trace("Hi from success!");
                    Message = xmlhttp.responseText;
               }
          }
          xmlhttp.send('');
     }
     return false;
}

So, when i enter "#check", it actually sends "#check" into the conversation.
I want it to send the last entry from it, and not my keyword..

I tried return, and Message =, but nothing worked...

Would be really nice if someone could help me with it =)
RE: Problem with ChatWndSendMessage event (i guess) by foaly on 07-03-2006 at 09:05 PM

code:
if (Message == '#check') {
          var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          xmlhttp.open("GET", "http://flippeh.de/minichat_last.php", true);
          xmlhttp.onreadystatechange=function() {
               if (xmlhttp.readyState==4) {
                    Debug.Trace("Hi from success!");
                    Message = "";
                    //return xmlhttp.responseText;
               }
          }
          xmlhttp.send('');

        return Message;
     
}
     return false;
}


should work
RE: Problem with ChatWndSendMessage event (i guess) by Blaggi on 07-03-2006 at 09:10 PM

Aaaaaaaaaaand it did work! =D
Thanks alot, so i need to return the Message variable at the end of the Eventfunction?

Okay, learned =P