[Catch it]SendLevel not work on hotstring

Report problems with documented functionality
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

[Catch it]SendLevel not work on hotstring

12 Aug 2014, 22:03

Code: Select all

#InputLevel 1		;Both work.
1::
	;~ SendLevel 1	;Can only trigger hotkey "$3", but not hotstring "2".
	Send 2
	Sleep 500
	Send 3
return
#InputLevel 0	;Default
:*:2::
	ToolTip 2
	return
$3::ToolTip 3
SendLevel wrote:Every newly launched hotkey or hotstring thread starts off with a send level equal to the input level of the hotkey or hotstring.
So, #InputLevel 1 works fine.
SendLevel wrote:For any event generated by a script to trigger a hook hotkey or hotstring, the send level of the event must be higher than the input level of the hotkey or hotstring.
Effective only on hotkey.

2014-8-15:
Thread maybe relative SendLevel intermittent issues?
Last edited by RobertL on 15 Aug 2014, 05:14, edited 2 times in total.
我为人人,人人为己?
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: SendLevel not work on hotstring

13 Aug 2014, 16:19

It works for me. How about you add a ? to the hotstring option. Because as it is now, the hotstring only triggers if the last key you used is an ending character:
(type q1 >> no hotstring, q 1 >> hotstring), which may explain why you don't see the hotstring triggered.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: SendLevel not work on hotstring

13 Aug 2014, 19:23

Nextron, you are confusing ? with *.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: SendLevel not work on hotstring

13 Aug 2014, 20:39

I've picked the right option, but my explanation might be a little off... let me retry:
Nextron wrote:Because as it is now, the hotstring only triggers if the last key you used before the hotstring trigger is an ending character non-alphanumeric:
(type randomletters1 >> no hotstring triggers, wordandspace 1 >> hotstring does trigger), which may explain why you don't see the hotstring being triggered.
Hotstrings wrote:? (question mark): The hotstring will be triggered even when it is inside another word; that is, when the character typed immediately before it is alphanumeric. For example, if :?:al::airline is a hotstring, typing "practical " would produce "practicairline ".
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: SendLevel not work on hotstring

13 Aug 2014, 21:08

Good catch! Now I understand what's happening.

The reason for the inconsistency is that #InputLevel 1 forces the hotkey to be implemented using the k-hook method rather than the reg method (and I'm guessing k-hook hotkeys reset the hotstring recognizer). Using the $ prefix in combination with SendLevel has the same effect.

reg hotkeys don't reset the hotstring recognizer, probably because at the time the keystroke passes through the keyboard hook, we don't yet know that it's a hotkey. AutoHotkey could reset the recognizer when one of its own reg hotkeys fire, but this wouldn't work for reg hotkeys implemented by other scripts/applications. (The reg method is used in nearly all other applications which have global hotkeys.)

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 53 guests