【发布时间】:2018-01-24 18:59:59
【问题描述】:
我想编写一个按 X 次键的 AutoHotkey 脚本。例如,这是一个按 Tab 10 次的脚本。
Send, {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
虽然上述解决方案有效,但有点笨拙。
是否有更好的解决方案来多次发送密钥?
【问题讨论】:
标签: autohotkey
我想编写一个按 X 次键的 AutoHotkey 脚本。例如,这是一个按 Tab 10 次的脚本。
Send, {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
虽然上述解决方案有效,但有点笨拙。
是否有更好的解决方案来多次发送密钥?
【问题讨论】:
标签: autohotkey
尝试使用Send {Tab 10}
Repeating or Holding Down a Key
重复击键:用大括号括起来后面的键名 通过重复它的次数。例如:
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 和ControlSendRaw
ControlSend, Edit1, {Enter 5}, Untitled - Notepad
【讨论】:
^+,?
loop 4send ^+,
如果您希望循环重复,假设每 3 秒一次:
#a:: ; Win+a
Loop, 10
{
SendInput {Tab}
Sleep, 3000
}
【讨论】: