Workspace Virtualization

NoSleep.exe - Prevents Screensaver and PC Locking 

07-22-2009 07:13 PM

Update to this old post. I have written a .NET version of this utility (.NET 4.5) as an alternative to the old AutoIt script version.  Some folks have mentioned that the AutoIt version doesn't always work on more current versions of Windows.  Give this one a try if you like and let me know if you have any issues:

 

NoSleep (AutoIt Version): https://drive.google.com/file/d/1v_nAPPu-audQdmJ8GpbbKKWO7QKdRrMF/view?usp=sharing
NoSleep2.0 (.NET 4.5 Version):  https://drive.google.com/file/d/1P3vcCBdUVZI8JEUiq1EfnB_0Ggyc721N/view?usp=sharing 

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

 

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:

imagebrowser image

If you want to exit the utility, simply right click it and click "Exit"

Statistics
0 Favorited
1 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

05-21-2019 01:36 AM

Dr Google says get it here:

http://dtechbits.blogspot.com/2017/01/nosleepexe-prevents-windows-automatic.html

and here:

https://gist.github.com/iamzhout/38ad08d2d8eacda8184f0766639641a5

01-02-2019 01:56 AM

Looks I can't get the NOSLEEP.ZIP, could you send it to my email ? 

dagzhao@gmail.com.

 

Thanks,

11-07-2018 06:01 PM

I made some changes to suit me.

Basically checks if the mouse has moved while sleeping, and only moves if the mouse is in the same position (ie. you're not using the machine).

This was so I could just have nosleep run when I start windows and don't worry about it anymore.

I also, made the mouse move a bit more just so it's more noticeable.

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=H:\Icons\Clock.ico
#AutoIt3Wrapper_outfile=H:\Projects\AutoIt\NoSleep.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Prevents your computer from locking or going to screensaver as it normally would when idle
#AutoIt3Wrapper_Res_Description=Prevents your computer from locking or going to screensaver as it normally would when idle
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Copyright Mike Langford ©2009
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
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
	
	$OldCurPos = MouseGetPos ( )
	Sleep(30000)
	$CurPos = MouseGetPos ( )
	If (($OldCurPos[0]=$CurPos[0]) and ($OldCurPos[1]=$CurPos[1])) then
		
		MouseMove ( $CurPos[0] + 5, $CurPos[1] )
		MouseMove ( $CurPos[0] - 5, $CurPos[1] )
		MouseMove ( $CurPos[0] + 5, $CurPos[1] )
		MouseMove ( $CurPos[0] - 5, $CurPos[1] )
	endif
	
WEnd

 

08-21-2018 03:43 AM

@Atif - the passworded .7z file attached by Kyle Schroeder downloads fine, as do other non-zip attachments.  I am sure that the issue it with non-passworded compressed files where the antivirus is blocking the download as it flags the content as malicious.  Go through the entire thread and note the correction someone posted to the original AutoIT code.

08-16-2018 07:09 AM

Hi Mike

I am getting the attached error when I click on NOSLEEP.zip

Regards

Atif

07-18-2018 08:00 AM

Hello Mike, can you send me the link to this application please? The download link does not work here anymore...

06-15-2018 02:32 PM

I can't download this, I am getting a permission error.  Anyway to push it to Google.  Kind of an emergency.

 

06-12-2018 04:47 PM

I just logged in for the first time in years. It is so cool to see that people are still using this thing I wrote almost a decade ago.  I still run it on my PC every day.

Thanks all.  If you ever need a copy of it in the future due to issues downloading, I can always share a link to my google drive. Just let me know.

 

05-23-2018 11:25 AM

Great job there

05-02-2018 06:27 PM

Let's try again...

 

OK it would seem that either Connect no longer allows .zip file attachments, or perhaps the AV is interfering/blocking the file, as it can tell it is an AutoIt executable, and considers it dangerous.

Recompressed as .7z, with password "Symantec".

04-18-2018 01:36 PM

I uploaded NoSleep_0.zip here: http://ge.tt/3NUzBTp2

This link will only last 30 days.

I had all the unzipped contents. I rezipped them. The au3 file is in there if you want to compile it with Autoit yourself.

Since it is an Autoit script, virustotal will have false positives. Feel free to compile from the au3 to see the code yourself.

How do you compile? Download Autoit (google Auotit), Install Autoit, Import the au3, compile it to an executable file.

04-18-2018 12:18 PM

Here is the autoit code as well

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=H:\Icons\Clock.ico
#AutoIt3Wrapper_outfile=H:\Projects\AutoIt\NoSleep.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Prevents your computer from locking or going to screensaver as it normally would when idle
#AutoIt3Wrapper_Res_Description=Prevents your computer from locking or going to screensaver as it normally would when idle
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Copyright Mike Langford ©2009
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
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] )
WEnd

 

