What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » My First Script, some problems

My First Script, some problems
Author: Message:
Xat
New Member
*

Avatar

Posts: 13
– / Male / Flag
Joined: Jan 2008
O.P. My First Script, some problems
Hi !

I want make a script, but I haven't knowledge on JS scripting...

What my script must do normally :
  • When I type a command, send a message
  • these commands run only if the beginning of the mail adress of my contct is "XXX" (for example)

If someone can help me... Here's what I did :
code:
function OnGetScriptCommands()
{
    var commands = '<ScriptCommands>';
        commands+='<Command>';
            commands+='<Name>command1</Name>';
            commands+='<Description>cmd1.</Description>';
            commands+='<Parameters/>';
        commands+='</Command>';
        commands+='<Command>';
            commands+='<Name>command2</Name>';
            commands+='<Description>cmd2.</Description>';
            commands+='<Parameters/>';
        commands+='</Command>';
    commands+='</ScriptCommands>';
    return commands;
}


function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if (Message=="/command1")
{
            chat_window.SendMessage("command1");
            return "";
    }
    else
    {
    if (Message=="/command2")
    {
            chat_window.SendMessage("command2");
            return ""; }   
            }
            }
10-28-2008 04:14 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: My First Script, some problems
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if (Message === "/command1") {
        ChatWnd.SendMessage("command1");
        return "";
    } else if (Message === "/command2") {
        ChatWnd.SendMessage("command2");
        return "";
    }   
}
10-28-2008 04:52 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: My First Script, some problems
yeah, I'm helping him on WLM right now. Xat is trying to listen for a command and only do stuff when in certain chat windows. Here's what we have so far:
code:

function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    for (var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()) {
      c = ChatWnd.Contacts.GetContact();
      if (c.Email.substring(0,6) = 'mgroup') {

         // do stuff, check the message for commands

      } else {
         return '';
   }
}

[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
10-28-2008 05:20 PM
Profile PM Web 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