AutoHotkey does not capture keystrokes when VS2012 is active window

4

When Visual Studio 2012 is active window (and only when Visual Studio is the active window) on my new Windows 8 machine, AutoHotkey does not capture keystrokes. I did not have this problem with VS2010 on Windows 7.

How can I have AutoHotkey take precedence over VS2012?

Here is the script from the .ahk file:

;;;; Spotify! ;;;;

SetTitleMatchMode 2 

; "WindowKey + F11"  for previous 
#F11::
DetectHiddenWindows, On 
ControlSend, ahk_parent, ^{Left}, ahk_class SpotifyMainWindow 
DetectHiddenWindows, Off 
return 


; "WindowKey + F12"  for next 
#F12::
{ 
DetectHiddenWindows, On 
ControlSend, ahk_parent, ^{Right}, ahk_class SpotifyMainWindow 
DetectHiddenWindows, Off 
return 
} 

; "WindowKey + F10"  for pause
#F10::
{ 
DetectHiddenWindows, On 
ControlSend, ahk_parent, {space}, ahk_class SpotifyMainWindow 
DetectHiddenWindows, Off 
return 
} 

GaTechThomas

Posted 2013-01-03T23:50:59.883

Reputation: 1 734

Do the keystrokes get captured when not in VS? Is the script running as admin? Post your code. – Elliot DeNolf – 2013-01-04T20:59:06.590

They do get captured when not in VS. Don't have my code at the moment but will update question soon. – GaTechThomas – 2013-01-07T16:40:16.313

I think that this is a "generic" Microsoft problem. I know of someone who can't swap the [Ctrl] and [Alt] keys because I.E. captures the keystrokes even before the scancodes. So when the [Ctrl] and [Alt] keys are swapped it works for every application EXCEPT I.E. Seems that VS2010 has the same problem. Curious though how this seemed to work in Windows 7. – Robert Ilbrink – 2013-03-18T12:04:21.400

B.t.w. is this for every key or just the [F1]...[F12] keys? – Robert Ilbrink – 2013-03-18T12:06:47.217

It didn't seem to work in Windows 7 with VS2010: It actually did work. I have the previous machine at the office, with both VS2010 and VS2012, which I can check to see if this is a VS2012 thing. I'll check now if it is only the F keys. – GaTechThomas – 2013-03-19T19:53:13.253

Same problem with mapping to Win+G. If VS2012 is active window it doesn't work. If VS2012 is not active, it does work. – GaTechThomas – 2013-03-19T19:59:17.837

Tested with SSMS (pre-2012 Visual Studio engine based) on Windows 8, and had no problems. Seems not to be a Windows 8 thing. Seemw to be VS2012. – GaTechThomas – 2013-03-19T20:13:47.300

1@GaTechThomas Good research! Shame that VS2012 seems to be misbehaving. – Robert Ilbrink – 2013-03-21T02:19:01.110

Have you tried running the autohotkey script as Administrator? – ivanatpr – 2013-04-19T18:11:51.213

I will give that a try. – GaTechThomas – 2013-04-20T18:17:07.333

Answers

4

It is because your running Visual Studio and AutoHotKey on different permission levels. You are most likely running VS as Admin but running AHK as you (the logged in user). I suggest running them both at the same permission level, and your problem will be fixed.

Robert

Posted 2013-01-03T23:50:59.883

Reputation: 141

1Just wanted to say thanks for this. I'm not sure I ever would have realized this, but it was definitely the issue! – Wrightboy – 2016-01-26T16:22:05.163