In this post I detail how I created a simple ScreenSaver prevention AutoHotKey Script which can be toggled on or off with a simple key press.

What is AutoHotkey?
AutoHotkey (AHK) is a free, open-source macro-creation and automation software for Windows that allows users to automate repetitive tasks. It is driven by a scripting language that was initially aimed at providing keyboard shortcuts, otherwise known as hotkeys, that over time evolved into a full-fledged scripting language.

The Problem
Due to an Internal IT policy we have a screen saver GPO set with a 10 minute timer, now ordinarily this is fine but it can be a real pain when delivering PowerPoint presentations so I created a ahkscript to move the mouse one pixel to the right and then back again every minute which tricks the computer into thinking there is an active user. This allows for a light touch workaround to the problem which can be enabled or disabled by pressing Ctrl+5. I’ve even added a Tray Tip so its easy to tell if this is running or not, for example:


;autoexecute section
preventScreenSaverVar := false ; Boolean for Screen-saver prevention label (subroutine). True = running/enabled.
SetTimer, preventScreenSaver, 60000 ; Screen-saver launch prevention label (subroutine), checks every 1 minute

global preventScreenSaverVar := !preventScreenSaverVar
if (global preventScreenSaverVar) {
TrayTip, Screen Saver Prevention, Enabled, 2, 17
else { TrayTip, Screen Saver Prevention, Disabled, 2, 17 

;ScreenSaver launch prevention subroutine
if (global preventScreenSaverVar) {
    MouseMove, 1, 0, 1, R  ;Move the mouse one pixel to the right
    MouseMove, -1, 0, 1, R ;Move the mouse back one pixel

I’ll put a mirror of this code on my GitHub. If there are any updates code wise you’ll find it there.

Thanks for reading,