如何设置(numlock和capslock)以打开Logitech脚本

发布于 2025-02-09 06:18:39 字数 1399 浏览 3 评论 0原文

大家好,我想使用“ capslock”或“ capslock”,而不是按钮4和5更改第一个和第二个代码,并使用“ numlock”激活和停用脚本,如果有人可以帮助我,这是我的脚本:

function OnEvent(event, arg)
   OutputLogMessage("event = %s, arg = %d\n", event, arg)
   if event == "PROFILE_ACTIVATED" then
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "PROFILE_DEACTIVATED" then
      ReleaseMouseButton(2) -- to prevent it from being stuck on
   elseif event == "MOUSE_BUTTON_PRESSED" and (arg == 4 or arg == 5) then     
      recoil = recoil ~= arg and arg
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil == 4 then
      repeat
         MoveMouseRelative(-2, 3)
         Sleep(10)
         MoveMouseRelative(2, -2)
         Sleep(10)
      until not IsMouseButtonPressed(1)
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil == 5 then
      repeat 
    MoveMouseRelative(-10, 9)
    Sleep(16)
    MoveMouseRelative(10, -10)
    Sleep(16)
   until not IsMouseButtonPressed(1) 
   end
end

我想要设置numlock以打开和关闭脚本。我想在Capslock不在脚本上时设置以下方式:

repeat
     MoveMouseRelative(-2, 3)
     Sleep(10)
     MoveMouseRelative(2, -2)
     Sleep(10)
until not IsMouseButtonPressed(1)

当Capslock在脚本上使用时 这:

repeat 
    MoveMouseRelative(-10, 9)
    Sleep(16)
    MoveMouseRelative(10, -10)
    Sleep(16)
until not IsMouseButtonPressed(1)

如果可以的话,请帮助我。谢谢你!!

hello everyone I want to use "capslock" off or on instead of buttons 4 and 5 to change the first and second code and use "numlock" to activate and deactivate the script, if anyone can please help me this is my script:

function OnEvent(event, arg)
   OutputLogMessage("event = %s, arg = %d\n", event, arg)
   if event == "PROFILE_ACTIVATED" then
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "PROFILE_DEACTIVATED" then
      ReleaseMouseButton(2) -- to prevent it from being stuck on
   elseif event == "MOUSE_BUTTON_PRESSED" and (arg == 4 or arg == 5) then     
      recoil = recoil ~= arg and arg
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil == 4 then
      repeat
         MoveMouseRelative(-2, 3)
         Sleep(10)
         MoveMouseRelative(2, -2)
         Sleep(10)
      until not IsMouseButtonPressed(1)
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil == 5 then
      repeat 
    MoveMouseRelative(-10, 9)
    Sleep(16)
    MoveMouseRelative(10, -10)
    Sleep(16)
   until not IsMouseButtonPressed(1) 
   end
end

i want to set numlock to turn on and off script. and i want to set when capslock is off script use this:

repeat
     MoveMouseRelative(-2, 3)
     Sleep(10)
     MoveMouseRelative(2, -2)
     Sleep(10)
until not IsMouseButtonPressed(1)

and when capslock is on script use
this:

repeat 
    MoveMouseRelative(-10, 9)
    Sleep(16)
    MoveMouseRelative(10, -10)
    Sleep(16)
until not IsMouseButtonPressed(1)

plz help me if you can . thank you!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

捂风挽笑 2025-02-16 06:18:39

您可以通过调用函数iskeylockon来确定锁定键的当前状态:

function OnEvent(event, arg)
   OutputLogMessage("event = %s, arg = %d\n", event, arg)
   if event == "PROFILE_ACTIVATED" then
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsMouseButtonPressed(3) and IsKeyLockOn"numlock" then
      if not IsKeyLockOn"capslock" then
         -- capslock is off 
         repeat
            MoveMouseRelative(-2, 3)
            Sleep(10)
            MoveMouseRelative(2, -2)
            Sleep(10)
         until not IsMouseButtonPressed(1)
      else
         -- capslock is on
         repeat 
            MoveMouseRelative(-10, 9)
            Sleep(16)
            MoveMouseRelative(10, -10)
            Sleep(16)
         until not IsMouseButtonPressed(1) 
      end
   end
end

You can determine the current status of lock-keys by invoking function IsKeyLockOn:

function OnEvent(event, arg)
   OutputLogMessage("event = %s, arg = %d\n", event, arg)
   if event == "PROFILE_ACTIVATED" then
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsMouseButtonPressed(3) and IsKeyLockOn"numlock" then
      if not IsKeyLockOn"capslock" then
         -- capslock is off 
         repeat
            MoveMouseRelative(-2, 3)
            Sleep(10)
            MoveMouseRelative(2, -2)
            Sleep(10)
         until not IsMouseButtonPressed(1)
      else
         -- capslock is on
         repeat 
            MoveMouseRelative(-10, 9)
            Sleep(16)
            MoveMouseRelative(10, -10)
            Sleep(16)
         until not IsMouseButtonPressed(1) 
      end
   end
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文