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

[OK]SendMessage Function
Author: Message:
Lén
Junior Member
**

Avatar

Posts: 16
34 / Male / Flag
Joined: Feb 2008
O.P. [OK]SendMessage Function
Hey it's me, again *-)

well, i would send a message in a window ... not that hard if i want to send it to the last personn who has talk to me, but ... if i want to choose another personn ?

I've found in the Help that i should use SendMessage:
http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx

But how can i use it in the msg plus! Jscript ?

i've tried:

han = 2425418
SendMessage(han,"my string",0,0);


but t doesn't work .... i caught  the handle with:

var e = new Enumerator(Windows);
        for(; !e.atEnd(); e.moveNext())
        {
            var ChatWindow = e.item();
            Debug.Trace(" Handle: " + ChatWindow.Handle);
        }



Thanks !

This post was edited on 08-10-2009 at 07:49 PM by Lén.
08-09-2009 10:12 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: SendMessage Function
You want the ChatWindow object, not the handle. Then use it like

Javascript code:
    ChatWindow.SendMessage("blah");

<Eljay> "Problems encountered: shit blew up" :zippy:
08-09-2009 11:00 PM
Profile PM Find Quote Report
Lén
Junior Member
**

Avatar

Posts: 16
34 / Male / Flag
Joined: Feb 2008
O.P. RE: SendMessage Function
You didn't read my message !

If you have 3 chat windows opened, how do you know wich window it will be send ?

i can't use your code 'cause it send the msg to the "active" window ....

This post was edited on 08-09-2009 at 11:29 PM by Lén.
08-09-2009 11:26 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: SendMessage Function
I did read it but I assumed you would understand...


Use this to send to someone on your contact list...

Javascript code:
for(var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext()){
     if(e.item().Email == "Person you want to send message to"){
          e.item().SendMessage("blah");
          //e.item() = ChatWnd object
      }
}


Use this to send to someone who you have an open window with

Javascript code:
for(var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()){
     if(e.item().Email == "Person you want to send message to"){
          e.item().SendMessage("blah");
          //e.item() = ChatWnd object
      }
}


This post was edited on 08-10-2009 at 09:14 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
08-09-2009 11:46 PM
Profile PM Find Quote Report
Lén
Junior Member
**

Avatar

Posts: 16
34 / Male / Flag
Joined: Feb 2008
O.P. RE: SendMessage Function
I Love You <3
Errrr...
Thanks A lot !!!!

EDIT:

I can't use the first cause i've never used Enumerator so ... where can I put SendMessage ? how ?
and the second, with opened windows ... tell me that ChatWnd is undefined (but i have 2 chats opened, and i'm online ... and for this one, i don't know either where and how to use SendMessage here.

Is that e.SendMessage ( errr no it doesn't work).

Sorry but i've started Javascript, Jscript and xml 3 days ago, i'm in love with ruby, it's lotta easier.

This post was edited on 08-10-2009 at 02:58 AM by Lén.
08-10-2009 02:23 AM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: SendMessage Function
Edited previous post. I made a  bit of a mistake...

It's:

code:
e.item().SendMessage("this is a message");

It is the e.item() you want, not e.SendMessage;
<Eljay> "Problems encountered: shit blew up" :zippy:
08-10-2009 09:16 AM
Profile PM Find Quote Report
Lén
Junior Member
**

Avatar

Posts: 16
34 / Male / Flag
Joined: Feb 2008
O.P. RE: SendMessage Function
Yey but .... no :D

i've already tried, and i've just retried with your code,
the debug tell me that e.item doesn't use this property or method on
code:
e.item().SendMessage("blah");

This post was edited on 08-10-2009 at 12:02 PM by Lén.
08-10-2009 12:02 PM
Profile PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: SendMessage Function
Spunky and Lén: you can't apply SendMessage() to a Contact object. You need to chatWnd=Messenger.OpenChat(e.item()) and then chatWnd.SendMessage("the message").
08-10-2009 12:28 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: SendMessage Function
Ah, got confused with the original code... I knew it was the chatwnd object, but forgot that returned a contact...
<Eljay> "Problems encountered: shit blew up" :zippy:
08-10-2009 12:53 PM
Profile PM Find Quote Report
Lén
Junior Member
**

Avatar

Posts: 16
34 / Male / Flag
Joined: Feb 2008
O.P. RE: SendMessage Function
thanks it finally works great !

if you have a bit of time, check my second post:
http://shoutbox.menthix.net/showthread.php?tid=91809
08-10-2009 07:49 PM
Profile 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