set ws = createobject("wscript.shell")
rem 运行记录本程序进行测试发送按键
ws.run("notepad")
rem 暂停0.1秒,防止程序还没启动就发送按键
wscript.sleep(100)
rem 输入1个x
rem ws.sendkeys("x")
rem 回车
rem ws.sendkeys("{enter}")
rem 输入10个x
rem ws.sendkeys("{x 10}")
rem 回车
rem ws.sendkeys("{enter}")
rem 输入不同字符
rem ws.sendkeys("sendkeys")
rem 组合键使用:ctrl + a
rem ws.sendkeys("^a")
rem win键: ctrl + esc
rem ws.sendkeys("^{esc}")
set ws = nothing
rem -----------------特殊键代码-----------------
rem 退格键 {backspace}或{bs}或{bksp}
rem break {break}
rem caps lock {capslock}
rem num lock {numlock}
rem del/delete {del}或{delete}
rem ins/insert {ins}或{insert}
rem 回车/换行 {enter}
rem 方向:下 {down}
rem 方向:上 {up}
rem 方向:左 {left}
rem 方向:右 {right}
rem 换页:上 {pgup}
rem 换页:下 {pgdn}
rem home {home}
rem end {end}
rem esc {esc}
rem help {help}
rem tab {tab}
rem shift +
rem ctrl ^
rem alt %
rem + {+}
rem ^ {^}
rem % {%}
rem F1至F12 {F1}至{F12}
rem win键 ^{esc}
rem -----------------特殊键代码-----------------
vbs教程《模拟按键》
最新推荐文章于 2024-05-15 21:33:11 发布