Reputation: 189
I'm working on the VBScript
, I use this code the send a Num Lock Key
.
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{NUMLOCK}"
The problem is I want to send a Left ALT Key
but I don't know the SendKeys value
.
I searched some documents, it only contains ALT key SendKeys value, I don't know if we have a left or right Sendkeys value.
Upvotes: 1
Views: 434
Reputation: 16672
The problem is the SendKeys()
method in WScript.Shell
does not differentiate between ALT and ALT GR as you have observed. This is probably due to how ALT, CTRL and SHIFT are treating as "modifiers" to existing keystrokes (see SendKeys
Method).
Some options would be;
You could build a COM library that you then use in VBScript via CreateObject()
to capture the keystrokes for you.
Use an existing COM library. There may be a cost involved (licencing etc.).
Use another scripting framework like AutoIt, which has extended support for keystroke detection - See Left Alt vs Right Alt
Upvotes: 0