How to Fake Back and Forward Buttons With a Three-button Mouse

By Erez Zukerman on March 9th, 2011

image

If you’re stuck using a three-button mouse, this doesn’t mean you have to give up on the comfort of Back and Forward browser buttons. Using a simple AutoHotkey script, you could set your mouse up so that you can hold the right mouse button and scroll the wheel to emulate these all-important buttons.

Getting The Script

First of all, here’s the script itself. You can just copy/paste these lines into a local AHK file and run it by double-clicking on the script file.

#IfWinNotActive Total Commander
RButton::click right
RButton & WheelDown::Send {Browser_Back}
RButton & WheelUp::Send {Browser_Forward}
#IfWinNotActive

Of course, you could also add this code to an existing AutoHotkey script if you want.

Understanding The Script

When you use a piece of code like this, it’s always nice to understand what it does so you can customize it. In this case, the first line excludes Total Commander; this is because Total Commander makes a distinction between short right clicks (for selecting files) and long right clicks (for showing a context menu). If you don’t use Total Commander, you can simply drop the first and last lines.

As for the other three lines: RButton::click right preserves the original functionality of the right click. Without this line, right clicking would have no effect across your system. The remaining two lines emulate the back and forward buttons. On our test system, each “click” of the scroll wheel fired exactly one button press, so the tactile feedback was quite effective.

Extending The Script

Using this same principle, you could take the code from our recent post showing how to change a window’s opacity using a hotkey and tweak it so that holding the left mouse button while scrolling the wheel would make the active window more transparent. If you need a hint on how to do this, let us know and we’ll show you in the comments.

[Photo: iwd]

A technical writer for Tibbo Technology by day, Erez is obsessed with customizing anything and everything. After years of using Litestep and Blackbox, switching to a custom keyboard layout (Colemak), extending Word and Excel with elaborate VBA, losing weight with an AutoHotkey script he developed and spending countless hours tweaking Foobar2000 to get it to look "just right", Erez decided the time has come to share some of this obsession with the world at large.

  • Published 03/9/11
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!