如何在 Autohotkey 中多次发送密钥?
How do I send a key multiple times in Autohotkey?
我想编写一个按 X 次键的 AutoHotkey 脚本。例如,这是一个按 Tab 10 次的脚本。
Send, {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
虽然上述解决方案有效,但有点笨拙。
多次发送密钥有没有更好的解决方案?
尝试使用 Send {Tab 10}
Repeating or Holding Down a Key
To repeat a keystroke: Enclose in braces the name of the key followed
by the number of times to repeat it. For example:
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.
来源: AutoHotkey - Send / SendRaw / SendInput / SendPlay / SendEvent: Send Keys & Clicks
这也适用于 ControlSend and ControlSendRaw
ControlSend, Edit1, {Enter 5}, Untitled - Notepad
如果你想在循环中重复,假设每 3 秒:
#a:: ; Win+a
Loop, 10
{
SendInput {Tab}
Sleep, 3000
}
我想编写一个按 X 次键的 AutoHotkey 脚本。例如,这是一个按 Tab 10 次的脚本。
Send, {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
虽然上述解决方案有效,但有点笨拙。
多次发送密钥有没有更好的解决方案?
尝试使用 Send {Tab 10}
Repeating or Holding Down a Key
To repeat a keystroke: Enclose in braces the name of the key followed by the number of times to repeat it. For example:
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.
来源: AutoHotkey - Send / SendRaw / SendInput / SendPlay / SendEvent: Send Keys & Clicks
这也适用于 ControlSend and ControlSendRaw
ControlSend, Edit1, {Enter 5}, Untitled - Notepad
如果你想在循环中重复,假设每 3 秒:
#a:: ; Win+a
Loop, 10
{
SendInput {Tab}
Sleep, 3000
}