I use a hotkey to "paste" the current clipboard contents into the window with focus by sending keystrokes, very useful for app windows that don't support a normal paste function (such as certain remote session windows and consoles), which comes in handy to enter complex passwords, long URLs, etc. when pasting isn't an option. This works perfectly with most such app windows,
except (so far) with the
VMware Remote Console app which exhibits the following behavior during such a pseudo-paste operation: as soon as one of the sent characters would require the use of
Shift to type it in the current keyboard layout,
all subsequent characters are entered as if
Shift is still being pressed, i.e. as if it were never released as further characters were being typed on the keyboard.
Here is a stripped down sample script with a hard-coded password string that illustrates the issue:
Code: Select all
; "Paste as keystrokes" test
^+q::
Tooltip, You have 5 seconds to`nfocus the target window!
Sleep, 5000
Tooltip
SetKeyDelay, 80
SendRaw, bb1&fA(VTo3#2(7R
Return
What winds up in the target window instead of the expected "
bb1&fA(VTo3#2(7R" is "
bb1&FA(VTO#@(&R", i.e. all the characters after the first "
&" (which is a shifted character in the US keyboard layout) are the shifted version of the expected character in that layout. [A more readable example is that sending "
abcd@abcd" would result in "
abcd@ABCD" being entered into the target window.]
I have tried the different flavors of Send modes (though I do need
SendRaw since the clipboard contents I normally paste are arbitrary and unknown) as well as different
SetKeyDelay settings, all without success so far.
As a further test, if I replace the
SendRaw line in the sample script with the following line that uses
Send and
explicitly releases
Shift after consecutive shifted characters, the result is correct, but this is not an option as figuring out the modified string for arbitrary keyboard layouts and string contents would be a massive undertaking:
Code: Select all
Send, bb1&{Shift Up}fA(VT{Shift Up}o3{#}{Shift Up}2({Shift Up}7R
Any ideas to make
SendRaw work reliably even with such pathological app windows? Am I missing some magic setting or option? [I realize most people aren't in a position to test potential solutions since the issue is limited so far to the VMware Remote Console app, but consider it a thought experiment and I'll test promising suggestions.]
Thanks.
JB