改变AHK响应,每次我移动我的鼠标:(

时间:2013-06-05 22:42:27

标签: autohotkey

这是我的示例脚本

$f2::
loop, 1
while GetKeyState("f2", "P")
{
setkeydelay, 1
send, {f2}
click
}
return

我有3个延迟正常,快速,每次我移动鼠标它都会更快延迟。我应该在脚本中添加什么来使响应保持一致?

1 个答案:

答案 0 :(得分:-1)

ListLines, Off
CoordMode, Mouse

cnt:=1, arr:=[50 ; normal
            , 25 ; fast
            , 0] ; faster

$F2::
;~    TrayTip,, % "delay is: "arr[cnt]
   MouseGetPos, xPos, yPos
   xPosPrev:=xPos, yPosPrev:=yPos
   While, GetKeyState("F2", "P")
   {
      MouseGetPos, xPos, yPos
      If (xPosPrev!=xPos Or yPosPrev!=yPos)
      {
         `(cnt=3) ? cnt:=1:cnt++, xPosPrev:=xPos, yPosPrev:=yPos, bool:=False
;~          TrayTip,, % "delay changed to: "arr[cnt]
         While, !bool
         {
            MouseGetPos, xPos, yPos
            bool:=(xPosPrev=xPos And yPosPrev=yPos) And A_Index>50 ? True:False
            Sleep, GetKeyState("F2", "P") ? 25:-1
            xPosPrev:=xPos, yPosPrev:=yPos
         }
      }
      SetKeyDelay, arr[cnt]
      Send, {F2}{Click}
      Sleep, GetKeyState("F2", "P") ? 25:-1
   }
   Return