[request] Last status timer |
Author: |
Message: |
gdumitresco
Junior Member
Posts: 20
47 / /
Joined: Dec 2004
|
O.P. [request] Last status timer
Hi
I saw on Mirand IM when you change your status, it will change your personal status message as you define and show how much time you've been on that status, i.e.: I became away/busy and my personal status message becomes like this "I'm away since 2:12pm" or "I'm busy since 11:23am".
I tried starting on my own, but for programmer, I'm good singer. If you catch my drift.
Is it easy to be done?
|
|
07-09-2007 06:02 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [request] Last status timer
quote: Originally posted by gdumitresco
Hi
I saw on Mirand IM when you change your status, it will change your personal status message as you define and show how much time you've been on that status, i.e.: I became away/busy and my personal status message becomes like this "I'm away since 2:12pm" or "I'm busy since 11:23am".
I tried starting on my own, but for programmer, I'm good singer. If you catch my drift.
Is it easy to be done?
Sure is easy
code: function OnEvent_MyStatusChange(nNewStatus) {
Messenger.MyPersonalMessage = 'I changed my status : '+new Date();
}
Now that is going to print out a really long personal message.
When you use new Date() that way the resulting string is something like this
quote: Mon Jul 09 2007 15:06:39 GMT-0400 (Eastern Daylight Time)
|
|
07-09-2007 07:03 PM |
|
|
gdumitresco
Junior Member
Posts: 20
47 / /
Joined: Dec 2004
|
O.P. RE: [request] Last status timer
quite easy! but there is a function which brings the current status name?
oh! thanks!
PS.: hmmm I'm trying but I realized it's not my speciality... definitely.
I wonder if anyone could develop something as this:
"A script which will "sense" the last status, and will be able to tell the last time you left it on that status, with possibility of customization for each status (like i.e. online status may show it or not) with custom messages and variables for you to put the time anywhere in the psm."
I dunno if my english left it clear... but I'm crossing my fingers hoping some programmer like the idea
This post was edited on 07-09-2007 at 07:48 PM by gdumitresco.
|
|
07-09-2007 07:17 PM |
|
|
gdumitresco
Junior Member
Posts: 20
47 / /
Joined: Dec 2004
|
O.P. RE: [request] Last status timer
Hi... looking into some scripts and fighting the lazy side of me, I tried to do this:
code: var PreviousToTimerPSM
function OnEvent_Initialize(MessengerStart)
{
}
function OnEvent_Signin(Email)
{
Messenger.MyPersonalMessage = PreviousToTimerPSM; //stores the previous PSM while signing in
}
function OnEvent_Signout(Email)
{
PreviousToTimerPS = Messenger.MyPersonalMessage; //retrieves the previous PSM while signing in?
}
function OnEvent_Uninitialize(MessengerExit)
{
Messenger.MyPersonalMessage = PreviousToTimerPSM;
}
function OnEvent_MyStatusChange(NewStatus)
{
if( NewStatus == 3 )
{
Messenger.MyPersonalMessage = PreviousToTimerPSM; //if it's online, no need to count.
}
else if( NewStatus == 6 )
{
Messenger.MyPersonalMessage = "Estou ausente desde "+GetHours()+":"+GetMinutes();
}
else if( NewStatus == 4 )
{
Messenger.MyPersonalMessage = "Estou ocupado desde "+GetHours()+":"+GetMinutes();
}
else if( NewStatus == 5 )
{
Messenger.MyPersonalMessage = "Saí às "+GetHours()+":"+GetMinutes()+" mas volto logo!";
}
else if( NewStatus == 7 )
{
Messenger.MyPersonalMessage = "Estou ausente desde "+GetHours()+":"+GetMinutes();
}
else if( NewStatus == 8 )
{
Messenger.MyPersonalMessage = "Estou em uma ligação desde "+GetHours()+":"+GetMinutes();
}
else if( NewStatus == 9 )
{
Messenger.MyPersonalMessage = "Estou almoçando desde "+GetHours()+":"+GetMinutes();
}
}
could someone help checking errors or giving ideas? I can't test it from the job
thanks
|
|
07-12-2007 07:34 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [request] Last status timer
All I did was clean the code up so far, it looks like it should work.
Found an error just as I posted, GetHours() and GetMinutes() are functions of the Date() object in Javascript, you have to declare it before you can use it, hence the var mDate = new Date();
Also you cannot assign the PSM OnEvent_Signin as that is when the user is signing in, it would have to be OnEvent_SigninReady however once you signout the script is stopped until you sign back in so you will loose any variables that have been set.
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) {
if( NewStatus == 3 ) {
Messenger.MyPersonalMessage = PreviousToTimerPSM; //if it's online, no need to count.
} else if( NewStatus == 6 ) {
Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.GetHours()+":"+mDate.GetMinutes();
} else if( NewStatus == 4 ) {
Messenger.MyPersonalMessage = "Estou ocupado desde "+mDate.GetHours()+":"+mDate.GetMinutes();
} else if( NewStatus == 5 ) {
Messenger.MyPersonalMessage = "Saí às "+mDate.GetHours()+":"+mDate.GetMinutes()+" mas volto logo!";
} else if( NewStatus == 7 ) {
Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.GetHours()+":"+mDate.GetMinutes();
} else if( NewStatus == 8 ) {
Messenger.MyPersonalMessage = "Estou em uma ligação desde "+mDate.GetHours()+":"+mDate.GetMinutes();
} else if( NewStatus == 9 ) {
Messenger.MyPersonalMessage = "Estou almoçando desde "+mDate.GetHours()+":"+mDate.GetMinutes();
}
}
This post was edited on 07-12-2007 at 08:40 PM by matty.
|
|
07-12-2007 08:33 PM |
|
|
pollolibredegrasa
Full Member
formerly fatfreechicken
Posts: 483 Reputation: 34
35 / /
Joined: May 2005
|
|
07-12-2007 08:39 PM |
|
|
gdumitresco
Junior Member
Posts: 20
47 / /
Joined: Dec 2004
|
O.P. RE: [request] Last status timer
Hi, I tried... but it brought me the following errors with debug:
code: Function called: OnEvent_MyStatusChange
Error: O objeto não dá suporte para a propriedade ou método (code: -2146827850)
File: Last status timer.js. Line: 18.
Function OnEvent_MyStatusChange returned an error. Code: -2147352567
Function called: OnEvent_MyStatusChange
Error: O objeto não dá suporte para a propriedade ou método (code: -2146827850)
File: Last status timer.js. Line: 20.
Function OnEvent_MyStatusChange returned an error. Code: -2147352567
Function called: OnEvent_MyStatusChange
Function called: OnEvent_MyStatusChange
Error: O objeto não dá suporte para a propriedade ou método (code: -2146827850)
File: Last status timer.js. Line: 26.
Function OnEvent_MyStatusChange returned an error. Code: -2147352567
Function called: OnEvent_MyStatusChange
When I tried to change status... the only one without bugs was the "online" status
|
|
07-12-2007 11:24 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [request] Last status timer
Change the declaration line to
code: var PreviousToTimerPSM = '';
|
|
07-12-2007 11:52 PM |
|
|
gdumitresco
Junior Member
Posts: 20
47 / /
Joined: Dec 2004
|
O.P. RE: [request] Last status timer
Before I follow, thanks for the help Matty!
the debug has changed, a bit:
code: Script sendo carregado
Script ativado e pronto
Função denominada: OnEvent_SigninReady
Função denominada: OnEvent_MyStatusChange
Erro: O objeto não dá suporte para a propriedade ou método (código: -2146827850)
Arquivo: Last status timer.js. Linha: 18.
A função OnEvent_MyStatusChange resultou em erro. Código: -2147352567
Função denominada: OnEvent_MyStatusChange
Erro: O objeto não dá suporte para a propriedade ou método (código: -2146827850)
Arquivo: Last status timer.js. Linha: 24.
A função OnEvent_MyStatusChange resultou em erro. Código: -2147352567
I tried to change the error messages to english, but no luck! If you need me to translate them, I'll do it!
|
|
07-12-2007 11:57 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [request] Last status timer
I can't believe I missed 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) {
PreviousToTimerPSM = Messenger.MyPersonalMessage; //retrieves the previous PSM once the user is signed in?
}
function OnEvent_MyStatusChange(NewStatus) {
if( NewStatus == 3 ) {
Messenger.MyPersonalMessage = PreviousToTimerPSM; //if it's online, no need to count.
} else if( NewStatus == 6 ) {
Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.getHours()+":"+mDate.getMinutes();
} else if( NewStatus == 4 ) {
Messenger.MyPersonalMessage = "Estou ocupado desde "+mDate.getHours()+":"+mDate.getMinutes();
} else if( NewStatus == 5 ) {
Messenger.MyPersonalMessage = "Saí às "+mDate.getHours()+":"+mDate.getMinutes()+" mas volto logo!";
} else if( NewStatus == 7 ) {
Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.getHours()+":"+mDate.getMinutes();
} else if( NewStatus == 8 ) {
Messenger.MyPersonalMessage = "Estou em uma ligação desde "+mDate.getHours()+":"+mDate.getMinutes();
} else if( NewStatus == 9 ) {
Messenger.MyPersonalMessage = "Estou almoçando desde "+mDate.getHours()+":"+mDate.getMinutes();
}
}
It is getHours() and getMinutes().
|
|
07-13-2007 12:07 AM |
|
|
Pages: (3):
« First
[ 1 ]
2
3
»
Last »
|
|