NoSleep.exe - Prevents Screensaver and PC Locking
I wrote a little utility that runs in your system tray and prevents your computer from locking or going into screensaver mode as it normally would when idle and while it is not really Symantec related, I have found it very useful and I thought I would share it.
Why would you want to prevent this you ask?
Well, I work on two PCs and group policy sets our screensaver and locking timeout. Quite often I would be working on PC1 for a few minutes and then PC2 would lock, so when I want to go back to PC2, I would unlock it. Then while I am on PC2, PC1 would lock. I found myself unlocking my PCs several times a day and it started to get annoying. I am all in favor of security and still lock my PCs when I leave my desk, but this little utility keeps them active while I am sitting here.
How does it work?
It is very simple. All it does is move your mouse one pixel to the left, and then one pixel to the right every 30 seconds. This tiny bit of movement is invisible to the user, but is enough to make Windows think that someone is using the PC.
While running, you will see this icon in your system tray:
If you want to exit the utility, simply right click it and click "Exit"
Comments
I've thought about making
I've thought about making something that does exactly what you're doing here, but never knew enough Windows programming to do it. Nice work!
Thanks,
Kyle
Symantec Trusted Advisor
For Forum threads, please click "Mark as Solution" if answered.
For all content, please give a thumbs up if you agree with or support the post.
Nice utility
This is a nice utility, what language do you use to create this?
Autoit
It is an easy little scriping language called AutoIt. Similar to VB Script, but it has GUI functionallity, and compiles to an EXE which is kind of handy.
Only about 30 lines of code total, most of which is setting up he tray icon. The actual mouse moving code is only 6 lines. Basically tells it, until someone closes the app, idle around for 30 seconds, then get the position of the mouse and move it right and left one pixel. Then it loops and idles around fr 30 more seconds.
While 1 Sleep(30000) $CurPos = MouseGetPos ( ) MouseMove ( $CurPos[0] + 1, $CurPos[1] ) MouseMove ( $CurPos[0] - 1, $CurPos[1] ) WEndCheck out www.autoitscript.com if you are interested. I do most my stuff in C#, but sometimes, a simple script is all you need.
Cheers
Nice Utility - Enhancing it?
Looks like this approach should work well with Win 7 . Would you mind sharing your 30 lines of full source code behind this.. perhaps include in your Winzip? In our case, would be good if such a facility self-exited after so much time - especially for conference rooms - and wouldn't take too much to enhance further.
Nice job!
Sure, here is the entire
Sure, here is the entire source code. I will update the zip so it contains the uncompiled version as well.
Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) $AboutItem = TrayCreateItem("About") TrayItemSetOnEvent(-1,"ReadList") TrayCreateItem("") $ExitItem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"ReadList") Func ReadList() $SelectedItem = TrayItemGetText(@TRAY_ID) If $SelectedItem="Exit" Then Exit ElseIf $SelectedItem="About" Then Call("About") EndIf EndFunc Func About() MsgBox(064,"No Sleep Utility","Prevents your computer from automatically locking or going to screen saver as it normally would." & @CRLF & "Copyright Mike Langford ©2009") EndFunc While 1 Sleep(30000) $CurPos = MouseGetPos ( ) MouseMove ( $CurPos[0] + 1, $CurPos[1] ) MouseMove ( $CurPos[0] - 1, $CurPos[1] ) WEndSource Code Included
FYI,
The ZIP now contains the Au3 file, which is just text based source code that Autoit can compile to an EXE.
Very Helpful!
Thanks for the code. Looks pretty straight forward!
Would you like to reply?
Login or Register to post your comment.