便携小工具

野生薄荷糖 / 2024-09-26 / 原文

防锁屏.vbs

 1 ' 先定义一个Shell对象
 2 Set WshShell = WScript.CreateObject("WScript.Shell")
 3  
 4 WScript.Sleep 5000
 5 wshShell.SendKeys "{NUMLOCK}"
 6 WScript.Sleep 500
 7 wshShell.SendKeys "{NUMLOCK}"
 8  
 9 '设置成正需要接续的时间
10 for i=1 to 180
11 '设置成比屏保时间短点就可以
12     WScript.Sleep 180000
13     wshShell.SendKeys "{NUMLOCK}"
14     WScript.Sleep 1
15     wshShell.SendKeys "{NUMLOCK}"
16     WScript.Sleep 500
17     wshShell.SendKeys "{NUMLOCK}"
18     WScript.Sleep 1
19     wshShell.SendKeys "{NUMLOCK}"
20 next

提醒喝水.vbs

set WshShell = WScript.CreateObject("WScript.Shell")
'对话框标题
alerttitle = "定时提醒"
'提醒内容,vbnewline为换行符
alerttext =  "该喝水了" 
for i = 1 to 12    '12为提醒的次数
    WScript.Sleep(1000*60*90)    '每90分钟提醒一次
    msgbox alerttext,4096,alerttitle
next