Skip to content

Instantly share code, notes, and snippets.

@fcojperez
Created September 15, 2017 12:34
Show Gist options
  • Save fcojperez/0b3368e3ea128205f2ec6b3b90f9c28b to your computer and use it in GitHub Desktop.
Save fcojperez/0b3368e3ea128205f2ec6b3b90f9c28b to your computer and use it in GitHub Desktop.
A visual basic script for stopping screen saver because you cannot manage screen saver options due a Directory Active policy
'***********************************************************
'Script for sending inputs and avoiding start screen saver
'***********************************************************
'Developer: Francisco Perez
'mail: [email protected]
'Date: 9/13/2017 (MM/DD/YYYY)
Option Explicit
Dim finishTime
Dim strInput
Dim numHour, numMinute
Dim input
Dim WshShell
strInput= InputBox("Please, introduce hour and minutes separated by coma" & vbCrlf & "For hour a number between 0 and 23. And for minutes a number between 0,59")
input = split(strInput, ",")
numHour = Int(input(0))
numMinute = Int(input(0))
finishTime = TimeSerial(numHour,numMinute,0)
While (Hour(Now)*60 + Minute(Now)) < (Hour(FinishTime)*60 + Minute(FinishTime))
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys("{NUMLOCK}")
WScript.Sleep 1000
WshShell.SendKeys("{NUMLOCK}")
WScript.Sleep 2000
WEnd
Msgbox("Script Finished")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment