Windows每五秒点击一次键盘保持不锁屏

模拟键盘每五秒点击一次大写锁定键,保持Windows不锁屏 (一共执行1000次)

使用步骤:

1,桌面新建文本文档

2,将代码复制到文档中

3,文本文档后缀改成.vbs

4,双击运行

Set wshShell = WScript.CreateObject("WScript.Shell")
for i = 0 to 1000
wshShell.SendKeys "{CAPSLOCK}"
Wscript.sleep 5000
next

5,提前结束:打开任务管理器,在详细信息中找到wscript.exe结束任务

Windows每五秒点击一次键盘保持不锁屏_第1张图片

 提示:

1,代码中1000代表执行1000次,5000代表5秒,可按需要改变

2,代码中CAPSLOCK代表大写锁定键,也可自定义其他单独按键或者组合按键:

←:		wshShell.SendKeys “{LEFT}”
↑:		wshShell.SendKeys “{UP}”
→:		wshShell.SendKeys “{RIGHT}”
↓:		wshShell.SendKeys “{DOWN}”
Space:		wshShell.SendKeys " "
Enter:		wshShell.SendKeys “{ENTER}”
BREAK:		wshShell.SendKeys “{BREAK}”
ESC:		wshShell.SendKeys “{ESC}”
DEL:		wshShell.SendKeys “{DEL}”
END:		wshShell.SendKeys “{END}”
HOME:		wshShell.SendKeys “{HOME}”
Insert:	wshShell.SendKeys “{INS}”
BREAK:		wshShell.SendKeys “{BREAK}”
NUM LOCK :	wshShell.SendKeys “{NUMLOCK}”
PAGE UP :	wshShell.SendKeys “{PGUP}”
PAGE DOWN :	wshShell.SendKeys “{PGDN}”
PRINT SCREEN :	wshShell.SendKeys “{PRTSC}”
SCROLL LOCK :	wshShell.SendKeys “{SCROLLLOCK}”
TAB:		wshShell.SendKeys “{TAB}”
F1:		wshShell.SendKeys “{F1}”
Fn同F1

你可能感兴趣的:(笔记,windows,visual,studio)