Scrolling with two mouse buttons with AutoHotkey

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

Note: there are more IBM and family 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

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.

; Allows middle click emulation when pressing ; left and right mouse buttons down together ; Kali (https://sharktastica.co.uk) ~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.