Saturday 10/29/05
Last month I got a Fujitsu Lifebook P1510D, an ultraportable (2.2 pound) notebook computer with a touch-sensitive screen that swivels around and folds flat backward tablet-style. However, it's not a "true" Tablet PC (no active digitizer) so there's no easy way to right-click. No button on the stylus and since it doesn't have WinXP Tablet, no software option to right-click when you tap and hold.
The passive digitizer is, on the whole, a feature as far as I'm concerned because it means you can easily click things and drag windows around with your fingernail, even when the machine's in notebook configuration. You don't get pressure sensitivity and there's no way for the screen to tell where you're pointing without clicking, which means no Alias Sketchbook, but I can't draw so that doesn't matter to me. Plus if you lose your stylus it's cheap to replace since it's just a bit of plastic. So, no foul.
Fujitsu's solution to the lack of right-click functionality is a task bar icon that you tap to make your next tap a right-click. This is pretty much exactly as inconvenient as it sounds and it's the only thing about this machine that I don't absolutely love.
I Asked MetaFilter to tell me the name of a program that would bring tap-and-hold right-clicking to my machine. They came up blank. (A perennial problem for me and AskMeFi. Apparently if I can't figure something out for myself, nobody else can either. I hasten to add it's not the site's fault; I do ask some damn obscure questions.)
I decided to see if I could at least program one of the hard buttons next to the display to right-click using what we used to call a "macro program" in the old days -- something that could record and play back user mouse actions and keystrokes. I did find a free, capable macro utility, AutoHotkey, which could easily generate the required mouse click with one line of script, and could even compile it to a standalone EXE. (Amusingly, that EXE is 180K, larger than an Apple II floppy disk.) Unfortunately I had forgotten that Fujitsu doesn't let me assign the hard buttons to launch applications. The hard buttons are hard-coded to PageUp/PageDown (which is convenient when you're reading, so again, no foul) and you can only reprogram Fn + hard button to launch programs. That's even less convenient than the taskbar icons.
So I was stymied. Still, AutoHotKey looked cool, and I started digging around a little bit to see what it could do. And discovered that one of the "showcase" scripts that comes with it is a mouse gesture interpreter. You hold down the right mouse button, draw a shape, and the script runs a corresponding subroutine. The source code for it is all there.
Wait a minute. AutoHotKey can trigger scripts when you click a mouse button? I wonder if that applies to the left mouse button... I mean, it would be kinda weird to trigger a script that way, but you never know...
Long story short: I can use AutoHotKeys to trap the left mouse button and have the script generate a right-click if I hold the stylus down in the same spot for a while, but pass through the left-click otherwise. There were some exceptions I had to work out (for example, how to make it NOT deselect a selection if you tap and hold on it -- you might think you want to always pass through the initial left mousedown, but you don't; also, if you drag something out of a window, you probably don't want to right-click if you pause in the middle of the drag) but in the end, I was able to get the script to work just the way I wanted. The performance is fine; it's not sluggish at all. And of course AutoHotKey let me make it into an EXE with a tray icon that has its own little context menu.
That's right. I've just written my first piece of Windows software. Which feels kinda weird for a longtime Mac nerd like me. Still, I have to say, writing scripts for AutoHotkeys feels a lot like scripting OneClick for the Mac, which was a favorite of mine back in the day. Except it's all free. Even the compiled EXEs are free to distribute or even to sell. So...
Download: SoftRightClick for Windows. By me.
aspcomments2 by Jerry Kindall
based on aspcomments by sneaker