What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » SendMessage

SendMessage
Author: Message:
logie
New Member
*

Avatar

Posts: 2
Joined: Jul 2006
O.P. Huh?  SendMessage
well hello there all you nice people (H)

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 :D
[Image: gaiden.jpg]
07-06-2006 10:13 PM
Profile E-Mail PM Find Quote Report
Dhaya
Junior Member
**

Avatar
lala~

Posts: 25
Reputation: 4
38 / Male / –
Joined: Jul 2006
RE: SendMessage
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);
}

Godamn JScript ! I HATE you ! ... but I love you so much <3
07-06-2006 10:24 PM
Profile PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
RE: SendMessage
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 :)

This post was edited on 07-06-2006 at 10:26 PM by foaly.
07-06-2006 10:25 PM
Profile E-Mail PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: SendMessage
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;
  }
}


This post was edited on 07-06-2006 at 10:36 PM by Ezra.
[Image: 1-0.png]
             
07-06-2006 10:32 PM
Profile PM Web Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
RE: RE: SendMessage
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...
07-06-2006 10:35 PM
Profile E-Mail PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: SendMessage
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;
  }
}
[Image: 1-0.png]
             
07-06-2006 10:53 PM
Profile PM Web Find Quote Report
logie
New Member
*

Avatar

Posts: 2
Joined: Jul 2006
O.P. RE: SendMessage
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
[Image: gaiden.jpg]
07-07-2006 12:05 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On