Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Save this script into a file named as e.g.: blankout.vbs.
- 'The file name should end with ".vbs".
- 'Run this script (or double click this script file) to start or stop it.
- 'A message dialog will be shown to indicate its status.
- '
- 'blankInterval and blankDuration values are in seconds unit.
- 'Fractional values can be used. e.g. 0.5 for half a second, or 20.5.
- '
- 'Notes:
- '- Blanking may not work if there's an application running in *exclusive*
- ' fullscreen mode. e.g. video players, games, etc.
- '- If Windows taskbar is set to auto-hide, and blanking occurs when user is
- ' typing or clicking, the thin lined collapsed taskbar may still be shown.
- ' Or the whole taskbar may still be shown if it occurs when user is clicking
- ' on the taskbar.
- '-------- CONFIG BEGIN
- blankInterval = 20 * 60
- blankDuration = 20
- '-------- CONFIG END
- set fs = createobject("scripting.filesystemobject")
- fn = fs.getspecialfolder(2) & "\blankout-running.marker"
- if fs.fileexists(fn) then
- fs.deletefile fn
- msgbox "Blankout has been stopped.", 64, "Blankout"
- wsh.quit
- end if
- msgbox "Blankout will be started after closing this message.", 64, "Blankout"
- fs.createtextfile(fn, true).close
- set ws = createobject("wscript.shell")
- cmdline = "mshta.exe ""javascript:'<body bgcolor=#000><hta:application border=none caption=no contextmenu=no innerborder=no scroll=no windowstate=maximize /><script>setTimeout(close," & blankDuration & "*000)</script>'"""
- tc = 1
- t = blankInterval - int(blankInterval)
- if t > 0 then
- t = t / 2
- if t < 0.1 then t = 0.1
- if t < tc then tc = t
- end if
- t = blankDuration - int(blankDuration)
- if t > 0 then
- t = t / 2
- if t < 0.1 then t = 0.1
- if t < tc then tc = t
- end if
- tc = tc * 1000
- tthen = timer
- do while fs.fileexists(fn)
- tnow = timer
- if tnow >= tthen then
- tthen2 = tthen
- else
- tthen2 = tthen + 86400
- end if
- if (tnow - tthen2) >= blankInterval then
- tthen = tnow
- ws.run cmdline
- else
- wsh.sleep tc
- end if
- loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement