What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » StopWatch (AFKTime Counter)

StopWatch (AFKTime Counter)
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: StopWatch (AFKTime Counter)
Something like this... I am at work can't test it.

js code:
var bAway = false;
var h = 0;
var m = 0;
var s = 0;

function OnEvent_ChatWndSendMessage( pChatWnd, sMessage ){
    if ( sMessage === '/counter' ) {
        if ( bAway === true ) {
            bAway = false;
            h=0; m=0; s=0;
            MsgPlus.CancelTimer( 'x' );
        } else {
            bAway = true;
            MsgPlus.AddTimer('x', 1000);
        }
        return false;
    }
}

function OnEvent_ChatWndReceiveMessage( pChatWnd, sMessage, sOrigin, nMessageKind ){
    if ( bAway === true ) {
        pChatWnd.SendMessage( 'I have been away from the computer for: '+parseTime( ) );
    }
}

function OnEvent_Timer( sTimerId ){
    if ( s === 59 ) {
        s = 0;
        if ( m === 59 ) {
            m = 0;
            h++;
        } else m++
    } else s++;
    MsgPlus.AddTimer( sTimerId, 1000 );
}

function parseTime( ){
    return h+'h '+m+'m '+s+'s';
}

This post was edited on 03-25-2009 at 06:15 PM by matty.
03-25-2009 06:15 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
StopWatch (AFKTime Counter) - by NorteX on 03-25-2009 at 04:49 PM
RE: StopWatch (AFKTime Counter) - by matty on 03-25-2009 at 06:15 PM
RE: StopWatch (AFKTime Counter) - by Matti on 03-25-2009 at 06:45 PM
RE: StopWatch (AFKTime Counter) - by matty on 03-25-2009 at 06:50 PM
RE: StopWatch (AFKTime Counter) - by NorteX on 03-25-2009 at 06:54 PM
RE: StopWatch (AFKTime Counter) - by Matti on 03-25-2009 at 07:00 PM
RE: StopWatch (AFKTime Counter) - by NorteX on 03-25-2009 at 07:01 PM
RE: StopWatch (AFKTime Counter) - by Matti on 03-25-2009 at 07:04 PM
RE: StopWatch (AFKTime Counter) - by matty on 03-25-2009 at 07:05 PM
RE: StopWatch (AFKTime Counter) - by NorteX on 03-25-2009 at 07:21 PM
RE: StopWatch (AFKTime Counter) - by matty on 03-25-2009 at 07:52 PM
RE: StopWatch (AFKTime Counter) - by NorteX on 03-25-2009 at 08:05 PM
RE: StopWatch (AFKTime Counter) - by NorteX on 03-25-2009 at 11:52 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