What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [request] Last status timer

Pages: (3): « First « 1 [ 2 ] 3 » Last »
[request] Last status timer
Author: Message:
gdumitresco
Junior Member
**


Posts: 20
47 / Male / Flag
Joined: Dec 2004
O.P. RE: [request] Last status timer
Hey Matty! Works like a charm!

I didn't tested about retrieving the previous PSM, but it's working FINE!!!! Well done!!! Many thanks!
07-13-2007 12:27 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [request] Last status timer
Now change the many IF THEN ELSE's to a SWITCH statement to optimize it further. ;)
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-13-2007 09:05 AM
Profile PM Find Quote Report
gdumitresco
Junior Member
**


Posts: 20
47 / Male / Flag
Joined: Dec 2004
O.P. RE: [request] Last status timer
hmmm do you have the syntax for switch?

I made few changes about handling the PSM... if you have any ideas how to improve it...

code:
var PreviousToTimerPSM;
var mDate = new Date();

function OnEvent_Signout(Email) {
    Messenger.MyPersonalMessage = PreviousToTimerPSM; //restores the original PSM while signing

out?
}

function OnEvent_SigninReady(Email) {
    Messenger.MyPersonalMessage = ""; //retrieves the previous PSM once the user is signed in?
}

function OnEvent_MyStatusChange(NewStatus) {
    if( NewStatus == 3 ) {
        Messenger.MyPersonalMessage = ""; //if it's online, no need to count.
    } else if( NewStatus == 6 ) {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Estou ausente desde

"+mDate.getHours()+":"+mDate.getMinutes();
    } else if( NewStatus == 4 ) {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Estou ocupado desde

"+mDate.getHours()+":"+mDate.getMinutes();
    } else if( NewStatus == 5 ) {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Saí às "+mDate.getHours()+":"+mDate.getMinutes()+" mas

volto logo!";
    } else if( NewStatus == 7 ) {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Estou ausente desde

"+mDate.getHours()+":"+mDate.getMinutes();
    } else if( NewStatus == 8 ) {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Estou em uma ligação desde

"+mDate.getHours()+":"+mDate.getMinutes();
    } else if( NewStatus == 9 ) {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Estou almoçando desde

"+mDate.getHours()+":"+mDate.getMinutes();
    }
}


This post was edited on 07-13-2007 at 01:34 PM by gdumitresco.
07-13-2007 01:09 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [request] Last status timer
Blah why are you setting the personal message to a blank string then changing it to the PSM that makes no sense...

Look at this: http://www.w3schools.com/js/js_switch.asp
07-13-2007 01:37 PM
Profile E-Mail PM Find Quote Report
gdumitresco
Junior Member
**


Posts: 20
47 / Male / Flag
Joined: Dec 2004
O.P. RE: [request] Last status timer
I'm leaving the idea in "blank" until I find out how to work with it...

thanks for the link!
ok... call me lazy or whatever, but everytime I start programming I get lazy. LOL, I rather other challenges than knocking my head over the monitor while debugging.

Anyway, it is functional, but with some notes:

1- I removed the retrieval of the original PSM, it would require to store in registry or maybe in a .ini file the preferences for each user, I'm not in the mood of improving it right now, but if anyone knows how to make it, feel free, you'll be my guest and I'll be very thankful as many other users who may enjoy the idea.

2- I found a bug, a silly one, no idea how to fix it, but if minutes starts with zero, the time will be shown as this "12:7", instead of "12:07". Any ideas? I hope it won't need to insert the a.m. or p.m. thing, not used around here.

3- the PSM are in brazilian portuguese, feel free to translate to your language, it would help to spread the idea.

4- Optmizing with the switch statement would require to make my lazy programming cell brains to work again... I would have to study Jscript... oh boy... I'll leave this job to you who love programing.

