SendMessage - 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: SendMessage (/showthread.php?tid=62702)
SendMessage by logie on 07-06-2006 at 10:13 PM
well hello there all you nice people
I was wondering on this command in the documentation...
code: [boolean] SendMessage(
[string] Message
);
This code is to send a message through your window to your contacts window!
my Query however is how to put this string of code to use.
Something like this
code: if(Msg == "^CurrentMedia"){
var Message = "/me is now playing " + Messenger.CurrentMedia + ;
MsgPlus.ChatWndSendMessage("", Message)
Does Anyone know what i am talking about or have i amde it too complicating? any help wud be amazin, Thank you
RE: SendMessage by Dhaya on 07-06-2006 at 10:24 PM
SendMessage is a function inherited from ChatWnd object.
You'll have to use it this way :
code: function OnEvent_ChatWndSendMessage(ChatWnd,Msg)
{
if (Msg == "^CurrentMedia")
{
var Message = "/me is now playing " + Messenger.CurrentMedia;
ChatWnd.SendMessage(Message);
}
RE: SendMessage by foaly on 07-06-2006 at 10:25 PM
something like this works:
code: function OnEvent_ChatWndSendMessage(ChatWnd, sMessage){
if(sMessage == "^^CurrentMedia"){
var Message = "/me is now playing "+ Messenger.CurrentMedia ;
ChatWnd.SendMessage(Message);
sMessage="";
return sMessage;
}
}
edit: Dhaya you are faster
RE: SendMessage by Ezra on 07-06-2006 at 10:32 PM
quote: Originally posted by foaly
something like this works:
code: function OnEvent_ChatWndSendMessage(ChatWnd, sMessage){
if(sMessage == "^^CurrentMedia"){
var Message = "/me is now playing "+ Messenger.CurrentMedia ;
ChatWnd.SendMessage(Message);
sMessage="";
return sMessage;
}
}
Why do you use the SendMessage and return an empty string and not just return the new string?
Also the script doesn't return anything if the if statement is false
code: function OnEvent_ChatWndSendMessage(ChatWnd, sMessage)
{
if (sMessage.match(/^\^currentmedia(\s+|$)/i) != null)
{
return "/me is now playing " + Messenger.CurrentMedia;
}
else
{
return sMessage;
}
}
RE: RE: SendMessage by foaly on 07-06-2006 at 10:35 PM
quote: Originally posted by Ezra
quote: Originally posted by foaly
something like this works:
code:
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage){
if(sMessage == "^^CurrentMedia"){
var Message = "/me is now playing "+ Messenger.CurrentMedia ;
ChatWnd.SendMessage(Message);
sMessage="";
return sMessage;
}
}
Why do you use the SendMessage and return an empty string and not just return the new string?
Also the script doesn't return anything if the if statement is false
I used the SendMessage because that was the question...
and ofcourse it will return something if the statement is false...
RE: SendMessage by Ezra on 07-06-2006 at 10:53 PM
I don't know the Scripting Documentation says you have to return something so that's the nicest way anyhoo.
And that way the string returned is very ugly.
So I made this: will write "/me is listening to %title% by %artist%"
code: var string = new Array();
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage)
{
if (sMessage.match(/^\^currentmedia(\s+|$)/i) != null)
{
string = Messenger.MyCurrentMedia.split("\\");
switch (string[0])
{
case "ITunes":
return "/me is now playing " + string[4].substr(1) + " by " + string[5].substr(1);
break;
case "":
return "/me is now playing " + string[4].substr(1) + " by " + string[5].substr(1);
break;
default:
return "/me is now playing " + Messenger.MyCurrentMedia;
}
}
else
{
return sMessage;
}
}
RE: SendMessage by logie on 07-07-2006 at 12:05 PM
i am trying to put the name of the song im playin thru the Window also.
This program is Ares
How would i got about this?
p.s Ty for all the amazin retuns guys
|