Skip to content

Instantly share code, notes, and snippets.

@frnkq
Created October 4, 2022 11:56
Show Gist options
  • Save frnkq/76fcc421cf0600272f90f3c31fda7522 to your computer and use it in GitHub Desktop.
Save frnkq/76fcc421cf0600272f90f3c31fda7522 to your computer and use it in GitHub Desktop.
set wsc = CreateObject("WScript.Shell")
Do
WScript.Sleep (60*1000)
wsc.SendKeys ("{SCROLLLOCK 2}")
Loop
@frnkq
Copy link
Author

frnkq commented Oct 4, 2022

Some special keys, such as the control keys, function keys etc are encoded in a string enclosed by {braces}
See the table below

Key/Character SendKey Description
~ {~} Send a tilde (~)
! {!} Send an exclamation point (!)
^ {^} Send a caret (^)
+ {+} Send a plus sign (+)
Backspace {BACKSPACE} or {BKSP} or {BS} Send a Backspace keystroke
Break {BREAK} Send a Break keystroke
Caps Lock {CAPSLOCK} Press the Caps Lock Key (toggle on or off)
Clear {CLEAR} Clear the field
Delete {DELETE} or {DEL} Send a Delete keystroke
Insert {INSERT} or {INS} Send an Insert keystroke
Cursor control arrows {LEFT} / {RIGHT} / {UP} / {DOWN} Send a Left/Right/Up/Down Arrow
End {END} Send an End keystroke
Enter {ENTER} or ~ Send an Enter keystroke
Escape {ESCAPE} Send an Esc keystroke
F1 through F16 {F1} through {F16} Send a Function keystroke
Help {HELP} Send a Help keystroke
Home {HOME} Send a Home keystroke
Numlock {NUMLOCK} Send a Num Lock keystroke
Page Down Page Up {PGDN} {PGUP} Send a Page Down or Page Up keystroke
Print Screen {PRTSC} Send a Print Screen keystroke
Scroll lock {SCROLLLOCK} Press the Scroll lock Key (toggle on or off)
TAB {TAB} Send a TAB keystroke

To specify keys combined with any combination of SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following:

   For SHIFT prefix with +
   For CTRL  prefix with ^
   For ALT   prefix with %

Source:https://ss64.com/vb/sendkeys.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment