如何在Autohotkey中多次发送密钥?

Ste*_*ica 14 autohotkey

我想写一个按键X次的AutoHotkey脚本.例如,这是一个按Tab10次的脚本.

Send, {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
Run Code Online (Sandbox Code Playgroud)

虽然上述解决方案有效,但它有点笨拙.

是否有更好的解决方案多次发送密钥?

Ste*_*ica 25

尝试使用 Send {Tab 10}

重复或按住键

重复击键:在大括号中包含键的名称,后跟重复键的次数.例如:

Send {DEL 4}   ; Presses the Delete key 4 times.
Send {S 30}    ; Sends 30 uppercase S characters.
Send +{TAB 4}  ; Presses Shift-Tab 4 times.
Run Code Online (Sandbox Code Playgroud)

来源:AutoHotkey - Send/SendRaw/SendInput/SendPlay/SendEvent:发送键和点击


这也适用于ControlSendControlSendRaw

ControlSend, Edit1, {Enter 5}, Untitled - Notepad
Run Code Online (Sandbox Code Playgroud)


Kai*_*ack 5

If you want the repeat in a loop, let's say every 3 seconds:

#a::   ; Win+a
Loop, 10
{
    SendInput {Tab}
    Sleep, 3000
}
Run Code Online (Sandbox Code Playgroud)