How can I use the keyboard to switch the mouse between left-handed and right-handed?

7

2

We have both left-handed and right-handed users in our house. It would be handy to be able to change this setting from the keyboard rather than using the Mouse control panel. Is there a way to assign a keyboard combination to this function?

Edit: I realized after a few answers came in that some of the answers aren't working because of the Synaptics software that came with my HP Netbook. This software (or maybe something else, not sure) modifies my mouse control panel to look like this:

Mouse Properties

davidcl

Posted 2010-01-09T21:11:58.607

Reputation: 595

What Windows version are you using? – Ivo Flipse – 2010-01-20T19:15:58.897

@Ivo, it's in the tags. – John T – 2010-01-20T19:17:43.260

Answers

3

Another AutoHotkey approach:

^!s::
run main.cpl
RegRead, swapped, HKEY_CURRENT_USER, Software\Synaptics\SynTPCpl\TouchPadPS2_3, SwapMouseButtons
WinWait,Mouse Properties
if (swapped = 1)
{
    RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Synaptics\SynTPCpl\TouchPadPS2_3, SwapMouseButtons, % !swapped
    Send {TAB}{R}{A}{Enter}

}
else
{
    RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Synaptics\SynTPCpl\TouchPadPS2_3, SwapMouseButtons, % !swapped
    Send {TAB}{L}{A}{Enter}
}
return

Ctrl + Alt + s will toggle the button swap.

After installing AutoHotkey, run it; you'll get a dialog to make a script:

enter image description here

Hit Yes and paste the above code into the file, save it. Now run AutoHotkey again so it sits in your tray. It will now listen for the key combinations above until you right-click its tray icon and exit it.

John T

Posted 2010-01-09T21:11:58.607

Reputation: 149 037

@John T - do you want to add your final script to the answer? – davidcl – 2010-01-21T04:12:22.687

Of course, completely forgot! – John T – 2010-01-21T04:23:17.687

1Just to summarize the offline discussion here: the Synaptics software seems to do a ton of stuff and although it does store the setting in a registry key, simply updating that key isn't enough to switch the buttons. There wasn't a clear DLL call to change the buttons either. So we returned to the mouse control panel approach. The accepted answer uses the Synaptics registry key as a toggle so it knows what to do in the mouse control panel. It works great, but it's specific to this particular configuration with a Synaptics trackpad. – davidcl – 2010-01-21T14:36:56.340

A follow-up to this discussion. This AHK script has been working well for my family for several months now-- we can all play Plants Vs. Zombies with the trackpad in our preferred configuration, and switching back and forth is very smooth.

I did run into one problem, which I assume is related to this solution (although I can't figure out HOW it is related). When I use Remote Desktop from this computer to connect to another Windows machine, the buttons end up reversed in the remote session. I checked all the registry settings and they all look normal. But I wanted to mention the issue. – davidcl – 2010-04-15T14:57:31.253

You get an upvote for an AutoHotKey script that works, and the explanation of how to use it (which would have saved me time on the other autoHotKey example). I also like the fact that this doesn't open the mouse control panel. I'm keeping the bounty open for now because ideally I'd like to use the same key combination to swap the mouse buttons and to return to the default state. – davidcl – 2010-01-20T18:47:59.613

1Oh you want a toggle? no problem! answer updated. I think the new approach is better anyways as it updates the registry as well. Some applications may rely on this key to check your mouse settings, so this will give them the correct reading on your current settings. – John T – 2010-01-20T18:55:15.993

Okay, that works on my Vista machine at work. Unfortunately it still doesn't work on the Netbook where I really want it (that's the computer my left-handed daughter uses). I think I figured out why this and other solutions aren't working, and I'm going to update the question accordingly. – davidcl – 2010-01-20T19:20:19.790

However, thank you for this! I can tell I need to learn more about AutoHotKey and I really like your elegant use of it to solve this problem. – davidcl – 2010-01-20T19:21:07.307

