-
-
Save mfedatto/8fbaf7b66a1c0eb2ff4512f01e459af7 to your computer and use it in GitHub Desktop.
Script to make windows stop to sleep using VBscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim objWScript : Set objWScript = CreateObject("WScript.Shell") | |
Dim blnConsole : blnConsole = False | |
Dim dtmStartedAt : dtmStartedAt = Now() | |
If InStr(1, WScript.FullName, "cscript", vbTextCompare) Then | |
blnConsole = True | |
End If | |
Do | |
Call Shout() | |
Call WScript.Sleep(5 * 60 * 1000) | |
Call objWScript.SendKeys("{NUMLOCK}") | |
Loop | |
Set objWScript = Nothing | |
Function Shout | |
If blnConsole Then | |
Call WScript.Echo(dtmStartedAt & " ~ " & Now()) | |
End If | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I recommend using it on a command line tool through
cscript
, so it is easy to stop by interrupting the run with aCtrl + C
.