You are prudent to avoid waste of electricity by implementing the most successful power plan for your end point. Kudos for that.

Should your end point goes to sleep due to ideal time, your process will either get stalled or terminated, and you won’t be happy about it, the next morning.

I am sure you have run into such situations before. What do you do in such cases? Time for innovation. Put a slightly heavy object on a keyboard keys, preferably space bar with notepad open, that would keep your sessions always active.

Well, I used the same solution on number of occasions : ), However, now, I have a better solution to prevent PC from going to sleep.

I used the AutoIT to automate Mouse movements and, build an executable program.

It’s a simple program that mimics move movements across the screen and can be terminated with an ESC.

It works well even on locked screen.

You can download the code from GitHub. The code is forked out of AutoIT code.

; Set the Escape hotkey to terminate the script.
HotKeySet("{ESC}", "_Terminate")


Func MoveMouse()
    ; Initialize a Local variable.
    Local $aMgp = 0

    ; Create an endless loop, 1 will always be 1 therefore True.
    While 1
        ; Assign a Local variable the coords of the cursor (array).
        $aMgp = MouseGetPos()

        ; Display a tooltip near the cursor with its coords.
        ; ToolTip("x: " & $aMgp[0] & ", y: " & $aMgp[1], $aMgp[0] + 10, $aMgp[1] + 10)

       ; Move MouseMouse
     MouseMove(700, 550, 50)
     MouseMove(950, 225, 50)
     MouseMove(1200, 550, 50)
     MouseMove(950, 850, 50)

        ; Avoid high CPU usage.
EndFunc   ;==>Example

Func _Terminate()
EndFunc   ;==>_Terminate

and, download MoveMouse build from here.

Hope this helps !!!