怎样实现按下鼠标 4 按键后停止脚本运行,即一个“杀死开关”

我想知道怎样让按下鼠标 4 按键后停止或者添加一个非常长的休眠时间,即一个禁用自动点击器的杀死开关

function OnEvent(event, arg)
   --输出日志消息("事件:"..event.." 参数:"..arg.."\n")
   if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
      repeat
         PressAndReleaseMouseButton(1)
         Sleep(math.random(40, 135))
      until not IsMouseButtonPressed(5)
   end
end

原文链接 https://stackoverflow.com/questions/71272688

点赞
stackoverflow用户1847592
stackoverflow用户1847592

在 Lua 中,until 定义了 repeat-until 循环的退出条件。

尝试替换

until not IsMouseButtonPressed(5)

until not IsMouseButtonPressed(5) or IsMouseButtonPressed(4)
2022-02-26 00:15:40
stackoverflow用户18701759
stackoverflow用户18701759

尝试这个!

function OnEvent(event, arg)
   --OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")
if (event == "PROFILE_ACTIVATED") then
        EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
 ReleaseMouseButton(1)
 ReleaseMouseButton(2) --prevent stuck
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 7) then
        enable = not enable
        enable point = not point
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) and enable then
      repeat
         PressAndReleaseMouseButton(1)
         Sleep(math.random(40, 135))
      until not IsMouseButtonPressed(5)
   end
end

MBTN 7 将成为您的切换

2022-04-12 08:37:19