Hello, I defined a custom combination of two keys by using the "&" character, and when I execute the hotkey, it activates the hotkey associated with the second key from the key combination.
Specifically, when I execute the hotkey "Esc & F1", it also executes the hotkey "F1" at the same time.
I believe this is related to the fact that "custom combinations act as though they have the wildcard (*) modifier by default".
Is this the problem? If so, how can I disable this wildcard behavior with 2-key custom combinations?
2-Key Custom Combinations Activating Other Hotkeys Topic is solved
- BeyondDNA2021
- Posts: 6
- Joined: 31 May 2021, 16:20
- BeyondDNA2021
- Posts: 6
- Joined: 31 May 2021, 16:20
Re: 2-Key Custom Combinations Activating Other Hotkeys Topic is solved
Well this is embarrassing. I figured out my problem. My script was doing this behavior because I did not include a "return" line at the end of my hotkey.
Re: 2-Key Custom Combinations Activating Other Hotkeys
I am having this exact problem. But, unlike the OP, including a return is not helping.
Below is a simplified version of my code just to highlight the issue.
When I hold down Enter, then press and release f, then release Enter, a blank notepad.exe is launched as expected.
But, if I am lazy and very quickly press Enter & f, notepad.exe is launched, but a f is then typed in the opened notepad.
I have tried all sorts of KeyWait and Sleep ideas, but nothing helps.
It is as if AutoHotKey is processing both the "Enter & f" and the "f up" hotkeys defined below. But again, it only does that when I type "Enter & f" very quickly.
Any thoughts or ideas would be very appreciated.
Below is a simplified version of my code just to highlight the issue.
When I hold down Enter, then press and release f, then release Enter, a blank notepad.exe is launched as expected.
But, if I am lazy and very quickly press Enter & f, notepad.exe is launched, but a f is then typed in the opened notepad.
I have tried all sorts of KeyWait and Sleep ideas, but nothing helps.
It is as if AutoHotKey is processing both the "Enter & f" and the "f up" hotkeys defined below. But again, it only does that when I type "Enter & f" very quickly.
Any thoughts or ideas would be very appreciated.
Code: Select all
Enter::Enter
Enter & f::
Run notepad.exe
return
f::
return
f up::
if (GetKeyState("Enter","P") = false)
Send f
return
Re: 2-Key Custom Combinations Activating Other Hotkeys
I figured it out.
Replacing this:
With this:
Is the answer.
Replacing this:
Code: Select all
if (GetKeyState("Enter","P") = false)
Code: Select all
if (A_PriorHotKey != "Enter & " A_PriorKey)