Shoutbox

bring computer off screensaver when msg is received - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: bring computer off screensaver when msg is received (/showthread.php?tid=83545)

bring computer off screensaver when msg is received by ezkim0x on 05-05-2008 at 08:10 AM

is there a script out there that brings your computer off of the screensaver mode when you receive a message?

when I receive a message on aim, if my screensaver is on it will turn off the screensaver so i can see that I have a new message. I'd like msn to do this as well if possible.


RE: bring computer off screensaver when msg is received by ezkim0x on 06-04-2008 at 01:57 AM

bump


RE: bring computer off screensaver when msg is received by felipEx on 06-05-2008 at 12:15 AM

Hey ezkim0x!
I dont know if there is such script but you can make your own script with the following lines of code :)

code:
var SPI_SETSCREENSAVEACTIVE    = 0x11;
var SPIF_SENDWININICHANGE    = 2;
var SPIF_UPDATEINIFILE        = 1;
var SPIF_SENDCHANGE        = 2;

function OnEvent_Initialize(MessengerStart){
Interop.Call("user32", "SystemParametersInfoW", SPI_SETSCREENSAVEACTIVE, true, 0, SPIF_SENDWININICHANGE|SPIF_UPDATEINIFILE);
}

function OnEvent_Uninitialize(MessengerExit){
    Interop.Call("user32", "SystemParametersInfoW", SPI_SETSCREENSAVEACTIVE, true, 0, SPIF_SENDWININICHANGE|SPIF_UPDATEINIFILE)
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind){
    Interop.Call("user32", "SystemParametersInfoW", SPI_SETSCREENSAVEACTIVE, false, 0, SPIF_SENDWININICHANGE|SPIF_UPDATEINIFILE)
}

* special thanks to Adan for testing this   lol =P
RE: bring computer off screensaver when msg is received by CookieRevised on 06-05-2008 at 12:43 AM

That code will not work properly as-is.

By setting SETSCREENSAVEACTIVE to false you effectivly turn off the screensaver. It will not turn back on unless you actually moved your mouse or pressed a key. So, if no more messages are recieved your screensaver will not kick in anymore either.

Also, you would be interfearing with the Windows settings of the user, which you do not want to do; you don't need to write the settings to the current user profile to make the new (temporary settings) active.

And you assume that the screensaver is enabled in that code, which will not always be the case either.

So instead, you need to read in the current setting first, then deactivate, then set it back to what it was (so you do not need the (un)initialize functions).

For more information see KB140723 and MSDN library.

;)

------------------------------------

quote:
Originally posted by felipEx
I dont know if there is such script [...]
Not a script, but already requested and answered some time ago:
Help disabling Windows Screensaver

RE: bring computer off screensaver when msg is received by ezkim0x on 06-05-2008 at 01:20 AM

hm.. I don't know vb or anything about scripting with msn really. so I really wouldn't know how to use all the code posted in the other thread to work with plus.