Getting the Logitech m610's email button to work with GMail

The Logitech m610 is a wireless mouse with a few nifty additions to the usual wireless laser mouse feature mix. Most notably:
- 2.4GHz communication using a tiny USB dongle
- Goes into standby mode to save batteries when your laptop goes to sleep
- Has volume and mute controls with on-screen display
- Has email and instant message buttons that light up when you get an email or IM
The downsides covered in most reviews are obvious, that the mouse isn't rechargable (uses standard AAs) and that the email and IM buttons only work with Outlook/Outlook Express and Yahoo/Microsoft Messenger, respectively. A serious failing in the Logitech SetPoint software, in my humble opinion. The only thing I'd add to those is the lack of a small compartment for the USB transmitter, which is pretty tiny and could easily fit inside the mouse.
I'm not one to give up quite so easily on a cool feature like email notification, even though I never use Outlook or OE. The Instant Messaging I can live without, but I bought this mouse for $20 and the little blue light was a big selling point. So I set about figuring out a way to get it to work with Google Mail, my client of choice.
Setting it up requires a few steps:
Step 1 : Configure the mail button to open your client
Registry settings and javascript script
Using the great work done by Graham Wilmott I created this javascript file to launch gmail (only slight modifications to his original). Alternately you can use a very small file which contains simply the following:
var objShell = WScript.CreateObject("WScript.Shell");
objShell.Run("http://www.gmail.com");
This just launches the default browser to gmail.com. If you use the more complete javascript file, then clicking on mailto: links will open the gmail compose window, which is nice. Use the above two lines if you're having problems or use a client other than gmail. I use Firefox so it opens in a new tab, and if I'm already logged in, it just goes to my inbox. If you use hotmail, yahoo, or something else, change the second line above to your preferred site. It can even be a non-email site, if that tickles your fancy.
Step 2 : Light up that email button
Outlook Express Data Files
The way the mouse software knows there's new mail is by watching the Inbox.dbx file for the default Outlook Express Identity. This is determined by the regkey HKEY_CURRENT_USER\Identities\Default User ID. Outlook Express modifies the file Inbox.dbx when new mail comes in, so that's the key to manipulating the light.
- Open up Outlook Express, and set up Gmail for POP access - I suggest the 'new messages that arrive from now on' option.
- Under Tools->Options->Maintenance, click the 'Store Folder' button and note the location of your message store. It'll be something like:
C:\Documents and Settings\username\Local Settings\Application Data\Identities\{DBF16927-8FE1-1EDA-A099-460B7165289A}\Microsoft\Outlook Express
Where username is your Windows user name.
- In that folder, copy the Inbox.dbx file to Inbox.bak.
- Send yourself an email and when it arrives your blue button should light up. If it doesn't, check your SetPoint settings and get this working before you go any further.
- Once you have a lit button, close Outlook Express without reading the email and copy the Inbox.dbx file to Inbox.new
Mail checking with a Perl script
Disclaimer: All of the following assumes you'll never actually run outlook express again; if you do, then expect your inbox to be blown away repeatedly.
Use this perl script and run it as an NT service. It does the following:
- Initializes the Inbox.dbx file to the 'no new mail' state (Inbox.bak)
- Checks for new messages using perl's GMail::Checker module.
- Copies the Inbox.new file to Inbox.dbx when mail arrives
- Sleeps 5 seconds
- Resets the Inbox.dbx file with Inbox.bak
- Saves the new mailstate value
- Sleep for a minute, rinse, repeat.
That's about it - now the mouse's button should light up, Outlook Express doesn't even need to be running.
Some things to note
- The blue light doesn't turn off when you push it, which is annoying.
- The Logitech setpoint software (setpoint.exe / KHALMNPR.EXE) must be running for the outlook data files to be checked and to get the mouse led lit.
- SetPoint allows you to set how long the light blinks before it turns off, set Notification Duration in the email tab under My Mouse.
I haven't written a C program to automate the mail checking yet, and if anyone's up for collaborating on some open source freeware to do it, great. Until then, I'm living with a perl script running in the background. I'd love to write a little nullsoft installer that does all of the above, including setting up regkeys, finding the outlook profile and inbox files, and launching a background process for notification, but time isn't something I have a lot of these days. If someone does it, please let me know?
Questions, comments to s a i @ e n t r o p y f a r m . o r g
page version history
01/26/06 : v.001 : Initial rev. Used Google Talk registry key to determine inbox state: HKCU\Software\Google\Google Talk\Accounts\mailstate
01/27/06 : v.002 : Determined SetPoint knowledge of Outlook Express Identity: HKCU\Identities\Default User ID
01/27/06 : v.003 : Found Graham Wilmott's javascript script and regkeys to replace outlook express as the default Windows mail client.
01/27/06 : v.004 : Discovered Erik Kastner's perl gmail scraper which might obviate the need for google talk. one less program in my system tray.
07/09/08 : v.005 : Updated instructions and perl script to use GMail::Checker