Skip to content

Instantly share code, notes, and snippets.

@nouvist
Created April 14, 2024 08:11
Show Gist options
  • Save nouvist/077290417054e3a8ede7c34847debc8e to your computer and use it in GitHub Desktop.
Save nouvist/077290417054e3a8ede7c34847debc8e to your computer and use it in GitHub Desktop.

My Scroll is Broken

Following AutoHotkey2 script will disable the broken wheel, and add scroll functionality on the middle button. Alt + MButton + drag the mouse up or down.

; disable wheels
*WheelUp:: return
*WheelDown:: return

*!MButton:: {
  MouseGetPos(, &y1)
  KeyWait("MButton")
  MouseGetPos(, &y2)
  delta := Ceil((y2 - y1) / 100)
  if (delta > 0) {
    i := 0
    while (i < delta) {
      Send("{WheelUp 1}")
      i++
    }
  } else {
    i := 0
    while (i < -delta) {
      Send("{WheelDown 1}")
      i++
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment