简体   繁体   English

Logitech 脚本,第一次和第二次点击事件与时间重置

[英]Logitech Script, 1st and 2nd click events with time reset

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" and after 2 seconds it resets, I mean if I don't press the same button after 2 seconds it uses letter "e " again.我想要做的是,如果我按下鼠标上的按钮,它会使用像“E”这样的键,如果我再次按下按钮,它会使用“W”键,2 秒后它会重置,我的意思是如果我不这样做2 秒后按下相同的按钮,它再次使用字母“e”。 Is that possible?那可能吗?

I've tried some codes but no results yet:我已经尝试了一些代码,但还没有结果:

  function OnEvent(event, arg, family)
    if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then 
    toggle = not toggle
    if toggle then
      PressKey("e")
      ReleaseKey("e") 
    else  
      PressKey("w")
      ReleaseKey("w")
    end
  end
end
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

hi i'm looking for something similar, but without time reset.嗨,我正在寻找类似的东西,但没有时间重置。 like, 1st click "e", 2nd click "w", 3rd click "e", 4th click "w", and again and again比如,第一次点击“e”,第二次点击“w”,第三次点击“e”,第四次点击“w”,一次又一次

someone can help me?有人可以帮助我吗? thank u guys谢谢你们

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 onClick 方法在第二次单击时有效。 但它应该在第一次点击时起作用 - onClick method works on 2nd click. But it should work on the 1st click 我想在wpf的第一个列表视图中选择同一行后,在第二个列表视图中选择同一行,该怎么办? - I want to select the same row on the 2nd listview after i select it on the 1st listview in wpf, how can that be done? jQuery问题鼠标移到第二个 - jQuery Problem Mouseover the 2nd 监视书签上的点击事件(Google Apps脚本) - Monitor click events on bookmarks (Google Apps Script) 如何在单击事件时一次仅验证一个文本框 - How to validate only one textbox at a time on click of events C# 应用程序 - 视频 stream 在第一次尝试时未启动 - C# App - Video stream does not start at 1st attempt 事件似乎在第二次超时时被覆盖 - Event seem to get overwritten on timeouts 2nd loop 捕获除重置之外的所有事件 - Catch all events except in reset chrome 扩展内容脚本(Shadow DOM)中的谷歌分析点击事件跟踪 - Google Analytics click events tracking in chrome Extension Content script (Shadow DOM) 多次点击事件-混乱? - Multiple Click Events - Clutter?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM