Autohotkey 自动热键:I';我无法制作一个脚本来按两个键之间的延迟
我想做一个脚本,目标是: 3{DOWN}键,然后按住或快速按Z x3,然后循环所有操作。 我一直在尝试使用loop命令,但我就是做不到,我对AutoHotkey和英语还不熟悉,因为这不是我的母语,所以这很难 这是我尝试过的代码,但没有像我预期的那样工作,因为它在3{DOWN}键之前按Z键Autohotkey 自动热键:I';我无法制作一个脚本来按两个键之间的延迟,autohotkey,helpers,Autohotkey,Helpers,我想做一个脚本,目标是: 3{DOWN}键,然后按住或快速按Z x3,然后循环所有操作。 我一直在尝试使用loop命令,但我就是做不到,我对AutoHotkey和英语还不熟悉,因为这不是我的母语,所以这很难 这是我尝试过的代码,但没有像我预期的那样工作,因为它在3{DOWN}键之前按Z键 #Persistent SetTimer, Code, 150 Return Code: Send, Z{DOWN} Return 如果您知道如何改进我的工作,请添加一个类似F8的开关来打开/关闭,这将是一
#Persistent
SetTimer, Code, 150
Return
Code:
Send, Z{DOWN}
Return
如果您知道如何改进我的工作,请添加一个类似F8的开关来打开/关闭,这将是一个很好的选择
谢谢你的帮助。
海伦娜。海伦娜,你的剧本现在做的是以下几点。一旦脚本启动,它将开始每隔150毫秒发送[Z]和[Arrow down]。这与当时运行的应用程序无关。 您写下希望循环发送代码,并希望打开/关闭此选项 下面是一个更接近您目标的示例
#Persistent
F8:: ; This is your [F8] Toggle hotkey
If Toggle:=!Toggle ; Here you "test" the value of the variable "toggle" and after testing switch it to the opposite (true/false)
SetTimer, Trigger, -1 ; This is to create a separate thread for the loop. -1 means start in 1 ms but only do this one time, not every 1 ms's.
return
Trigger:
While (Toggle)
{
Send, +z{Down} ; + is the shift key, thus +z makes captial Z
Sleep, 500 ; Wait 500 ms (1/2 a second)
Send, +{z Down} ; Press Shift z Down. This will NOT start a repeat like ZZZZZZZZZZZZZZZZ
Sleep, 500 ; Wait 500 ms (1/2 a second)
Send, +{z Up} ; Lift Shift z Up
Sleep, 1 ; Required. Without it The F8 keypress to toggle off can not be read anymore
}
Return