What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! Help » Anyway to automatically set AWAY when computer is lock?

Anyway to automatically set AWAY when computer is lock?
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Anyway to automatically set AWAY when computer is lock?
This works.

js code:
var bIsDesktopLocked = isDesktopLocked();
var nPreStatus = 0;

function OnEvent_Initialize() {
    if (Messenger.MyStatus < STATUS_INVISIBLE) return false;
   
    MsgPlus.AddTimer('isDesktopLocked()', 100);
}

function OnEvent_SigninReady() {
    OnEvent_Initialize();
}

function OnEvent_Timer(sTimerId) {
    if(Messenger.MyStatus !== STATUS_INVISIBLE) {
        var b = isDesktopLocked();
        var n = Messenger.MyStatus;
        if(b !== bIsDesktopLocked) {
            if(Messenger.MyStatus !== STATUS_IDLE || Messenger.MyStatus !== nPreStatus) {
                Messenger.MyStatus = (b ? STATUS_IDLE : nPreStatus);
                nPreStatus = n;
                bIsDesktopLocked = b;
            }
        }
    }
    MsgPlus.AddTimer(sTimerId, 100);
}

function isDesktopLocked() {
    var DESKTOP_SWITCHDESKTOP = 0x100;
   
    var p_lngHwnd = Interop.Call('user32', 'OpenDesktopW', 'Default', 0, false, DESKTOP_SWITCHDESKTOP);
    if(p_lngHwnd !== 0)
        var p_lngRtn = Interop.Call('user32', 'SwitchDesktop', p_lngHwnd);
   
    Interop.Call('user32', 'CloseDesktop', p_lngHwnd);
    return p_lngRtn === 0;
}

Interface will come at a later date. If you want your status to be set to Away instead of Idle (which makes more sense) change STATUS_IDLE to STATUS_AWAY.
10-01-2010 12:45 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Anyway to automatically set AWAY when computer is lock? - by Bryan84 on 09-28-2010 at 07:51 AM
RE: Any hotkey to Set Away? - by matty on 09-28-2010 at 11:27 AM
RE: Any hotkey to Set Away? - by djdannyp on 09-28-2010 at 04:48 PM
RE: Any hotkey to Set Away? - by matty on 09-28-2010 at 05:37 PM
RE: RE: Any hotkey to Set Away? - by Bryan84 on 09-29-2010 at 08:53 AM
RE: Any hotkey to Set Away? - by CookieRevised on 09-28-2010 at 07:09 PM
RE: Any hotkey to Set Away? - by djdannyp on 09-29-2010 at 11:30 AM
RE: Any hotkey to Set Away? - by matty on 09-29-2010 at 01:31 PM
RE: RE: Any hotkey to Set Away? - by Bryan84 on 09-30-2010 at 02:52 AM
RE: Any hotkey to Set Away? - by Spunky on 09-29-2010 at 02:28 PM
RE: Any hotkey to Set Away? - by matty on 09-29-2010 at 03:55 PM
RE: Any hotkey to Set Away? - by Spunky on 09-29-2010 at 08:02 PM
RE: Any hotkey to Set Away? - by matty on 09-29-2010 at 09:41 PM
RE: Any hotkey to Set Away? - by matty on 09-30-2010 at 03:12 AM
RE: Any hotkey to Set Away? - by CookieRevised on 09-30-2010 at 03:16 AM
RE: Any hotkey to Set Away? - by Bryan84 on 09-30-2010 at 04:27 AM
RE: Anyway to automatically set AWAY when computer is lock? - by matty on 09-30-2010 at 12:25 PM
RE: RE: Anyway to automatically set AWAY when computer is lock? - by Bryan84 on 09-30-2010 at 01:01 PM
RE: Anyway to automatically set AWAY when computer is lock? - by matty on 09-30-2010 at 01:07 PM
RE: Anyway to automatically set AWAY when computer is lock? - by Bryan84 on 09-30-2010 at 01:11 PM
RE: Anyway to automatically set AWAY when computer is lock? - by matty on 10-01-2010 at 12:45 AM
RE: Anyway to automatically set AWAY when computer is lock? - by Bryan84 on 10-01-2010 at 12:51 AM
RE: Anyway to automatically set AWAY when computer is lock? - by matty on 10-01-2010 at 12:59 AM
RE: Anyway to automatically set AWAY when computer is lock? - by Bryan84 on 10-01-2010 at 01:04 AM
RE: Anyway to automatically set AWAY when computer is lock? - by matty on 10-01-2010 at 01:07 AM
RE: Anyway to automatically set AWAY when computer is lock? - by Bryan84 on 10-01-2010 at 01:15 AM
RE: Anyway to automatically set AWAY when computer is lock? - by Bryan84 on 10-09-2010 at 06:31 AM


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