当我用鼠标左键同时按住左键控制键时,我正在尝试制作一个反复点击鼠标左键的脚本 这是我到目前为止: function OnEvent(event, arg, family) OutputLogMessage("clicked event = %s, arg = %s\n", event, arg)
这是我到目前为止:
function OnEvent(event, arg, family) OutputLogMessage("clicked event = %s, arg = %s\n", event, arg); if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and Ctrl_Down == 1 then repeat PressMouseButton(1) //repeat while the left mouse button down until not PressMouseButton(1) else ReleaseMouseButton(3) //stop the repating on left mouse button up end end
请注意,这是我第一次查看此类编码,因为非常感谢任何帮助
首先,您必须定义EnablePrimaryMouseButtonEvents()以启用鼠标按钮1的事件报告要避免任何无限循环,你必须放入sleep();
Press left control key then left mouse button it will repeat the click
until you release the left mouse button then release left control key
the script should be stopped
你的最终代码应该是:
EnablePrimaryMouseButtonEvents(true); function OnEvent(event, arg) if IsModifierPressed("lctrl") then repeat if IsMouseButtonPressed(1) then repeat PressMouseButton(1) Sleep(15) ReleaseMouseButton(1) until not IsMouseButtonPressed(1) end until not IsModifierPressed("lctrl") end end