Page 1 of 1

invalid hotkey

Posted: 22 Nov 2017, 18:43
by Hyo
[Moderator's note: Topic moved from Bug Reports.]

Hi I need some help with AHK script

a & Space::Left
d & Space::Right
w & Space::Up

6::exitapp

"Error at line 1
Line Text: *a & Space::
Error: Invalid hotkey."

I tried to change code to ANSI
nothing.

I tried to change keyboard language to English
nothing.

i tried to use example script with &
"Numpad0 & Numpad2::
Run Notepad"
script started but when i use scrout nothing happend

Re: invalid hotkey

Posted: 22 Nov 2017, 19:12
by Helgef
Maybe a & Space::Send {Left} is sufficent. According to the documentation on remappings, the remapping a::b causes this,

Code: Select all

*a::
SetKeyDelay -1   ; If the destination key is a mouse button, SetMouseDelay is used instead.
Send {Blind}{b DownTemp}  ; DownTemp is like Down except that other Send commands in the script won't assume "b" should stay down during their Send.
return

*a up::
SetKeyDelay -1  ; See note below for why press-duration is not specified with either of these SetKeyDelays.
Send {Blind}{b Up}
return
and since custom combination hotkeys do not accept the wildcard *, you get the error. From custom combination hotkeys documentation
Unlike a normal hotkey, custom combinations act as though they have the wildcard (*) modifier by default.
To mimic the remap, you can try,

Code: Select all

a & space::
	SetKeyDelay -1   
	Send {Blind}{left DownTemp}
return

a & space up::
	SetKeyDelay -1  
	Send {Blind}{left Up}
return
Good luck.

Re: invalid hotkey

Posted: 26 Nov 2017, 02:13
by lexikos
Custom combination hotkeys (a & b) and remapping (a::b) are mutually-exclusive; you cannot combine them. This is by design.

Re: invalid hotkey

Posted: 27 Dec 2017, 05:59
by lexikos
I realized that it was trivial to support custom combinations for remapping by simply omitting * when space-&-space is detected, so v1.1.27.01 will support it.

However, I think the OP's hotkeys are backwards. They are very awkward to activate, since you must press and hold a/d/w before space. If you swap them around (Space & a::), it is easy to use a/d/w as arrow keys while holding Space.