Away since.... |
Author: |
Message: |
sno
Junior Member
Posts: 65
Joined: Oct 2005
|
O.P. Away since....
Ok i've spent some time searching, there was 1 result that looked promising but the file no longer exists.
Im looking for a Script that changes my PSM, to the time my status went to Idle/Away eg
Away since 12:27 PM (GMT0)
Is this possible and if so how could i go about getting it set?
|
|
12-01-2009 01:24 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: Away since....
It's very possible to do. It could be written in 5 minutes... If I've got time later...
<Eljay> "Problems encountered: shit blew up"
|
|
12-01-2009 01:38 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Away since....
Something like this: js code: var LOCALE_USER_DEFAULT = 0x400;
var TIME_NOSECONDS = 0x2;
function OnEvent_MyStatusChange(nStatus) {
var oStatus = { STATUS_ONLINE : 'Online',
STATUS_BUSY : 'Busy',
STATUS_AWAY : 'Away',
STATUS_IDLE : 'Idle',
STATUS_INCALL : 'On the phone',
STATUS_OUTLUNCH : 'Out to lunch'
}
if (typeof oStatus[nStatus] === 'object') {
var SYSTEMTIME = Interop.Allocate(16);
var sTime = Interop.Allocate(512);
var sDate = Interop.Allocate(512);
Interop.Call('kernel32', 'GetSystemTime', SYSTEMTIME);
Interop.Call('kernel32', 'GetTimeFormatW', LOCALE_USER_DEFAULT, TIME_NOSECONDS, SYSTEMTIME, 0, sTime, sTime.Size);
Interop.Call('kernel32', 'GetDateFormatW', LOCALE_USER_DEFAULT, 0, SYSTEMTIME, 0, sDate, sDate.Size);
Messenger.MyPersonalMessage = oStatus[nStatus]+ ' since '+sDate.ReadString(0) +' '+sTime.ReadString(0);
}
}
This post was edited on 12-01-2009 at 03:22 PM by matty.
|
|
12-01-2009 03:21 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: Away since....
quote: Originally posted by matty
Something like this:
Why not just new Date()?
<Eljay> "Problems encountered: shit blew up"
|
|
12-01-2009 03:44 PM |
|
|
sno
Junior Member
Posts: 65
Joined: Oct 2005
|
O.P. RE: Away since....
What about storing, and restoring a previous PSM? i did mean to state that in before
|
|
12-01-2009 03:52 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Away since....
quote: Originally posted by Spunky
quote: Originally posted by matty
Something like this:
Why not just new Date()?
Not sure lol; real reason is the API then allows you to get the date and time in the users locale.
quote: Originally posted by sno
What about storing, and restoring a previous PSM? i did mean to state that in before
Read the documentation and add it in
This post was edited on 12-01-2009 at 04:08 PM by matty.
|
|
12-01-2009 04:08 PM |
|
|
sno
Junior Member
Posts: 65
Joined: Oct 2005
|
O.P. RE: Away since....
i didn't quite get what you posted to work matty, but i took some time to properly read the documentation and changed the method and since i only wanted it for when im idle changed it accordingly
Even got the psm stored and restored working ^^, not bad for a first try
code: var LOCALE_USER_DEFAULT = 0x400;
var TIME_NOSECONDS = 0x2;
function OnEvent_Uninitialize(MessengerExit)
{
Messenger.MyPersonalMessage = oPSM;
}
function OnEvent_MyStatusChange(nStatus) {
if (nStatus == 6) {
var SYSTEMTIME = Interop.Allocate(16);
var sTime = Interop.Allocate(512);
var sDate = Interop.Allocate(512);
Interop.Call('kernel32', 'GetSystemTime', SYSTEMTIME);
Interop.Call('kernel32', 'GetTimeFormatW', LOCALE_USER_DEFAULT, TIME_NOSECONDS, SYSTEMTIME, 0, sTime, sTime.Size);
Interop.Call('kernel32', 'GetDateFormatW', LOCALE_USER_DEFAULT, 0, SYSTEMTIME, 0, sDate, sDate.Size);
Messenger.MyPersonalMessage = 'Idle since '+sDate.ReadString(0) +' '+sTime.ReadString(0)+' (GMT0)' ;
isIdle = true;
oPSM = Messenger.MyPersonalMessage;
}
else if( isIdle == true )
{
isIdle = false;
Messenger.MyPersonalMessage = oPSM;
}
}
|
|
12-01-2009 07:51 PM |
|
|
|
|