[v2.0.13+ bug] "up" and "down" states make hotkeys invalid

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Askeron52
Posts: 5
Joined: 12 Feb 2024, 06:35
Contact:

[v2.0.13+ bug] "up" and "down" states make hotkeys invalid

08 May 2024, 11:45

Lines such as the following do not work for me since 2.0.13 (still broken in 2.0.14), but used to work in 2.0.12:

Code: Select all

+ up:: WheelUp
- up:: WheelDown
Space up:: Enter
These lines give "Error: invalid hotkey"

[Mod edit: Moved topic from 'Bug Reports'.]
gregster
Posts: 9081
Joined: 30 Sep 2013, 06:48

Re: [v2.0.13+ bug] "up" and "down" states make hotkeys invalid

08 May 2024, 11:50

Your remappings used to rely on a bug or rather missing error detection, which is now fixed since v2.0.13:
lexikos wrote:
11 Apr 2024, 21:30
The purpose of a remapping is to remap one key to another, not the release of a key to another key.
Try instead:

Code: Select all

+ up::Send("{WheelUp}")
- up::Send("{WheelDown}")
Space up::Send("{Enter}")
Last edited by gregster on 08 May 2024, 11:58, edited 1 time in total.
Askeron52
Posts: 5
Joined: 12 Feb 2024, 06:35
Contact:

Re: [v2.0.13+ bug] "up" and "down" states make hotkeys invalid

08 May 2024, 18:10

The proposed solution still crashes the script in both 2.0.13 and 2.0.14 (curiously, it also crashes in 2.0.12, while the original code didn't).
My interpretation is that putting "up" or "down" after a key as part of a remapping breaks the parsing of the script, since the given error is A ":" is missing its "?" (I guess the first colon after 'up' is interpreted as part of a ternary operator, which is not the case)
gregster
Posts: 9081
Joined: 30 Sep 2013, 06:48

Re: [v2.0.13+ bug] "up" and "down" states make hotkeys invalid

08 May 2024, 18:46

I can't reproduce this. Nothing crashes here with v2.0.14. The code above works as expected. (But of course, down shouldn't be used on the left side of ::, following a key name. And for a remapping, up shouldn't be used either, as already noted. It could still be used for a hotkey definition.)

What does msgbox A_AHKversion say ?
What is the exact code you are running? What else is in your script?
Askeron52
Posts: 5
Joined: 12 Feb 2024, 06:35
Contact:

Re: [v2.0.13+ bug] "up" and "down" states make hotkeys invalid

09 May 2024, 06:41

So, I did a more thorough test and can confirm that indeed you were right, the proposed code works in all three versions (it wasn't working earlier because of another problem in my script).
I'd say the issue is figured out now, thanks to you!

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: No registered users and 21 guests