Autohotkey - 当鼠标触摸屏幕边缘时重新映射鼠标滚轮

时间:2014-05-10 15:03:28

标签: autohotkey

我想将鼠标滚轮重新映射到 Ctrl + Alt + E 但仅当鼠标触摸屏幕的右边缘时。我知道如何重新映射鼠标滚轮滚动但我不知道如何只在鼠标触摸屏幕边缘时才能使其工作:

WheelDown::^!e

我希望有人可以帮助我完成剩下的脚本。

1 个答案:

答案 0 :(得分:0)

考虑到这一点,如果你的意思是触摸右边缘,则意味着鼠标的X坐标通常等于最大,屏幕的宽度(±1像素)。 / p>

  • #If可用于创建上下文相关的热键。请参阅#If
  • A_ScreenWidth可用于获取屏幕的宽度。请参阅A_ScreenWidth
  • CoordMode可以将坐标模式设置为相对于整个屏幕。请参阅CoordMode
  • MouseGetPos获取当前鼠标坐标。请参阅MouseGetPos

请花时间分析这个例子。

示例脚本

#If MouseIsTouchScreenRight()
WheelDown::^!e
#If

MouseIsTouchScreenRight() {
    CoordMode, Mouse, Screen ;set coordinates mode to be relative to the whole screen
    MouseGetPos, mX ;store the X coordinate of the mouse in `mX`
    if ( abs(A_ScreenWidth-mX) <= 2 ) ;if the "absolute" difference is within 2 pixels
        return true
    return false
}
相关问题