Shoutbox

Problem with ChatWndReceiveMessage's Message parameter - 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: Problem with ChatWndReceiveMessage's Message parameter (/showthread.php?tid=67421)

Problem with ChatWndReceiveMessage's Message parameter by higher on 10-17-2006 at 06:19 PM

Hi!

I want to make a script which replaces the built-in time indicator of messenger. So i would like to see the time of sending before every received and sent lines.

I tried to achieve this with the following code:

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind )
{
    var a = new Date;   
    MsgPlus.DisplayToast("",Message);
    return Message=a+Message;
   
}

The problem is, that the a variable overwrites the beginning of the Message string. It seems that Message has a fixed length, and it cannot be extended, so my received messages' first letters are always overwritten by the date variable.
Sorry for language, and the basic question.


RE: Problem with ChatWndReceiveMessage's Message parameter by foaly on 10-17-2006 at 06:23 PM

yes the string you return can't be longer then the string that gets in...


RE: Problem with ChatWndReceiveMessage's Message parameter by higher on 10-20-2006 at 04:41 PM

But there must be a solution for this problem, i don't want to believe that the script engine's possibilities are so limited.


RE: Problem with ChatWndReceiveMessage's Message parameter by Felu on 10-20-2006 at 04:49 PM

quote:
Originally posted by higher
But there must be a solution for this problem, i don't want to believe that the script engine's possibilities are so limited.
There isn't as far as i know. And the scripting engine is limited.
RE: Problem with ChatWndReceiveMessage's Message parameter by Plik on 10-20-2006 at 05:15 PM

quote:
Originally posted by higher
But there must be a solution for this problem, i don't want to believe that the script engine's possibilities are so limited.
I imagine the reason for the limit is due to the way plus puts the returned value back into messenger.

Messenger will have already put the origional message into memory and allocated a set size of memory for it. When plus goes to give messenger the new string that you return, if that string is longer than the origional one it wont fit in the space its given. Hence the limit.