Can't restore the native function of a prefix key when #InputLevel is set to nonzero value

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Can't restore the native function of a prefix key when #InputLevel is set to nonzero value

Re: Can't restore the native function of a prefix key when #InputLevel is set to nonzero value

by lexikos » 26 Nov 2017, 23:14

You may have found a bug, but...
blza wrote:What I want is to be able to trigger hotkeys that use Space in another AHK script running, that's why I need #InputLevel set to 1 as it consequently sets SendLevel to 1.
You don't need #InputLevel for that; just call SendLevel before calling Send.

Can't restore the native function of a prefix key when #InputLevel is set to nonzero value

by blza » 12 Sep 2017, 10:54

I'm using the latest version of AHK (1.1.26.01) and the following script fails to send Space key to the active window when I release Space key. So Space key gets disabled.

Code: Select all

#InputLevel 1
Space & LAlt::
    OutputDebug, %A_ThisHotkey%                
    return
Space:: 
    OutputDebug, %A_ThisHotkey%
    Send, {Space}
    return
Without #InputLevel it works fine. Exactly as described in AHK help file (see "Custom combinations").

If I run the script without #InputLevel 1 I get the following in the KeyHistory after hitting Space. And it gets sent to the active window.

Code: Select all

VK  SC  Type    Up/Dn   Elapsed Key 
---------------------------------------------------
20  039 s   d   0.76    Space           
20  039 h   u   0.08    Space           
20  039 i   d   0.05    Space           
20  039 i   u   0.00    Space
But with #InputLevel 1 I get the the following and the Space is not sent though hotkey is triggered (as can be seen in Lines most recently executed and in DebugView).

Code: Select all

VK  SC  Type    Up/Dn   Elapsed Key 
---------------------------------------------------
20  039 s   d   0.76    Space           
20  039 h   u   0.08    Space           
20  039 a   d   0.05    Space           
20  039 i   u   0.00    Space
What I want is to be able to trigger hotkeys that use Space in another AHK script running, that's why I need #InputLevel set to 1 as it consequently sets SendLevel to 1.

I think it's a bug and not the expected behaviour.

Top