What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » send message withouth knowing windowhandle?

send message withouth knowing windowhandle?
Author: Message:
runarius
New Member
*


Posts: 12
Joined: Jul 2007
O.P. send message withouth knowing windowhandle?
Hi, I am a script developer for the salling clicker(software for using any bluetooth phone as a remotecontrol for the computer) and right now, I am creating a script for using msn on your phone, through salling clicker.

I was just wondering if it is possible to send a message from the msn-plus-script to a contact with just knowing his e-mail adress? I know it is possible with the window-handle but I don't want to use that approach.

Also, is it possible to export all of my online contact and their status to a textfile?
07-23-2007 01:01 AM
Profile E-Mail PM Find Quote Report
Deco
Full Member
***


Posts: 188
Reputation: 4
42 / Male / Flag
Joined: Aug 2006
RE: send message withouth knowing windowhandle?
Well to send message to a contact knowing his email...

1) Iterate the contact list object
2) Match the email you want with the contact's object
3) Use the OpenChat function sending the contact you found
4) Check if the chat window was opened
5) Send your message with the SendMessage function.

code:
var strEmail = "email@email.com";
var strMsg = "msg you want to send";
var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext())
{
    var Contact = e.item();
                if (Contact.Email == strEmail) {
                    var ChatWnd = Messenger.OpenChat(Contact);
                    if(ChatWnd != "null") {
                       ChatWnd.SendMessage(strMsg);
                    } else {
                        //actions in case it could not open the chat
                    }
}

}


I wrote this from the top of my head so I might have missed something. I'm sure someone will correct me if I'm wrong or if there's a better method. Didn't test the code. But I'm sure this will give you a clue on which direction to go. Have fun!

07-23-2007 01:24 AM
Profile E-Mail PM Web Find Quote Report
runarius
New Member
*


Posts: 12
Joined: Jul 2007
O.P. RE: send message withouth knowing windowhandle?
thank you so much, that really helps me alot:D great respond time too:D
07-23-2007 02:32 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: send message withouth knowing windowhandle?
Deco is forgetting about:
- Checking your own status
- Checking if the Messenger object is available
- Checking the status of the contact
- Testing if you can send a message at all

Very important things you also must do...

And instead of doing the long iterating loop, you can use the GetContact function.

note: a Yahoo contact also has a prefix to its email.

;)

This post was edited on 07-23-2007 at 02:51 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-23-2007 02:46 AM
Profile PM Find Quote Report
runarius
New Member
*


Posts: 12
Joined: Jul 2007
O.P. RE: send message withouth knowing windowhandle?
hmm... could you help me with that? also, what I am trying to do now is just to save the contacts data to a textfile. But one of my contacts give me an error. This is the data I am trying to store:

<name>&#1178;*&#8236;&#8236;&#8236;&#8236;&#8236;&#8236;&#8236;&#8237;&#8300;&#8301;&#8301;&#8302;&#8303;&#8204;&#8205;isto&#1170;&#1170;er</name><email>pickupsrulz@hotmail.com</email><status>In a Call</status><pMsg></pMsg>

* After the first K in his name there is a wierd symbol that I can't show here. it is really a R with a circle around it.

I guess it is giving me the error becouse he is using an unusual sign, the R with the circle around it... anyway I could turn it into normal characters? don't think salling clicker supports wierd symbols, don't know really, but for now it would be great. or I could just manually check every message if they hold any odd symbols and then turn them into the right one, in this case, search for that odd looking R with the circle and replace it with a normal R.

This post was edited on 07-23-2007 at 03:09 AM by runarius.
07-23-2007 03:06 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: send message withouth knowing windowhandle?
You already asked that question in another thread and I provided the correct code.

Matty's reply to headache: Special characters.
07-23-2007 05:16 PM
Profile E-Mail PM Find Quote Report
mistertech
New Member
*

Actual size may differ from shown

Posts: 1
44 / Male / Flag
Joined: Jul 2007
RE: send message withouth knowing windowhandle?
Ok here's the simple way to send a message straight to a contact:


var contact = Messenger.OpenChat([email address]);
//variable contact is now an official ChatWnd object
contact.SendMessage([Message or variable to send]);
//message will be sent to the friend assigned to the variable


Keep in mind, this does not send messages to people who have not been added to your contact list yet.

As far as text files, there are some code snippets at

www.mpscripts.net

However I could not get them to work.(Didn't debug the code to figure out why; could be their code or mine).  You are looking for Windows Script Host functions.  They deal with files and the registry and many other things Windows related.  You'll find a link to the info on the functions in the Messenger Plus! Live Scripting Documentation under heading:
Objects Reference\MsgPlus Object\Properties\ScriptRegPath
Here is a direct link:

http://msdn2.microsoft.com/en-us/library/2x3w20xf.aspx

I hope it helps
07-25-2007 05:06 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: send message withouth knowing windowhandle?
quote:
Originally posted by mistertech
Ok here's the simple way to send a message straight to a contact:


var contact = Messenger.OpenChat([email address]);
//variable contact is now an official ChatWnd object
contact.SendMessage([Message or variable to send]);
//message will be sent to the friend assigned to the variable

Keep in mind, this does not send messages to people who have not been added to your contact list yet.
That code wil fail in many more situations though. You must do some additional checks. See my previous post. ;)
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-25-2007 06:16 AM
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