Why does visual studio capture key events before autohotkey?

I recently switched to the Dvorak keyboard layout as part of an experiment. One of the hardest parts of the transition is hotkeys. Most keyboard shortcuts are designed with QWERTY in mind, and, even worse, keyboard shortcuts seem to be associated exclusively with muscles.

Instead of relearning all the hot keys, I wrote an autohotkey script to translate the Dvorak layout back to QWERTY when the Ctrl , Alt or Win keys are pressed in combination with other keys. It works great wherever I tried, except for Visual Studio '08. The keystrokes seem to be caught before autohotkey can translate them.

Why is this happening and how can I fix it?

Below is a snippet (from the very beginning) of my script:

; control + letter ^;::^z ^q::^x ^j::^c ^k::^v 

Update: the script works fine on Win7 with the new ahk, vs08 and coderush installations. The car with which I have problems has a perspective. Any thoughts on how to further diagnose?

Update 2: the script works great with beta versions of Vista and 2010. It seems to be something with vs 08 + vista. Let's try the new vs08 installation tonight.

+59
visual-studio-2008 visual-studio autohotkey dvorak
Dec 11 '09 at 19:30
source share
3 answers

Yeah! I get it. If ahk and the target application do not work under the same privileges (or by the user), ahk will not correctly intercept / simulate keyboard events. In my case, the visual studio was run with administrator privileges (elevated), while ahk script was run as the current user.

Either one of the following resolved the issue:

  • Running both vs and ahk as current user
  • Compiling the script and running both vs and the compiled application as administrator
+126
Dec 15 '09 at 4:58
source share

I just want to add a couple of points to the solution found by the OP itself.

1) The problem is not that AHK and VS work with different permissions - it’s just that the hotkeys created by the script launched in administratorless mode will not work on applications running in administrator mode, but not the problem if this vice versa.

2) There is no need to compile the script necessarily, just install autohotkey.exe to run in administrator mode (what I do), or, alternatively, create a shortcut for a specific script and set it to always run in administrator mode. (By the way, just to indicate there is no performance by running the compiled version of the AHK script, because the code is still interpreted - this is what the interpreter is now embedded in the created executable file)

+34
Dec 10 2018-11-12T00:
source share

This phrase in a small print sounds relevant:

If SendMode is used in the automatic execution section (top of the script), this affects all re-mappings. However, since remapping uses Send {Blind}, and since SendPlay does not fully support {Blind}, some remapping may not work correctly in SendPlay mode ( especially Control, Shift, Alt, and Win ). To get around this, avoid SendPlay in the autorun section when redirecting; then use the SendPlay command against Send in other places throughout the script. In addition, you can translate your reprints into hot keys (as described below) that explicitly call SendEvent vs. Send

0
Dec 11 '09 at 19:58
source share



All Articles