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

auto messaging
Author: Message:
jollyscripts
Junior Member
**


Posts: 16
Joined: Aug 2007
O.P. auto messaging
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {

    if(Origin != Messenger.MyName) {

        if(Message == "hi") {
       
           
         
            ChatWnd.SendMessage("hey, how r u")         
           
           
        }
    }
}

that is a script i wrote for my msn

now i want to be able to do the following

1) apply it to certain email addresses.
2) send it a certain amount of times

PLEASE HELP
09-07-2007 06:55 PM
Profile E-Mail PM Find Quote Report
davidpolitis
Full Member
***


Posts: 371
Reputation: 16
Joined: Aug 2006
RE: auto messaging
MessageKind is optional, it does not need to be declared in the function in this case...

Anyway... not sure if this is what you really wanted.

code:
//number of times to send message
var times = "2";

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message)
{
    if (Origin != Messenger.MyName)
    {
        if (Origin == "example@hotmail.com")
        {
            if (Message == "hi")
            {
                for(i=0; i<times; i++)
                {
                    ChatWnd.SendMessage("hey, how r u");   
                }     
            }
        }
    }
}
09-08-2007 04:58 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: auto messaging
Sorry, but I have to note that Origin is the name of the user sending the message, and thus is not the e-mail address of the person. Therefore, you'd need to loop through the conversation contacts looking for the Origin, like this:
code:
//number of times to send message
var times = 2; //Why do you make this a string and force JScript to convert it to a number each time?

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message)
{
    if (Origin != Messenger.MyName)
    {
        //Start contact search
        var sEmail = ""; //Create a variable to store the e-mail in
        //Loop through the contacts in the chat
        for(var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext)
        {
            //If the contact's name matches the name of the sender...
            if (e.item().Name == Origin)
            {
                sEmail = e.item().Email; //Store the e-mail address
                break; //Exit the loop
            }
        }
        //End contact search
        if(sEmail == "example@hotmail.com")
        {
            if (Message == "hi")
            {
                for(i=0; i<times; i++)
                {
                    ChatWnd.SendMessage("hey, how r u");   
                }     
            }
        }
    }
}
If you mean with "send it a certain amount of times" that you want to set a maximum amount of times the message should be sent, it'll get a bit more complicated. I'll explain that if you really need to know. :)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-08-2007 06:24 PM
Profile E-Mail PM Web Find Quote Report
davidpolitis
Full Member
***


Posts: 371
Reputation: 16
Joined: Aug 2006
RE: auto messaging
Sorry mattike, thanks for pointing that out.

I Just read in the doumentation that it'll return their nickname.

This post was edited on 09-08-2007 at 09:00 PM by davidpolitis.
09-08-2007 08:58 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