按住鼠标右键后检测F键

时间:2018-03-31 17:07:43

标签: autohotkey

我正在尝试编写一个脚本,检测Right Mouse Click被关闭至少1.5秒,然后F键被按下,而Right Mouse Click仍被保留。

我尝试了以下内容:

Loop
{
Send, {F Down}
Sleep 2000
Send, {F Up}
sleep 1500
}
return

^F::Pause

我意识到这只是一个计时器而且没有检测到按下了哪些键。如何编写实现上述功能的脚本?

1 个答案:

答案 0 :(得分:0)

loop
 {
 Key := GetKeyState("rbutton")

 while(Key = 0)
  {
  Key := GetKeyState("rbutton")
  sleep,100
  }

 while(Key = 1)
  {
  sleep,100
  loopnmb := A_Index
  if(loopnmb = 8) ;;this number changes the length rbutton has to be pressed before F key activates 
   {
   Key := GetKeyState("rbutton")  
   while(Key = 1)
    {   
    Send, {F Down}
    Key := GetKeyState("rbutton")
    if(Key = 0) 
     {
     Send, {F Up}
     break
     }
    }
   }
  }
 }

计时器有点偏,所以玩吧。