What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Caching which windows have a command enabled

Caching which windows have a command enabled
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Caching which windows have a command enabled
Sure does:

jscript code:
// Declare an object to hold our ChatWindows
var oChatWnds = {};

// An event is fired because a chat window was created
function OnEvent_ChatWndCreated(oChatWnd) {
    // Create an entry in the object for the chat window
    oChatWnds[oChatWnd.Handle] = {};
        // Store the chat window's object in our oChatWnds object
        oChatWnds[oChatWnd.Handle].objChatWnd = oChatWnd;
        // Create a read/write property for the on/off
        oChatWnds[oChatWnd.Handle].bCommand = true;
}

// An event is fired because a chat window was closed
function OnEvent_ChatWndDestroyed(oChatWnd) {
    // Remove the chat window from the object
    delete oChatWnds[oChatWnd.Handle];
}

// An event is fired because we sent a message
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
    // Perform a regexp function to split the command and params
    if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
       
        // Declare local variables for the command and the parameters
        var Command = RegExp.$1.toLowerCase();
        var Param = RegExp.$2;
       
        // Check if the command is one of ours
        if (Command === 'command') {
            // If it is then change the variable based on what the paramter is set to
            oChatWnds[oChatWnd.Handle].bCommand = (Param === 'on' ? true : false);
            // Return a null string to the function
            return '';
        }
    // Return the message if we are doing nothing with it
    return sMessage;
}

// Called when the user presses / in the chat window
function OnGetScriptCommands() {
    // Make sure 'command' is a valid command so Plus! doesn't bark
    return '<ScriptCommands><Command><Name>command</Name></Command></ScriptCommands>';
}

This post was edited on 11-18-2008 at 09:03 PM by matty.
11-18-2008 08:52 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Caching which windows have a command enabled - by MrPickle on 11-18-2008 at 08:14 PM
RE: Caching which windows have a command enabled - by matty on 11-18-2008 at 08:52 PM
RE: Caching which windows have a command enabled - by MrPickle on 11-18-2008 at 09:39 PM
RE: Caching which windows have a command enabled - by Spunky on 11-18-2008 at 10:37 PM
RE: Caching which windows have a command enabled - by MrPickle on 11-18-2008 at 10:48 PM
RE: Caching which windows have a command enabled - by matty on 11-18-2008 at 11:07 PM
RE: Caching which windows have a command enabled - by MrPickle on 11-18-2008 at 11:19 PM
RE: Caching which windows have a command enabled - by Spunky on 11-19-2008 at 01:17 AM
RE: Caching which windows have a command enabled - by MrPickle on 11-19-2008 at 08:25 AM
RE: Caching which windows have a command enabled - by Matti on 11-19-2008 at 12:44 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