Skip to content

Instantly share code, notes, and snippets.

@Otiel
Last active October 4, 2023 10:35
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Otiel/8d15d21593b481c1e525500762db52ba to your computer and use it in GitHub Desktop.
Save Otiel/8d15d21593b481c1e525500762db52ba to your computer and use it in GitHub Desktop.
AutoHotkey script to prevent Windows or your screen from going to sleep
CoordMode, Mouse, Screen
Loop
{
; Move mouse
MouseMove, 1, 1, 0, R
; Replace mouse to its original location
MouseMove, -1, -1, 0, R
; Wait before moving the mouse again
Sleep, 600000
}
return
@marslo
Copy link

marslo commented Feb 14, 2020

or you can just change the regedit:

REM  Disable the screensaver
REG ADD "HKCU\SOFTWARE\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaverIsSecure /t REG_SZ /d 0 /f
REG ADD "HKCU\SOFTWARE\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 0 /f

@snwkill
Copy link

snwkill commented Dec 8, 2020

or you can just change the regedit:

That's great, but the only reason one would need this is to keep their pesky work computer from sleeping while they are playing video games, of which they wouldn't have admin rights, and if they do group policy updates every 30 minutes resetting any changes they make to the registry.

@marslo
Copy link

marslo commented Jun 18, 2021

or you can just change the regedit:

That's great, but the only reason one would need this is to keep their pesky work computer from sleeping while they are playing video games, of which they wouldn't have admin rights, and if they do group policy updates every 30 minutes resetting any changes they make to the registry.

That's true. Becuase I've found, the company communication tool will be setup 'offline' status if mouse isn't moved in 15 mins, even if the screensaver has been prevent to start by regedit XD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment