Adjust sendlevel for specific send command

Propose new features and changes
Peter_Wang
Posts: 7
Joined: 01 Jun 2020, 12:22

Adjust sendlevel for specific send command

20 Jul 2020, 20:49

Now once sendlevel is specified in a thread, the whole thread will keep that sendlevel, even though another (lower or higher) sendlevel is declared underneath that one. Hence if one devise a hotkey or hotstring that functions differently according to the different conditions that some allow send command to trigger other hotstring together with characters user typed subsequently while some are not then sendlevel's current function is not enough to accomplish it.
If there are only a few hotstrings you want send command is able to trigger then you can combine them together using input command or inputhook object however if there are a great number of hotstrings then it would be very inconvenient to copy whole existing hotstrings to the matchlist of input command or inputhook.
Here is an example:

Code: Select all

global ih := InputHook("I1VL1000")
ih.KeyOpt("{All}", "NV")
ih.Start()
ih.OnEnd:=func("restart")
restart(ih)
{
    ih.start()   
}
#inputlevel,2
#if GetKeyState("c")
:*?:p::
:*?:l::
:*?:f::
:*?:t::
:*?:i::
:*?:b::
:*?:e::
:*?:j::
:*?:a::
g:=SubStr(ih.input,0)
StringUpper, h, g
sendlevel,1
sendinput % g
KeyWait,c,T 0.1
if (Errorlevel=1)
{
    sendlevel,0
    BlockInput,On
    sendinput {bs 2}\mathcal %h% `
    KeyWait % g
    KeyWait,c
    BlockInput,Off
}
return
Here if c is not held down for 100ms enough, it will send itself and can be used to trigger other hotstrings, otherwise, it will send "\mathcal" %h% (which is a LaTeX code). Now you can see sendlevel 0 is useless here, so "\mathcal" with a trailing space is highly likely to trigger other hotstrings.
Yes, For this specific task I can use suspend command but if I want to keep %h%'s ability to trigger certain hotstrings with what I subsequently typed, then suspend command will be hard to accomplish it due to its large scope.
My idea is that the sendlevel command's scope is too board. If possible its scope should be the lines between two sendlevel command. It would be best if there is an option available for send command to set its sendlevel.

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 8 guests