boiler wrote:
Or just add
#InputLevel 1 for the hotkeys. Perhaps that wasn't clear from my previous post.
Code: Select all
#InputLevel 1
5::
SendInput, {U+0061} ;Charecter a
Return
6::
SendInput, {U+0062} ;Charecter b
Return
::ab::myhotstring
Return
FYI, this code can be shortened to:
Code: Select all
#InputLevel 1
5::SendInput, {U+0061} ;Charecter a
6::SendInput, {U+0062} ;Charecter b
::ab::myhotstring
...because single line hotkeys have an implied
return and a
return after the hotstring doesn’t serve a purpose. It’s not needed for the hotstring itself and it’s not marking the end of a block of code (hotkeys and hotstrings aren’t part of the auto-execute section).
Hey thanks for explanation about my misuse of the return command, much appreciated.
As for you solution, I have tried it with vanilla AHK code and it works perfectly!
I've tying to integrate the solution into TapHold manager code brackets, sadly its not working as expected.
In the example bellow, a tap will type
a and a hold will type
b but the hotstring does not trigger at all.
Do you think it could be a case of the
#InputLevel, 1 command being out of scope for the code brackets? as in not local?
Code: Select all
#InputLevel, 1
UBK_Typer:= new TapHoldManager( 0, 170, 1, "") ;( 0, 220, 1, "")
UBK_Typer.Add("2", Func("UBK_Typer_2"))
UBK_Typer_2(isHold, taps, state)
{
if (taps == 1)
{
if (isHold == 0)
{
SendInput, {U+0061} ;Letter A
}
else
{
if (state)
{
SendInput, {U+0062} ;Letter B
}
}
}
}
::ab::myhotstring