04-08-2018 02:52 AM

You struck out KShroeder.

-----

Forbidden

You don't have permission to access /connect/sites/default/files/NoSleep.7z on this server.

-----

Here is a good article with five options: https://www.raymond.cc/blog/dont-sleep-prevent-windows-from-standby-shutdown-hibernate-and-restart/

The first in the list includes the source code.

It is attached.

Here is another site with other options (e. g. keepalive app for network).  It links this thread's defunct NoSleep link: https://windowsreport.com/prevent-computer-from-sleeping-locking/

Happy PCing.

04-06-2018 02:28 PM

hi Jim... please follow steps i have mentioned above.I hope this will help.

04-06-2018 02:25 PM

hi,,, have you tried the steps i mentioned above?

04-06-2018 09:46 AM

I had saved out the old NoSleep.exe binary (looking to see if I still have the original .zip with the AU3 source file), but here it is for everyone!

04-06-2018 04:31 AM

Still not downloadable. Permissions issue is still present.

03-21-2018 03:03 AM

Yes, please fix the permissions problem, I have a copy of this file on the NAS at work, but we need this solution back so others can find this file also. It's a simple fix and so easy to run! I have come back to this page many times since discovering this download about five years ago, it has served me well.

03-10-2018 05:56 PM

I cannot download this either. I have used it in the past, and liked it a lot. Please fix the permission issue.

Forbidden

You don't have permission to access /connect/sites/default/files/NoSleep_0.zip on this server.

02-15-2018 12:25 PM

