简体   繁体   中英

Logitech Script: 1st click, 2nd click, 1st click, 2nd click event

what I want to do is if I press the button on my mouse it uses a key like "E" and if I press the button again it uses the key "W", one more time press button "e", and again "w".
Is that possible?

I find this but it's not realy what i want:
https://stackoverflow.com/a/62067519/17803151

local prev_tm_btn5 = -math.huge

function OnEvent(event, arg, family)

   if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then

      local tm = GetRunningTime()

      local key = tm - prev_tm_btn5 > 2000 and "e" or "w"

      prev_tm_btn5 = tm

      PressKey(key)

      Sleep(15)

      ReleaseKey(key)

   end

end

thank you !

Try:

local key

function OnEvent(event, arg, family)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
      key = key == "w" and "e" or "w"
      PressKey(key)
      Sleep(15)
      ReleaseKey(key)
   end
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM