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

[Question] Messenger Plus! Commands
Author: Message:
Sana
New Member
*

Avatar
Caption Removed. Rule violation.

Posts: 5
34 / Female / –
Joined: Oct 2006
O.P. [Question] Messenger Plus! Commands
I'm new to scripting (and JavaScript >.>) so to test a couple things I just made a quick Shell script.

I used this code to place my Plus! command into the listbox:

code:
function OnGetScriptCommands() {
    var commands = '<ScriptCommands>';
        commands+='<Command>';
            commands+='<Name>shell</Name>';
            commands+='<Description>Shell Execute</Description>';
        commands+='</Command>';
    commands+='</ScriptCommands>';
    return commands;   
}

And I used this to parse commands:

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
     if (Message.charAt(0) == "/") {
          if (Message.charAt(1) == "/") {
               return Message;
          }else{
               if (Message.charAt(6) == " ") {
                   if (Message.charAt(7) != "") {
                         Shell.ShellExecute(Message.substr(7));
   
                   }
               }
          }
     }
}

So for example, I can type "/shell notepad" and it shells notepad.exe, or "/shell www.google.com" and it opens Google in my browser.

It works in that it shells whatever parameter I specify, but it keeps giving me the Plus! error that I'm using an invalid command at the same time:

quote:
---------------------------
Messenger Plus! Live
---------------------------
The command you entered was not recognized.
If the message was not meant to be a command, insert a double '//' at its beginning.
---------------------------
OK   
---------------------------

I want to eliminate this error message, since "/shell" is in fact the command that I'm trying to use (and it actually does shell my parameter).

Any help would be appreciated.
Signature Removed.
Rule violation.
10-27-2006 11:03 PM
Profile E-Mail PM Find Quote Report
pollolibredegrasa
Full Member
***

Avatar
formerly fatfreechicken

Posts: 483
Reputation: 34
35 / Male / Flag
Joined: May 2005
RE: [Question] Messenger Plus! Commands
Are there any errors in the script debugger?
;p

[Image: chickennana.gif] Vaccy is my thin twin! [Image: chickennana.gif]
10-27-2006 11:16 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: [Question] Messenger Plus! Commands
You may need to specify a paramater in the XML code =/
<Eljay> "Problems encountered: shit blew up" :zippy:
10-27-2006 11:20 PM
Profile PM Find Quote Report
Baggins
Full Member
***

Avatar
B000ALFAZO

Posts: 387
Reputation: 13
29 / Male / Flag
Joined: Oct 2006
RE: [Question] Messenger Plus! Commands
code:
function OnGetScriptCommands() {
    var commands = '<ScriptCommands>';
        commands+='<Command>';
            commands+='<Name>shell</Name>';
            commands+='<Description>Shell Execute</Description>';
            commands+='<Parameters/>
        commands+='</Command>';
    commands+='</ScriptCommands>';
    return commands;   
}
or something like that
10-28-2006 12:00 AM
Profile E-Mail PM Web Find Quote Report
Plan-1130
Full Member
***

I keep askin' myself: why?

Posts: 142
73 / Male / –
Joined: Feb 2005
RE: [Question] Messenger Plus! Commands
It's because you didn't return anything, the code below should fix it...
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
     if (Message.charAt(0) == "/") {
          if (Message.charAt(1) == "/") {
               return Message;
          }else{
               if (Message.charAt(6) == " ") {
                   if (Message.charAt(7) != "") {
                         Shell.ShellExecute(Message.substr(7));
                         return "";
                   }
               }
          }
     }
}

Remember there might be malicuous contacts in your list who can abuse it and therby doing harmful things to you or your computer (if not, contactlists like urs are very rare, try posting a flooder here)
Also, your script seems to check for a lot of things, but it gets executed if you type "/blahh notepad" too.
A shorter, and better code would be:
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
     if (Message.substr(0,6) == "/shell ") {
          if (Message.substr(7) != "") {
               Shell.ShellExecute(Message.substr(7));
               return "";
          }
     }
}

And, I prefer to put a return before every bracket instead of putting it right behind the functionname or loop, it's up to you to decide what you think works easier, compare the previous one to thisone:
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
     if (Message.substr(0,6) == "/shell ")
     {
          if (Message.substr(7) != "")
          {
               Shell.ShellExecute(Message.substr(7));
               return "";
          }
     }
}


This post was edited on 10-28-2006 at 12:33 AM by Plan-1130.
My Scripts: UltimatFlooder, Advanced PSM Chat, PlusPrivacy, PlusRemote

[Image: Plan-1130.png]
10-28-2006 12:02 AM
Profile E-Mail PM Find Quote Report
Baggins
Full Member
***

Avatar
B000ALFAZO

Posts: 387
Reputation: 13
29 / Male / Flag
Joined: Oct 2006
RE: RE: [Question] Messenger Plus! Commands
quote:
Originally posted by Plan-1130
It's because you didn't return anything, the code below should fix it...
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
     if (Message.charAt(0) == "/") {
          if (Message.charAt(1) == "/") {
               return Message;
          }else{
               if (Message.charAt(6) == " ") {
                   if (Message.charAt(7) != "") {
                         Shell.ShellExecute(Message.substr(7));
                         return "";
                   }
               }
          }
     }
}


and also do this:D
10-28-2006 12:18 AM
Profile E-Mail PM Web Find Quote Report
Sana
New Member
*

Avatar
Caption Removed. Rule violation.

Posts: 5
34 / Female / –
Joined: Oct 2006
O.P. RE: [Question] Messenger Plus! Commands
Thanks for the help.

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
     if (Message.substr(0,7) == "/shell ") {
          Shell.ShellExecute(Message.substr(7));
          return "";
     }
}
Signature Removed.
Rule violation.
10-28-2006 12:35 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: [Question] Messenger Plus! Commands
quote:
Originally posted by Plan-1130
Remember there might be malicuous contacts in your list who can abuse it and therby doing harmful things to you or your computer

You can't sent commands to this script remotely so I don't see anyway that a contact could abuse this...

Also, I know you were joking, but it may not be the best advice to tell someone to post a flooder ;) Some people would misunderstand and do it :p


<Eljay> "Problems encountered: shit blew up" :zippy:
10-28-2006 07:42 AM
Profile PM Find Quote Report
Plan-1130
Full Member
***

I keep askin' myself: why?

Posts: 142
73 / Male / –
Joined: Feb 2005
RE: [Question] Messenger Plus! Commands
Argh, you're right. I'm used to handling remote commands, which are catched in OnEvent_ChatWndReceiveMessage, thisone uses OnEvent_ChatWndSendMessage.
I'm sorry, noone can do harmful things with it, unless you make the command remotely accessible...

This post was edited on 10-29-2006 at 02:09 AM by Plan-1130.
My Scripts: UltimatFlooder, Advanced PSM Chat, PlusPrivacy, PlusRemote

[Image: Plan-1130.png]
10-29-2006 02:08 AM
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