Autohotkey-虚拟键盘/自动输入 [英] Autohotkey - virtual keyboard / AutoInput

查看:126
本文介绍了Autohotkey-虚拟键盘/自动输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Autohotkey中有一个简单的脚本:

I have this simply script in Autohotkey:

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

当我在记事本上键入 teams 时,我的输出是球队名单(米兰,尤文图斯..)
如果我使用实体键盘输入 teams ,则此脚本对我有用

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

,但是如果使用虚拟键盘键入 teams ,则我在记事本上没有列表:

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

,如果我运行脚本以自动输入 teams

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

该脚本不会将 teams 替换为球队列表

为什么只有在使用物理键盘输入时脚本才能起作用?
有没有一种解决方案可以在不使用物理键盘的情况下用我的脚本替换单词和句子?

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

推荐答案

您可以使用 Input 命令.

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 := ""
}

这篇关于Autohotkey-虚拟键盘/自动输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