Autohotkey - virtual keyboard / AutoInput

。_饼干妹妹 提交于 2019-12-13 08:26:54

问题


I have this simply script in Autohotkey:

:*:teams::
(
milan
juventus
inter
roma
lazio
napoli
mantova
)

When i type teams on Notepad my output is the list of teams (milan, juventus..)
if i use a physical keyboard to type teams this script work for me

, but if use a virtual keyboard to type teams i have no list on Notepad:

and if i run the script to type teams automatically

WinWait, *new  2 - Notepad++, 
IfWinNotActive, *new  2 - Notepad++, , WinActivate, *new  2 - Notepad++, 
WinWaitActive, *new  2 - Notepad++, 
MouseClick, left,  133,  117
Sleep, 100
Send, squadre

the script doesn't replace teams with the list of teams

Why the script works only if i type with a physical keyboard?
is there a solution to replace words, sentences with my scripts without using physical keyboard?

Sorry if i am noob


回答1:


You can use the Input command.

loop {
    While !RegexMatch(strCapture, "teams$") {
        Input, strUserInput, V L1, {BackSpace}  ; V: visible, L1: Character length 1
        If ErrorLevel = Endkey:BackSpace
            strCapture := SubStr(strCapture, 1, StrLen(strUserInput) - 1) 
        else
            strCapture .= strUserInput
        ; tooltip % ErrorLevel "`n" strUserInput "`n" strCapture "`n" ; enable this to see what actually happens
    }
    SendInput,
    (Ltrim
        {Backspace 5}
        milan
        juventus
        inter
        roma
        lazio
        napoli
        mantova
    )
    strCapture := ""
}


来源:https://stackoverflow.com/questions/13642295/autohotkey-virtual-keyboard-autoinput

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!