I cannot download the zip. It shows a "Forbidden" error page if I try to download it :(

02-09-2018 08:48 AM

Is there anything as simple as this for windows 10? 

01-18-2018 08:00 AM

Thank you VERRY much for the very simple and easy instructions to follow.  This worked.  You have saved the day! 

01-09-2018 09:07 AM

Hi All

The zip file is no longer available but still, you can generate .exe file out of code is given above. Follow steps

1. Copy complete code 

2. open new file in nodepad or notepad++ paste the code

3. Save the file with .au3 extension e.g (myfile.au3)

4. download autoit -v3.zip from (https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3.zip)

5 unzip  autoit  -v3.zip and open Aut2Exe (install\Aut2Exe)

6. provide a path to your .au3 file e.g myfile.au3 and give destination file path for .exe and click convert

That's it... exe file is ready to use

01-03-2018 10:53 AM

I am on my home personal computer and get this when I click. zip file..

Forbidden

You don't have permission to access /connect/sites/default/files/NoSleep_0.zip on this server.

12-23-2017 01:17 PM

Forbidden

You don't have permission to access /connect/sites/default/files/NoSleep_0.zip on this server.

 

How do I downroad it Prease herp

12-15-2017 01:06 AM

You don't have permission to access /connect/sites/default/files/NoSleep_0.zip on this server.

 

Please tell how to download it?

Thank you

11-15-2017 04:09 AM

Forbidden

You don't have permission to access /connect/sites/default/files/NoSleep_0.zip on this server.

09-22-2017 07:08 AM

Can you confirm if it runs without any problem to Win 10 pc ?  For my lastest test experience, it is not stopping the screen lock on Win 10 OS.

09-19-2017 01:43 AM

It's working well on my corporate PC which has all kind of security restrictions. 

- Create a nosleep.au3 blank file, and paste the complete source code posted in the above comments

- Download AutoIt-v3-setup.exe from the official website

- Extract it into a folder (if you do not have install priviledges)

- Run AutoIt3.exe and select the previously created nosleep.au3 script file

- Enjoy it!

09-05-2017 03:14 AM

nice utility i was looking for something similar but i can't download the file ... it says

 

Forbidden

You don't have permission to access /connect/sites/default/files/NoSleep_0.zip on this server.

08-09-2017 05:33 AM

cannot download?  access forbidden?  why?

 

08-02-2017 11:44 AM

doesn't seem to work on windows 10. has anyone been able to get this to work on windows 10???

04-30-2017 02:05 AM

Nothing is attached?

04-17-2017 01:21 PM

You don't need to ask an old file, make the new one yourself:

  1. Download AutoIt
  2. Open editor
  3. Save code to .au3 file
  4. Compile it

It would take five minutes at all.

There is a file with updated code attached to this message.

 

04-12-2017 12:10 PM

NoSleep.zip is not available for download. Please, advise..

04-12-2017 11:36 AM

yes... no longer available... please correct the permissions so we can try again..

 

Lisa

03-29-2017 07:55 AM

Attachement is unavailable. Can someone fix it?

11-04-2016 12:26 PM

The most simplest solution to avoid the screensaver and PC locking would be, open the Windows Media Player and run any music(.mp3) file and turn the repeat on option and leave it running. Mute the volume, If you don't want to listen. The system would think you're actively running the music file and never goes to the PC locking mode, until you're manually force to do so...Try it...!!!

10-23-2016 07:24 AM

I've been using this for a while now and it's great. Upgraded to Windows 10 and can't seem to make it work. Any suggestioms would be great.  many thanks

02-01-2016 12:34 PM

I want to apply something to keep my screen from locking (even when watching a DVD). Your solution seems to be simple. I am kind of green to the techie thing...HOW DO I APPLY? IT

  • Pwd is required when logging into my account (ADMIN - company owner).
  • Power options (ALL) were set to: "NEVER" to hpoefully resolve this problem. But no solution!
  •  Screen Saver is set to: "NONE"

03-30-2015 01:10 PM

Hi All ,

I have a simple solution without any script

While logging to the system use the below syntex

Goto RUN

MSTSC /console

 

Wola the system will not get lock untill and unless you lock it.

 

Note :- It worked for me on VM machine ,i have not tried this on local system ,Also please disable screen saver , Turn off all power options.

02-20-2015 12:00 PM

Thank you!!!

02-20-2015 11:59 AM

The version that was created and compiled using AutoIt (a very powerful freeware scripting system), many anti-malware programs will flag it as a virus or trojan. The version downloaded from this forum is safe.

02-20-2015 11:56 AM

BTW, since the (original version) of the NoSleep utility was created and compiled using AutoIt scipting software, some anti-malware programs will falsely flag it as a virus, mainly because some unscrupulous users have used it to create harmful programs in the past.

NoSleep from this forum is safe.

02-20-2015 11:41 AM

I registered an account on this site just so I can thank you for creating this utility. My workstation has been experiencing BSOD crashes due to some unknown process that becomes active when the machine is idle, and its nature is such that Windows produces no dump files. If I stay busy on the machine, it runs perfectly all day.

I will be wiping this machine to (hopefully) rectify the problem, but for now I have to complete a critical project, and I am becoming weary of returning from meetings, or breaks and having to restart the machine multiple times per day.

 

So thanks again; I owe you a debt of gratitude!

12-03-2014 03:42 AM

Thank you. k3nnyg

10-22-2014 12:31 AM

Mike, Can you please incldue mouse click as well in the above exe. So that it may work in VM where as well.

10-22-2014 12:29 AM

Hi K3nnyg,

Today I installed in my remote machine but when I switched of my moniter and came back it was locked. It seems VM ware its not working properly. Please suggest how to aproach.

10-21-2014 11:59 AM

Excellent solution Mike.

I need one help on the same. When I am working in VM where client its not working properly. I think it would be better if you can add clickMouse event as well to prevent the locking. Could you please provide me .exe file with click event to the above Nosleep.exe.

Thanks in Advance!

 

09-10-2014 05:03 PM

Installed yesterday and works PERFECT..didn't seem to touch the register as my co. laptop is VERY hardened and there is almost nothing a user can install without getting the helpdesk involved so this was a HUGE PLUS!!!!.... Recommend for VPN users at the end of the day, log off VPN instead of exiting nosleep.exe.

 

HIGHLY HIGHLY Recommend.

06-19-2014 09:29 AM

I will have to try it.

04-16-2014 11:48 AM

Mike, Great useful idea.

I found this site looking for a way to put a time period around such a NoSleep function.

For example, during the hours of 9AM to 5PM, nosleep.exe would run and do it's thing.

Then outside the above time frame, (when no one should be working)  NoSleep.exe would

be idle or not running, to allow the system screensaver to take back control.

What do you think?  Is this a useful function, and it it possible to implement?

Either way, great thinking outside the box on your part.  Cheers, Don. 

 

ps.  I know i could terminate the exe before leaving, but sometimes humans forget.

      Or maybe, I could write a .bat file to start and stop Nosleep.exe when I log on 

      and logoff.   Maybe, I just answered my own question.  :)  Keep Thinking...!

 

 

