-1

这是我的示例脚本

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

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

4

1 回答 1

-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
于 2013-06-06T08:57:42.170 回答