That's odd, the synaptics software shouldn't affect this solution. It makes a direct dll call to SPI_SETMOUSEBUTTONSWAP, which is a Windows thing, unless synaptics handles the swap in another way I'm unaware of. If you could try swapping it to left handed while monitoring with process monitor ( http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx ), save the capture and upload it somewhere so I can see exactly what it does during the swap so I can fix it.

– John T – 2010-01-20T19:36:36.070

After some registry exploration, I thought that maybe I could just change Control Panel\Mouse to Software\Synaptics\SynTPCpl\TouchPadPS2_3 (which also has a SwapMouseButtons value that changes after adjusting the UI in the Mouse control panel). Alas, the Synaptics software must keep a copy of this value in RAM because simply changing it in the registry doesn't change the behavior of the trackpad. – davidcl – 2010-01-20T19:43:10.627

Yep just found that, updated accordingly! – John T – 2010-01-20T19:44:05.603

Downloading Process Monitor now. – davidcl – 2010-01-20T19:44:32.230

You may not need to. I found that registry setting right after you commented, the updated version may work. EliteMouse apparently handles synaptic touchpads as well, a more in-depth AutoHotkey script: http://www.autohotkey.com/forum/topic48238.html which you can use easily from the system tray: http://arcadefanatic.com/EitherMouse/Downloads/Screen.jpg

– John T – 2010-01-20T19:46:50.527

Your edited script still doesn't change the behavior of the trackpad, unfortunately.

I'll try EliteMouse. – davidcl – 2010-01-20T19:58:25.257

Okay, I'm a little bit confused. It's unclear how to use EitherMouse (not EliteMouse) with only one mouse. I think the swap option did work for me from EitherMouse once, but I couldn't get it to work consistently, possibly because it was changing the setting for the "other" mouse? Don't know.

I'm going to try the Process Monitor and see if that tells us anything we don't already know. – davidcl – 2010-01-20T20:06:07.377

Shoot. EitherMouse really screwed things up. Somehow EitherMouse managed to change the definition of left-handed and right-handed (see the screenshot above) such that when things are set to "right-handed" the buttons are reversed. This persisted even through a reboot. – davidcl – 2010-01-20T20:32:19.797

@davidcl yeah, typo on eithermouse, but it should work fine with a single mouse config, sorry about the mixup. Do you have a messenger account I can contact you on to make this easier? – John T – 2010-01-20T21:11:38.460

Oh I don't need a couple of days :) I've added you on Google talk. – John T – 2010-01-20T22:03:12.320

2

Sounds like a job for Autohotkey.

Something like:

^!c::
run main.cpl
WinWait ahk_class #32770
Send {Tab3}{Left}{Tab}{Space}{Enter}
return

To have Ctrl + Alt + C make the change. You'll need to adapt it a little for your set up.

Edit- This is closer, but still not quite perfect. My Dell touchpad utility might be getting in the way. Thanks for tips people

outsideblasts

Posted 2010-01-09T21:11:58.607

Reputation: 6 297

what keyboard combination changes mouse settings? – RJFalconer – 2010-01-09T21:20:40.867

Sounds promising. I've messed with AutoHotKey before but haven't used it too extensively. I'll give it a try. – davidcl – 2010-01-11T19:50:07.183

1You'll probably want to throw a WinWait in there, as AutoHotkey doesn't care if the window opens fast enough, it will start sending the keys regardless. – John T – 2010-01-20T04:38:23.483

@John T: That's helpful, but the main issue with this AHK script turns out to be a syntax error in the first line (since it is a multi-line script the run command should be on a separate line from the hotkey.

If someone would like to edit this response or create a new one with a complete working AHK script along with instructions for use, I'll award the bounty to that answer. – davidcl – 2010-01-20T17:40:21.830

1

I have both a right handed and a Logitech left-handed mouse installed. The left-handed mouse is automatically configured backwards. When you use it, the buttons are reversed, so that it operates correctly. No mucking with control panel is required!

Michelle

Posted 2010-01-09T21:11:58.607

Reputation: 533

This is a netbook, so we're really concerned about modifying the behavior of the built-in trackpad. Installing additional mice isn't really an option! – davidcl – 2010-01-11T19:49:19.107