VB之SendKeys键盘模拟


just for fun.

' type I love you on a notepad
Dim wsh
set wsh = CreateObject("WScript.Shell")
wsh.Run "notepad"
WScript.Sleep 400
wsh.SendKeys "I "	'模拟从键盘敲击按键的工程
WScript.Sleep 400	'sleep to monitor 缓慢打字
wsh.SendKeys " L"
WScript.Sleep 400
wsh.SendKeys "O"
WScript.Sleep 400
wsh.SendKeys "V"
WScript.Sleep 400
wsh.SendKeys "E "
WScript.Sleep 400
wsh.SendKeys " Y"
WScript.Sleep 400
wsh.SendKeys "O"
WScript.Sleep 400
wsh.SendKeys "U !!!"
wsh.Run "taskkill /F /IM notepad.exe"

Dim fso
set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("iloveyou.txt", True)
a.WriteLine("I LOVE YOU !!!")
a.Close

 

,

《“VB之SendKeys键盘模拟”》 有 1 条评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注