问题
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