Reputation: 55
I'm trying to add custom keyboard commands to an application using Autohotkey. In many of these hotkeys I would like to use the alt key in combination with some other key of my choice (any of the standard letters).
All works fine as long as I don't restrict their usage in such a manner that they work in the target application only (via the #IfWinActive directive ). If I do so, the hotkeys themselves still work, however their behavior is very strange.
I found that they get activated either if
a) I hold down the alt key and then press the second key (in my case the 'b' key) twice or
b) I use this hotkey two times consecutively with a very short delay between the two triggerings - The above two cases might actually be 1 case. I'm not sure...
Code sample:
#IfWinActive, MyAppTitle ahk_class MyAppClass
!b::
click 367, 86
return
Upvotes: 0
Views: 702
Reputation: 2411
Alt+letter commands in AutoHotkey such as !b
work without issue. It's possible the version at the time of this post contained certain bugs or was out of date from the current version.
For your code, it could be done like so:
!b::
WinGetTitle, Title, A
if (RegExMatch(Title, "MyAppTitle"))
{
MouseClick, left, 367, 86
}
return
Upvotes: 0