New hotkey modifier "@" to suppress repetitions using already existent windows api flag

Propose new features and changes
gvieira
Posts: 2
Joined: 09 Nov 2020, 05:30

New hotkey modifier "@" to suppress repetitions using already existent windows api flag

Post by gvieira » 15 Jun 2021, 22:35

There is a MOD_NOREPEAT flag (0x4000) in the "RegisterHotKey" windows function that isn't used with ahk yet, it makes the key repetitions from the key being held be suppressed by the system.

My request is that it's implemented using a new hotkey modifier "@"

Example of a script that suppresses repetitions without the flag.

Code: Select all

F4::
  if F4Pressed
    return
  F4Pressed := true
  Tooltip F4 was pressed!
return

F4 up::
  F4Pressed := false
  Tooltip
return
Same script with the flag:

Code: Select all

@F4::Tooltip F4 was pressed!
@F4 up::Tooltip
Source: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerhotkey#parameters

I'm new on the forum (this is actually my first post), but I'm very active on discord, and this "suppress repetitons" problem appears often enough that I think it would be helpful.

My c++ knowledge is limited to be able to submit a github PR with a bugless version of the implementation so I thought it would be better to just suggest it here.

just me
Posts: 8042
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: New hotkey modifier "@" to suppress repetitions using already existent windows api flag

Post by just me » 16 Jun 2021, 04:29

Changes the hotkey behavior so that the keyboard auto-repeat does not yield multiple hotkey notifications.

Windows Vista: This flag is not supported.
WinUser.h:

Code: Select all

#if(WINVER >= 0x0601)
#define MOD_NOREPEAT    0x4000
#endif /* WINVER >= 0x0601 */
Might be an option for v2.

gvieira
Posts: 2
Joined: 09 Nov 2020, 05:30

Re: New hotkey modifier "@" to suppress repetitions using already existent windows api flag

Post by gvieira » 16 Jun 2021, 05:17

just me wrote:
16 Jun 2021, 04:29
Changes the hotkey behavior so that the keyboard auto-repeat does not yield multiple hotkey notifications.

Windows Vista: This flag is not supported.
WinUser.h:

Code: Select all

#if(WINVER >= 0x0601)
#define MOD_NOREPEAT    0x4000
#endif /* WINVER >= 0x0601 */
Might be an option for v2.
Why is it a problem that it's not supported on really old versions of windows?

swagfag
Posts: 4644
Joined: 11 Jan 2017, 17:59

Re: New hotkey modifier "@" to suppress repetitions using already existent windows api flag

Post by swagfag » 16 Jun 2021, 06:32

i think if this were to be implemented, it would have to be implemented as a hook hotkey in order to support hook hotkeys. so it wouldnt matter whether RegisterHotkey() had a flag for it or whether it was supported on whatever OS
the only question that remains is whether its worth(the time/effort) implementing it in source given the alternatives(KeyWait, #If, other inscript solutions)

just me
Posts: 8042
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: New hotkey modifier "@" to suppress repetitions using already existent windows api flag

Post by just me » 16 Jun 2021, 06:40

gvieira wrote:Why is it a problem that it's not supported on really old versions of windows?
Because AHK scripts must run on all supported system versions.

Post Reply

Return to “Wish List”