Dim objResult
Set objShell = WScript.CreateObject("WScript.Shell")? ?
Do While True
? objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
? Wscript.Sleep (6000)
Loop
保存到screensaver.vbs里執(zhí)行眨攘。
Add-Type -AssemblyName System.Windows.Forms
# 你可以根據(jù)你的實際情況修改間隔時間
New-Variable -name INTERVAL -Value (60 * 3) -Option Constant -Description 'for 5mins lock default'
get-date
echo `start`
while ($true) {
? ? $key = '{SCROLLLOCK}'
? ? get-date
? ? echo? "press key $key`n"
? ? try {
? ? ? ? [System.Windows.Forms.SendKeys]::SendWait($key)
? ? ? ? [System.Windows.Forms.SendKeys]::SendWait($key)
? ? }
? ? catch {
? ? ? ? Write-Host "An error occurred:"
? ? ? ? Write-Host $_
? ? ? ? Write-Host $_.ScriptStackTrace
? ? }
? ? sleep -s $INTERVAL
}
保存到prevent_screen_lock.ps1里執(zhí)行淮腾。