5- Many thanks to Matty! (I don't have enough reputation to give you more...)

code:
var mDate = new Date();

function OnEvent_MyStatusChange(NewStatus) {


        if( NewStatus == 3 )
    {
    Messenger.MyPersonalMessage = ""; //if it's online, no need to change.
    }

    else if( NewStatus == 6 )        //idle status
    {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.getHours()+":"+mDate.getMinutes();
    }

    else if( NewStatus == 4 )        //busy status
    {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Estou ocupado desde "+mDate.getHours()+":"+mDate.getMinutes();
    }

    else if( NewStatus == 5 )        //brb status
    {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Saí às "+mDate.getHours()+":"+mDate.getMinutes()+" mas volto logo!";
    }

    else if( NewStatus == 7 )        //away status
    {
    Messenger.MyPersonalMessage = "";
    Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.getHours()+":"+mDate.getMinutes();
    }

    else if( NewStatus == 8 )        //on a call status
    {
    Messenger.MyPersonalMessage = "";
    Messenger.MyPersonalMessage = "Estou em uma ligação desde "+mDate.getHours()+":"+mDate.getMinutes();
        }
   
    else if( NewStatus == 9 )        //out for lunch status
    {
    Messenger.MyPersonalMessage = "";
        Messenger.MyPersonalMessage = "Estou almoçando desde "+mDate.getHours()+":"+mDate.getMinutes();
    }
}

07-13-2007 01:39 PM
Profile E-Mail PM Find Quote Report
Deco
Full Member
***


Posts: 188
Reputation: 4
42 / Male / Flag
Joined: Aug 2006
RE: [request] Last status timer
Here's with the switch:

code:

var PreviousToTimerPSM;
var mDate = new Date();

function OnEvent_Signout(Email) {
Messenger.MyPersonalMessage = PreviousToTimerPSM; //restores the original PSM while signing out?
}

function OnEvent_SigninReady(Email) {
PreviousToTimerPSM = Messenger.MyPersonalMessage; //retrieves the previous PSM once the user is signed in?
}

function OnEvent_MyStatusChange(NewStatus) {
   
    switch(NewStatus) {
        case 3:
            Messenger.MyPersonalMessage = PreviousToTimerPSM; //if it's online, no need to count.
        break;
        case 4:
            Messenger.MyPersonalMessage = "Estou ocupado desde "+mDate.getHours()+":"+mDate.getMinutes();
        break;
        case 5:
            Messenger.MyPersonalMessage = "Saí às "+mDate.getHours()+":"+mDate.getMinutes()+" mas volto logo!";
        break;
        case 6:
            Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.getHours()+":"+mDate.getMinutes();
        break;
        case 7:
            Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.getHours()+":"+mDate.getMinutes();
        break;
        case 8:
            Messenger.MyPersonalMessage = "Estou em uma ligação desde "+mDate.getHours()+":"+mDate.getMinutes();
        break;
        case 9:
            Messenger.MyPersonalMessage = "Estou almoçando desde "+mDate.getHours()+":"+mDate.getMinutes();
        break;
    }
}


Have fun!
07-13-2007 03:31 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [request] Last status timer
code:
var oPersonalMessage = new String('');

function OnEvent_Signout(Email) {
    Messenger.MyPersonalMessage = oPersonalMessage; //restores the original PSM while signing out?
}

function OnEvent_SigninReady(Email) {
    oPersonalMessage = Messenger.MyPersonalMessage; //retrieves the previous PSM once the user is signed in?
}

function GetTime() {
    var mDate = new Date();
    return mDate.getHours()+':'+(mDate.getMinutes() < 10 ? '0':'')+mDate.getMinutes();
}

function OnEvent_MyStatusChange(nNewStatus) {
    switch (nNewStatus) {
        case 3: Messenger.MyPersonalMessage = oPersonalMessage;
        case 6: Messenger.MyPersonalMessage = "Estou ausente desde "+GetTime();
        case 4: Messenger.MyPersonalMessage = "Estou ocupado desde "+GetTime();
        case 5: Messenger.MyPersonalMessage = "Saí às "+GetTime()+" mas volto logo!";
        case 7: Messenger.MyPersonalMessage = "Estou ausente desde "+GetTime();
        case 8: Messenger.MyPersonalMessage = "Estou em uma ligação desde "+GetTime();
        case 9: Messenger.MyPersonalMessage = "Estou almoçando desde "+GetTime();
    }
}

This post was edited on 07-13-2007 at 08:44 PM by matty.
07-13-2007 08:03 PM
Profile E-Mail PM Find Quote Report
gdumitresco
Junior Member
**


Posts: 20
47 / Male / Flag
Joined: Dec 2004
O.P. RE: [request] Last status timer
Guys, I'm straight, but I'm starting to love you! :D
07-13-2007 08:31 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [request] Last status timer
quote:
Originally posted by gdumitresco
Guys, I'm straight, but I'm starting to love you! :D
There I updated it, you don't need to store the PSM in the registry, just store it when they sign in, and reset it when they sign out simple as that.
07-13-2007 08:45 PM
Profile E-Mail PM Find Quote Report
gdumitresco
Junior Member
**


Posts: 20
47 / Male / Flag
Joined: Dec 2004
O.P. RE: [request] Last status timer
Guys, I'm going to test the "else if" method back, the switch method it's no bringing the right status PSM, even online it brings the wrong message... strange! Does it need the "break" stuff?
07-14-2007 01:52 PM
Profile E-Mail PM Find Quote Report
Pages: (3): « First « 1 [ 2 ] 3 » Last »
« 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