What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Previous PM & new automatic PM?

Previous PM & new automatic PM?
Author: Message:
brynmoorhouse
New Member
*


Posts: 1
30 / Male / Flag
Joined: Apr 2010
O.P. Previous PM & new automatic PM?
Hi People, First post, so hope you can help!
I recently downloaded Chat Counter, but on installing I found that it cleared my PM, and replaced it with "Open chat windows: 1".   I was wondering if it was possible to change the script so it came up with a box asking what you wanted your status to be.  Either that or just so it doesn't clear the PM, just adds it to the end?
Script Below,
Thanks,
Bryn



// *    ChatCounter - Display the number of open chat windows in the PSM
// *    Copyright (C) 2008 Adam Smith aka MeEtc <adam.rmp@gmail.com>
// *
// *    This program is free software: you can redistribute it and/or modify
// *    it under the terms of the GNU General Public License as published by
// *    the Free Software Foundation, either version 3 of the License, or
// *    (at your option) any later version.
// *
// *    This program is distributed in the hope that it will be useful,
// *    but WITHOUT ANY WARRANTY; without even the implied warranty of
// *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// *    GNU General Public License for more details.
// *
// *    You should have received a copy of the GNU General Public License
// *    along with this program.  If not, see <http://www.gnu.org/licenses/>.


////////////////////////////////////////////////////////////////////////////////////
// PROTOTYPE
////////////////////////////////////////////////////////////////////////////////////
var cc;

var ChatCount = function(){
    this.Shell = new ActiveXObject('WScript.Shell');
    this.regPath = MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\';
    this.openChats;
}

ChatCount.prototype = {
    'init' : function(){
        Debug.Trace('ChatCount.init called');
        var enabled;
        try{
            enabled = this.regread('enabled');
        }
        catch (e){
            enabled = 1;
            this.regwrite('enabled', 1);
        }
        if(enabled == 1)
            OnEvent_Timer('ccCheck');
    },
   
    'enable' : function(){
        Debug.Trace('ChatCount.enable called');
        this.regwrite('enabled', 1);
        this.regwrite('oldPSM', Messenger.MyPersonalMessage);
        OnEvent_Timer('ccCheck');
    },
   
    'disable' : function(){
        Debug.Trace('ChatCount.disable called');
        this.regwrite('enabled', 0);
        Messenger.MyPersonalMessage = this.regread('oldPSM');
        this.regwrite('oldPSM', '');
        MsgPlus.CancelTimer('ccCheck');
    },
   
    'regwrite' : function(key, value){
        return this.Shell.RegWrite(this.regPath + key, value);
    },
   
    'regread' : function(key){
        return this.Shell.RegRead(this.regPath + key);
    }
}

////////////////////////////////////////////////////////////////////////////////////
// MESSENGER EVENTS
////////////////////////////////////////////////////////////////////////////////////

function OnEvent_Initialize(email){
    if (cc == null && Messenger.MyStatus > 1){
        cc = new ChatCount;
        cc.init();
    }
}

function OnEvent_Signin(email){
    if (cc == null){
        cc = new ChatCount();
        cc.init();
    }
}

function OnEvent_Signout(email){
    cc = null;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    if (Message == '/ccon'){
        if (cc.regread('enabled') == '0')
            cc.enable();
        else
            Interop.Call('User32', 'MessageBoxW', 0, 'ChatCount is already enabled, you can\'t turn it on again!', 'ChatCount', 0);
        return '';
    }
   
    if (Message == '/ccoff'){
        if(cc.regread('enabled') == '1')
            cc.disable();
        else
            Interop.Call('User32', 'MessageBoxW', 0, 'ChatCount is already disabled, you can\'t turn it off again!', 'ChatCount', 0);
        return '';
    }
}

////////////////////////////////////////////////////////////////////////////////////
// PLUS EVENTS
////////////////////////////////////////////////////////////////////////////////////

function OnGetScriptCommands(){
    var commands = '<ScriptCommands>';
    commands +=    '  <Command>';
    commands +=    '    <Name>ccon</Name>';
    commands +=    '    <Description>Turn chat counter on</Description>';
    commands +=    '  </Command>';
    commands +=    '  <Command>';
    commands +=    '    <Name>ccoff</Name>';
    commands +=    '    <Description>Turn chat counter off</Description>';
    commands +=    '  </Command>';
    commands +=    '</ScriptCommands>';
    return commands;
}

function OnGetScriptMenu(Location){
    var ScriptMenu = '';
    ScriptMenu += '<ScriptMenu>';
    if (cc.regread('enabled') == '0')
        ScriptMenu +=     '<MenuEntry Id="ccon">Enable ChatCount</MenuEntry>';
    else
        ScriptMenu +=     '<MenuEntry Id="ccoff">Disable ChatCount</MenuEntry>';
    ScriptMenu += "</ScriptMenu>";

    return ScriptMenu;   
}

function OnEvent_MenuClicked(ControlId, Location, OriginWnd){
    switch (ControlId){
        case 'ccon':  cc.enable();  break;
        case 'ccoff': cc.disable(); break;
    }
}

function OnEvent_Timer(TimerId){
    if (TimerId == 'ccCheck'){
        Wnds = Messenger.CurrentChats;
        if(cc.openChats != Wnds.Count){
            cc.openChats = Wnds.Count;
            Messenger.MyPersonalMessage = 'Open chat windows: ' + cc.openChats;
        }
    MsgPlus.AddTimer('ccCheck', 1000 * 5);
    }
}

This post was edited on 04-20-2010 at 07:17 PM by brynmoorhouse.
04-20-2010 07:17 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Previous PM & new automatic PM? - by brynmoorhouse on 04-20-2010 at 07:17 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