02-28-2014 11:30 AM

most corporate users cant download an .exe file, how could i take your code and get it on my computer another way?

take the source and compile it? need options, thanks

02-07-2014 05:19 PM

My gateway antivirus says that ZIP contains a trojan. Seriously?

01-30-2014 10:48 PM

@k3nnyg

ImWorkin did not work on my PC

 

01-30-2014 07:42 PM

Try the file I posted. It detects your timeouts and resets everything programatically just before they expire. It works in an RDP (remote) session also;)

 

Its safe. Source code is included.

01-29-2014 03:28 PM

About the second thing, you can hide icon on the system tray from the windows settings (Control Panel - Notification area icons)

01-29-2014 02:18 PM

I just downloaded it.

It works fine, and I just love it.

You can make it better though.

Sometimes when I do drawing or move the mouse slowly it make the wonrg moves because your program does fake moves every 30 seconds.

First of all nobody makes screen savers on 30 seconds and it is not adjustable.

Should be like 5 minutes or adjustable.

Then you can make it more smart.

If the mouse makes the move (user moves it) then restart the timer.

Then it will work only when it is not in use.

 

Second thing you can do is you making it possinble to hide the icon from the bottom bar of the screen.

If my admin sees it he will punish me as it is a policy violation.

Please add the option to hide it.

Thanks

 

04-24-2013 06:40 AM

FYI : Panda, Quick Heal and Clam AV detect a virus in NoSleep.exe: http://virusscan.jotti.org/en/scanresult/76c4d987bcfaca6b17a14d000116582252c4f1c1/eeece454e44eba9a5177e27620edbb4411e5983e

Nothing found in ImWorkin.exe

 

 

03-25-2013 12:25 PM

Hmmmm.. not bad. This won't work for everything though. If you just want the computer not to lock this will work in most(not all) circumstances(Win7, Win8, UAC. Many more things to consider these days). Attached is a utility I wrote. Its in C# and uses pInvoke to get the exact timeouts for each profile and then adjusts the reset values accordingly. This will not move your mouse or type phantom characters like some do. This will also make you appear active on OCS, gchat, Lync, Outlook,etc. This works on ANY Windows version under any type ofdomain or individual security policy(GPOs). This utility is more meant to make you appear that you are actually at your terminal working even if you step away. Really it was written as a POC. The file ImWorkin.exe is in the root of the zip if you just want the pre-copmpiled exed. Otherwise the whole C# project is there for you too.

 

I dont condone slacking off but at times you may find a need for this utility. Use it wisely and dont abuse it too much because ultimatley it doesnt matter how your computer look if you arent actually producing your deliverables to your managment!

 

Enjoy

 

Source included in the zip.....Requires .NET 4 or above.

03-08-2013 06:23 AM

This is genuine utility can we use in corporate?

01-03-2013 05:10 AM

Actually the source code has a bug.

The mouse position has been stored in a local variable, so it should be moved back to that position. Instead, as a second move it is being set to initial position -1 (1 Pixel to the left):

 

MouseMove ( $CurPos[0] - 1, $CurPos[1] )

 

Replace that line with the following, and the mouse position shouldn't drift any longer:

 

MouseMove ( $CurPos[0], $CurPos[1] )

 

 

09-28-2012 01:23 PM

You sir, are a genius! 

 

Thank you so much! 

06-04-2012 02:52 PM

This causes my cursor to end up 2 pixels to the left every time.

10-16-2009 05:04 PM

Thanks for the code.  Looks pretty straight forward!

10-07-2009 01:27 PM

FYI,
The ZIP now contains the Au3 file, which is just text based source code that Autoit can compile to an EXE.

10-07-2009 01:24 PM

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] )
WEnd

09-19-2009 01:23 AM

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!


    

07-30-2009 09:35 AM

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] )
WEnd

Check 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

07-28-2009 11:10 AM

This is a nice utility, what language do you use to create this?

07-23-2009 03:01 PM

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!

Related Entries and Links

No Related Resource entered.