您现在的位置:首页 >> 电脑技术 >> 操作系统 >> 内容

VBS脚本中键盘按键对照表和发送指令

时间:2023-12-12 23:13:44 点击:

  核心提示:KeyCodeBackspace{BACKSPACE}, {BKSP} or {BS}Break{BREAK}Caps Lock{CAPSLOCK}Delete{DELETE} or {DEL}Dow...
















































































































KeyCode
Backspace{BACKSPACE}, {BKSP} or {BS}
Break{BREAK}
Caps Lock{CAPSLOCK}
Delete{DELETE} or {DEL}
Down Arrow{DOWN}
End{END}
Enter{ENTER} or ~
Escape{ESC}
Help{HELP}
Home{HOME}
Insert{INSERT} or {INS}
Left Arrow{LEFT}
Num Lock{NUMLOCK}
Page Down{PGDN}
Page Up{PGUP}
Print Screen{PRTSC}
Right Arrow{RIGHT}
Scroll Lock{SCROLLLOCK}
Tab{TAB}
Up Arrow{UP}
F1{F1}
F2{F2}
F3{F3}
F4{F4}
F5{F5}
F6{F6}
F7{F7}
F8{F8}
F9{F9}
F10{F10}
F11{F11}
F12{F12}
F13{F13}
F14{F14}
F15{F15}
F16{F16}

To specify characters combinations use the following codes:
















KeyCode
Alt%
Ctrl^
Shift Lock+
For example to specify CTRL and C, the code would be object.SendKeys "^C" and for SHIFT F5 object.SendKeys "+{F5}". To specify multiple combination sets such as ALT A Z, you use parentheses, for example, object.SendKeys "%(AZ)".

Example

'VBScript Example
Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "%windir%\notepad.exe"
WshShell.AppActivate "Notepad"

WshShell.SendKeys "Hello World!"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "abc"
WshShell.SendKeys "{CAPSLOCK}"
WshShell.SendKeys "def"

作者:站长 来源:网络
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 陈工笔记(www.dui580.com) © 2024 版权所有 All Rights Reserved.
  • 站长:陈工 微信号:chengongbiji QQ:24498854
  • Powered by 陈工