lua 中 PressMouseButton 值为2时不起作用

我在lua中编写了一些代码,用于我的罗技鼠标,但我不明白为什么 PressMouseButton(2) 不起作用,如果我写任何其他值,如1或3,这些键将起作用,我想按下鼠标中键(也就是滚轮点击)。 这是代码的受影响部分。

function OnEvent(event, arg)
    if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
        PressMouseButton(2)
        Sleep(math.random(30, 100))
        ReleaseMouseButton(2)
        Sleep(math.random(30, 100))
    end
end

PS. 在键位分配中,中键设置为默认键。

鼠标型号:罗技 G203 Prodigy。

我哪里错了?

EDIT: 如果我需要在浏览器中测试宏,PressMouseButton(2) 将返回到上一页,但我不明白为什么。

原文链接 https://stackoverflow.com/questions/69989506

点赞