'普通版:
Set wshShell = WScript.CreateObject("WScript.Shell")
do
WScript.Sleep 300000
wshShell.SendKeys "(ScrollLock}"
loop
'進階版:
Set wshShell=WScript.CreateObject("WScript.Shell")
dim startTime
dim endTime
dim curTime
dim curWeek
'指定時間區間
startTime = TimeValue("08:30:00")
endTime = TimeValue("18:30:00")
do
curWeek = weekday(Now)
curTime = Time()
WScript.Sleep 300000 '休眠時間單位:毫秒
lf curWeek <> 7 and curWeek <> 1 and curTime >= startTime and curTime <= endTime Then
wshShell.SendKeys "{ScrollLock}"
else
'非工作日,無動作
End lf
loop