×

Scrolling with two mouse buttons with AutoHotkey

  • Updated 4 March 2021
  • Est. Reading Time: 2.03 minutes

One of the most frustating (lack of) features with old pointing stick equipped keyboards is that they are usually limited to two mouse buttons for you to get by with, effectively disallowing the ability to natively scroll with the device without needing an external mouse or sacrificing the key on the keyboard to serve as a 'middle' mouse button. Thankfully for Windows users, AutoHotkey can be used to emulate middle mouse button functionality with just two mouse buttons.

Applicable keyboards

  • Model M4-1 TrackPoint II keyboards
  • Model M5-1 & M5-2 trackball keyboards
  • Model M13 TrackPoint II or Unicomp pointing stick keyboards
  • Model M 5576-C01 Japanese TrackPoint II keyboards
  • Model M EnduraPro Unicomp pointing stick keyboards
  • Any TrackPoint II or TrackPoint III-equipped IBM ThinkPad
  • Other IBM TrackPoint-equipped rubber dome keyboards (eg, RT3200, KPD8923, or KPH0035)

Note: there are more IBM and co or third-party keyboards with pointing sticks that could support this functionality, however, most modern devices such as TrackPoint IV-equipped ThinkPads offer a dedicated third mouse button for scrolling anyway or can make use of tap guestures for scrolling.

What you need

  • Windows 2000 or newer
  • Latest AutoHotkey 1.1 revision
  • Compatible keyboard or laptop with two dedicated mouse buttons

The solution

When confronted with this issue, there are usually two ways people resolve this issue: remapping right mouse button to middle mouse button or triggering a middle mouse button event when both buttons are pressed down together. In my solution, I opted for the latter since it preserves the ability to perform right mouse button actions in addition to middle clicking.

~LButton & RButton:: ~RButton & LButton:: Send {MButton} return

To use the code snippit provided, you'll need to create an AutoHotkey script to put it in. Once AutoHotkey is installed, right-click an empty area of your Windows desktop, hover over "New", and then click "AutoHotkey Script" to create the file, then open the file in your favourite text editor and paste the code in and save. Once done, simply double-click the script file to run the code. If you then wish to make this script run every time Windows starts up, simply compile the script via right-clicking the script file and clicking "Compile Script", and then follow steps 3 and 4 from these instructions from Microsoft on how to make an app run on startup.