在按住 Shift 键并按下左键单击或按下右键单击时执行某些操作

Do something while shift and left click pressed or right click pressed

我有这个小的 Autohotkey 脚本

LoopFunc()
{
    while (GetKeyState("shift") && GetKeyState("lbutton")) || GetKeyState("rbutton")
    {
        send, {4}
        sleep, 500
    }
}

~rbutton::LoopFunc()

~+lbutton::LoopFunc()

RButton 按预期工作,但 Shift+LButton 仅循环两次。

知道为什么吗?

编辑:

我将其添加到我的 while 循环中

n := GetKeyState("shift", "p")
m := GetKeyState("lbutton")
tooltip, %n% %m%

第一个工具提示是 1 1,第二个工具提示是 0 1

"p" parameter to get the actual physical state of the button and use &用于LShift+LButton:

LoopFunc()
{
  while (GetKeyState("shift", "p") && GetKeyState("lbutton", "p")) || GetKeyState("rbutton")
  {
    send, {4}
    sleep, 500
  }
}

~rbutton::LoopFunc()

~lshift & lbutton::LoopFunc()