Autohotkey 起动和起动;用按钮停止循环动作的脚本
脚本应符合以下要求: 按“C”:启动/停止脚本 鼠标左键:启动/停止循环 在循环内部:按住鼠标左键的同时,鼠标左键不断重复,直到我抬起手指为止Autohotkey 起动和起动;用按钮停止循环动作的脚本,autohotkey,Autohotkey,脚本应符合以下要求: 按“C”:启动/停止脚本 鼠标左键:启动/停止循环 在循环内部:按住鼠标左键的同时,鼠标左键不断重复,直到我抬起手指为止 每次单击后,鼠标都会回到屏幕中央 另一种方法是,每次单击后鼠标向下移动X像素,我的脚本速度非常慢。 它发出咔嗒声。。点击单击而不是单击:( 我现在把它改成了这个,但是鼠标左键总是被激活的,即使没有按住它,我也不能用C停止/启动脚本 HotKey, ~$*LButton, myLButtonAction ; Activate the hotkey by
- 每次单击后,鼠标都会回到屏幕中央
HotKey, ~$*LButton, myLButtonAction ; Activate the hotkey by default
return
~c:: ; configure a Hotkey: c will enable / disable your LButton actions
HotKey, ~$*LButton, toggle ; ON / OFF
return
myLButtonAction: ;cnote: this is NOT a hotkey, it's a label
Loop
{
Click
Sleep 7,516 ;your loop actions (see question code)
}
return ; don't forget your returns at the end of a label / hotkey
看起来您需要使用该命令
我的脚本非常慢。它会单击..单击..单击而不是单击:(
包括在您的代码中。我已经在上面的代码示例中这样做了。您所说的“停止/启动”是什么意思?当按下“C”时,脚本停止,以便我可以正常使用鼠标。再次按下“C”将激活脚本,以便我可以在按住LMB的同时单击鼠标左键。添加了上面的代码,但现在LMB总是在不按住它的情况下单击。我也不能用“C”停止脚本。是的,因为我跳过了循环中的部分。我更新了我的帖子,再试一次。coo!:)你可能会接受这个答案,否则问题会被视为未解决。相反,如果你仍在寻找其他答案,请保持开放
x := (A_ScreenWidth // 2)
y := (A_ScreenHeight // 2)
HotKey, ~$*LButton, myLButtonAction ; Activate the hotkey by default
setMouseDelay, 0
setKeyDelay, 0
return
~c:: ; configure a Hotkey: c will enable / disable your LButton actions
HotKey, ~$*LButton, toggle ; ON / OFF
return
myLButtonAction: ; note: this is NOT a hotkey, it's a label
Loop ;loop the script until broken
{ ;loop start
GetKeyState, var, LButton, P ;Get the state of Lbutton
If var = U ;has it been released?
Break ;its been released so break the loop
;Send {LButton} ;It hasnt been released so send another Click
Click %x%, %y%
Sleep 100 ;time between presses, after sleep return to the top of the loop
} ;loop end
return ; don't forget your returns at the end of a label / hotkey