Wednesday, August 4, 2010

VBS Script for Never Screen Save

This script automatically emulates keystrokes every x amount of minutes/seconds so that the screen doesn't lock due to a screen saver. I've placed it in a VBS so it can be run from any machine by double clicking or from command line. This one in particular sends a TAB keystroke represented by a tilda (~):

Set objShell = WScript.CreateObject("WScript.Shell")
On error resume next

Do Until Success = True
Success = objShell.AppActivate("Endless")
  Wscript.Sleep 500000 'This is milliseconds
  objShell.SendKeys "~" 'sends keystrokes
Loop


No comments:

Post a Comment