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

Creating a Command?
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Creating a Command?
Class file
js code:
/*
* -----
* Screenshot Sender - command_class.js
* -----
* Command class for Screenshot Sender
* -----
*/

var Commands = function() {
    this.Commands = '';
}

Commands.prototype = {
    /*
        Name:     AddCommand
        Purpose:    Adds a custom command to Plus!
        Parameters:    sCommand - The command to add
                    sDescription - A description of the command
                    sParameter - Any additional optional parameters
        Return:    None
    */
    "AddCommand" : function(sCommand, sDescription, sParameter) {
        this.Commands += '<Command>'+
                            '<Name>'+sCommand+'</Name>'+
                            '<Description>'+sDescription+'</Description>'+
                            (typeof sParameter === 'undefined' ? '' : '<Parameters>&lt;'+sParameter+'&gt;</Parameters>')+
                         '</Command>';
    },
   
    /*
        Name:     ExportCommands
        Purpose:    Export the Plus! commands in xml form
        Parameters:    None
        Return:    XML formed Plus! commands
    */
    "ExportCommands" : function() {
        return '<ScriptCommands>'+this.Commands+'</ScriptCommands>';
    }
}

Usage:
js code:
function OnGetScriptCommands(){
    var bEnabled = (Messenger.MyStatus > STATUS_INVISIBLE);
   
    var oCommand = new Commands();

    with(oCommand) {
        if ( bEnabled === true ) {
            AddCommand('mycommand', 'my command description', 'optional parameter');
            AddCommand('mycommand2', 'my second command description');
        return ExportCommands();
    }   
}
10-01-2009 05:44 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Creating a Command? - by Samo502 on 10-01-2009 at 05:37 PM
RE: Creating a Command? - by m0nst3rkill3r on 10-01-2009 at 05:41 PM
RE: Creating a Command? - by matty on 10-01-2009 at 05:44 PM
RE: Creating a Command? - by Samo502 on 10-01-2009 at 05:47 PM
RE: Creating a Command? - by matty on 10-01-2009 at 06:10 PM
RE: Creating a Command? - by Samo502 on 10-01-2009 at 06:12 PM
RE: Creating a Command? - by CookieRevised on 10-01-2009 at 06:36 PM
RE: Creating a Command? - by Samo502 on 10-01-2009 at 06:51 PM
RE: Creating a Command? - by CookieRevised on 10-01-2009 at 06:56 PM
RE: Creating a Command? - by matty on 10-01-2009 at 07:56 PM


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