Thursday, February 5, 2015

VBS Sendkeys Special Key Codes

Here are all the key codes in VBS for special keys like CTRL F4 ALT and other keys like that.  You use it with the sendkeys command.  This is how you do the send keys comand.  First you need to make the variable, then you can use sendkeys as much as you want without adding anymore variables.

Dim objShell : set objShell = CreateObject("WScript.Shell")

objShell.SendKeys "TEXT HERE"

The top line was setting the variable.  The bottom line was using the variable to execute the sendkeys command.  You type in the special commands like this.

objShell.SendKeys "{F5}"

Here are the special commands.

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}
Alt%
Ctrl^
Shift Lock+

No comments:

Post a Comment