DonationCoder.com Forum

DonationCoder.com Software => Coding Snacks => Finished Programs => Topic started by: doctorfrog on September 03, 2009, 12:24 AM

Title: DONE: Toggle mouse acceleration with a simple program
Post by: doctorfrog on September 03, 2009, 12:24 AM
My annoyance is fairly straightforward, as well as (I would hope) its solution:

I want to toggle this with a hotkey:

[ You are not allowed to view attachments ]

THE STORY:

I bought a touchpad for my desktop to combat RSI. It's... ok, I guess. See, the driver that it comes with doesn't actually recognize the touchpad, which means that Windows sees it as a mouse. This isn't a huge problem; it works fine. Though without the driver, it lacks some customizable options, I can live with it. My mouse remains plugged in, since I will be swapping between the two devices based on the tasks I am doing.

The problem is that I now have two devices that run on the same control panel settings, and physically are two devices with different kinds of sensitivity.

The touchpad actually causes more strain without the "Enhance pointer precision," option enabled, since moving the pointer requires repeated 'scrubbing' with the fingers. With the feature enabled, I can move the pointer much more easily while retaining control.

However, this setting is far too sensitive for my mouse, which flies all over the screen like an out of control fighter plane.

To switch devices, I have to launch the Mouse applet, toggle the "Enhance pointer precision" setting manually, then resume using my input device. Without a helpful shortcut, I have to do this many times a day.

PROBLEM: Two pointing devices on one system, one that needs mouse acceleration, the other doesn't. Need an easy way to toggle the "Enhance pointer precision" setting to aid in switching between the two devices.

SOLUTION: A small program that launches, toggles the "Enhance pointer precision" setting from the Mouse control panel applet, and then closes itself. (If the setting is active, it deactivates it. If it's inactive, it activates it.)

Since this is an issue I've found with laptops I've used as well, this could be useful beyond my specific use case. I've often had to resort to touchpad on the go, and later dock, to find that my mouse is flying uncontrollably until I toggle this setting off.

Since I already use a decent hotkey manager, I don't need this to be a running program. Ideally, it would just execute, toggle the setting, and close. I can call upon the program when I need it.

BONUS: The ability to store actual mouse settings as profiles, and toggle in between them with user-configurable hotkeys. This is far beyond my own needs, of course, but this might be a more interesting challenge for some.

Thanks for your time, o programmers of tiny things.
Title: Re: IDEA: Toggle mouse acceleration with a simple program
Post by: doctorfrog on September 03, 2009, 12:27 AM
Darn, I think I may have posted in the wrong forum. Mods, can you please move my post to the correct place? I apologize for the mistake. :tellme:
Title: Re: IDEA: Toggle mouse acceleration with a simple program
Post by: skwire on September 03, 2009, 02:03 AM
Try this:  Mat (Mouse Acceleration Toggler) (http://skwire.dcmembers.com/apps/mouse_accel_toggler/MouseAccelToggler.zip)

1) Unpack archive to a folder of your choice.

2) Run MouseAccelToggler.exe with one of the following switches:

    1) -on       This will turn mouse acceleration on.
    2) -off      This will turn mouse acceleration off.
    3) -toggle   This will toggle mouse acceleration from its current state.
Title: Re: IDEA: Toggle mouse acceleration with a simple program
Post by: doctorfrog on September 03, 2009, 02:56 AM
Perfect. Thank you!
Title: Re: IDEA: Toggle mouse acceleration with a simple program
Post by: skwire on September 03, 2009, 03:11 AM
You're welcome.  May I assume it's working for you?  If so, we'll call it done.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: Kamel on September 27, 2009, 01:16 PM
And I thought I was the only one with these problems haha.

Thanks for this, I too will be using it. If you would like to improve it, I think it would be best improved by having mouse sensitivity and/or acceleration options, and store/load all of them according to which one you're using.

I actually switch between my touchpad and a gaming mouse, so the sensitivity difference is quite substantial. This little app will probably be all that I need to switch between the 2 easily though.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on September 27, 2009, 02:34 PM
If you would like to improve it, I think it would be best improved by having mouse sensitivity and/or acceleration options, and store/load all of them according to which one you're using.

Just to clarify, you would like to be able to set the pointer speed value, right?

[ You are not allowed to view attachments ]
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: doctorfrog on September 27, 2009, 04:52 PM
If you would like to improve it, I think it would be best improved by having mouse sensitivity and/or acceleration options, and store/load all of them according to which one you're using.

Just to clarify, you would like to be able to set the pointer speed value, right?
 (see attachment in previous post (https://www.donationcoder.com/forum/index.php?topic=19785.msg178953#msg178953))

Just a quick update: yes, this simple software has solved my problem. However, being able to toggle pointer speed settings would also be preferred, since in my specific case, mouse acceleration isn't quite enough to make the touchpad respond the way I'd like. Instead of simply toggling a single setting, the software would also have to retrieve, store, and apply two alternating speed settings.

I do realize that this would increase the scope of the software, so I choose to be happy with what I have right now, especially since I'm in a little financial difficulty at the moment and don't have a roll of quarters to drop in some kind programmer's bucket.  :-[
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on September 27, 2009, 05:11 PM
Just a quick update: yes, this simple software has solved my problem. However, being able to toggle pointer speed settings would also be preferred, since in my specific case, mouse acceleration isn't quite enough to make the touchpad respond the way I'd like. Instead of simply toggling a single setting, the software would also have to retrieve, store, and apply two alternating speed settings.

Adding the speed setting stuff is easy.  Give me a few minutes.

I do realize that this would increase the scope of the software, so I choose to be happy with what I have right now, especially since I'm in a little financial difficulty at the moment and don't have a roll of quarters to drop in some kind programmer's bucket.  :-[

Please don't ever worry about stuff like this.  I'm happy to help.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on September 27, 2009, 06:14 PM
v1.0.1 - 2009-09-27
    + Added ability to set mouse speed.
    * Changed up the parameter syntax.  Please adjust any of your scripts accordingly.

Website (http://skwire.dcmembers.com/wb/pages/software/mat.php) | Download (http://skwire.dcmembers.com/apps/mouse_accel_toggler/MouseAccelToggler.zip)

Run MouseAccelToggler.exe with one or both of the following parameters:

    accel=[on|off|toggle]  This will turn mouse acceleration on, off, or toggle its state.
    speed=[1-20]             This will set the mouse speed.
   
    Example:  c:\path\to\MouseAccelToggler.exe accel=on speed=8

Also...if you run the exe without any parameters, it will pop up a box showing your current speed setting.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: Kamel on September 27, 2009, 09:28 PM
Thanks, works just fine :D

The popup box is a nice touch as well.

For clarity, you might want to do accel=[on|off|toggle] instead of mode, but not picking, it's perfectly fine as-is
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on September 27, 2009, 09:40 PM
v1.0.2 - 2009-09-27
    * Changed "mode" to "accel" for more consistency.  (Thanks, Kamel)

Website (http://skwire.dcmembers.com/wb/pages/software/mat.php) | Download (http://skwire.dcmembers.com/apps/mouse_accel_toggler/MouseAccelToggler.zip)

[ You are not allowed to view attachments ]
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: doctorfrog on September 28, 2009, 02:30 AM
Now this was exactly what I needed. Thank you, Skwire!

For what it's worth, I blogged about it here: http://drfrog.wordpress.com/2009/09/28/mat/
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on September 28, 2009, 06:36 AM
Thanks for the wonderful writeup and kind words about DC.  Much appreciated.  =]
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on September 28, 2009, 06:43 AM
BTW, I'm a blackbox user myself and downloaded plenty of your styles over the years.  =]
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: doctorfrog on October 01, 2009, 01:18 AM
Cool, I'm actually just now updating to the latest 1.17 of bblean and creating a new suite of styles. I thought I had the latest 1.17, but I guess I've been using an RC of 1.17 for more than six months. Oh, the bugs that I've endured...

I've foregone the Windows shortcuts by now and now call Mat directly from Blackbox hotkeys. Ah, but it's a good time to be alive, and also a nerd.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on April 30, 2010, 06:30 AM
fantastic util - does more than i could have hoped for.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on April 30, 2010, 06:52 AM
i've been playing about with the toggle function - works fine.

i'm just wondering (hoping) that maybe the app could be modified a little to provide a visual cue as to what mode the mouse speed/acceleration is in.

something blindly obvious like the cursor changing colour or shape depending on the mode.

e.g.
the mouse is acceleration ON = cursor is set to a blue cursor or a large cursor (or whatever).

the mouse is acceleration OFF = cursor is set to a white cursor or a standard/small cursor (or whatever).

maybe other cursors could be used for different speeds - maybe just a cursor with a tiny number next to it.

i'd be very happy to edit/design some cursors to include - if this is possible.

i'm just thinking that this visual cue would be extremely helpful (especially for me as i'll be swapping around the different modes and i'll forget what mode i'm in). having the cursor change appearance means it would also be instantly obvious what mode you are in, i.e. no need to look in the system tray for a mode change icon.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on April 30, 2010, 07:48 AM
i'd be very happy to edit/design some cursors to include - if this is possible.

Yes, this can be done so feel free to send me any test .ANI/.CUR files you want to use.  I like the idea of a standard cursor with small numbers the best.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on April 30, 2010, 08:00 AM
okay, i'll email something in a few minutes - just basic to see how things work.

would it be asking too much if the user could pick their own cursors to use. like yourself, some people will prefer a number to indicate speed - but i'd prefer a colour difference myself as it will be more immediate in recognising the difference - for acceleration on, at least (even if it's just a tiny red dot in the middle of the cursor). other people will have their own opinion of what is a good visual cue - giant cursor, coloured cursor, flashing (animated) cursor.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on April 30, 2010, 09:07 AM
would it be asking too much if the user could pick their own cursors to use.

I actually don't use this app myself but, yes, I plan to have this configurable on MAT's command-line since there is no real GUI to speak of. 
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on April 30, 2010, 09:10 AM
excellent. I've emailed you a few cursors to try.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on April 30, 2010, 02:33 PM
not sure what's wrong but all Mouse Acceleration Toggler functions have stopped working here. i've not rebooted yet so will have to see what happens after that.

only thing i can see that is different with my system is that i've disabled all secondary monitors - everything seemed fine whilst i was using them earlier.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on May 01, 2010, 08:13 AM
Here's a test version with your custom cursor request: http://skwire.dcmembers.com/apps/mouse_accel_toggler/MouseAccelToggler_.zip

Simply pass cursor="c:\path\to\some\cursor.cur"

You can also pass cursor="Default" to restore the normal cursor.  One caveat that I haven't been able to figure out yet is that, when using a custom cursor, it is used for all cursor functions i.e. no resizing cursors, no I-beam, etc.   :huh:  At any rate, let me know if it works for you.  I've tested it under Win2k and WinXP.  I don't have Vista or Win7.

not sure what's wrong but all Mouse Acceleration Toggler functions have stopped working here. i've not rebooted yet so will have to see what happens after that.

I haven't a clue.   :-[
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on May 01, 2010, 02:22 PM
very good. i'll not be able to test it out until monday so i'll let you know then. that's unfortunate about the cursor dominating all other cursors. wish i could suggest something that you won't have already thought about.

i'm stil not sure why MAT seems to stop working sometimes. i think it has something to do with the logitech setpoint controls getting confused - not sure if that could really stop the exe with switches from working too when run on its own. there is definitely something strange with this setpoint stuff though - deleted settings keep coming back (so i need to figure out what's going on there).
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: mouser on May 01, 2010, 02:27 PM
One caveat that I haven't been able to figure out yet is that, when using a custom cursor, it is used for all cursor functions i.e. no resizing cursors, no I-beam, etc.

i was afraid of that. i think that makes this cursor changing feature not so useful.
it *might* still be a good idea if one instead could trigger a windows-cursor-theme change, to change entire sets of cursors.

otherwise i suggest that it would be more useful to use a different mechanism besides cursor change to indicate the change in acceleration, like background desktop color.

in fact, given that the goal is to toggle back and forth acceleration for high precision uses (like in a graphics program), it would seem to me highly likely that the graphics program is going to have its own custom cursors in use (like paintbrush cursor, etc.) so the whole cursor changing idea is not going to cut it.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on May 01, 2010, 02:35 PM
in fact, given that the goal is to toggle back and forth acceleration for high precision uses (like in a graphics program), it would seem to me highly likely that the graphics program is going to have its own custom cursors in use (like paintbrush cursor, etc.) so the whole cursor changing idea is not going to cut it.

oh dear. i completely forgot about that. maybe a tray icon is the way to go - and desktop colour change (though that will be hidden a lot of the time).

at this rate it looks like i'll be sticking with my original (very basic) cursor slide method.

are there any other visual cues that would help?
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: mouser on May 01, 2010, 02:53 PM
i think the idea of toggling mouse acceleration is a great one.. i'm not really sure you NEED a visual indicator about it.. it's going to be pretty obvious.  though i can imagine a separate idea for a docked bar on the screen showing various cursor related info (like acceleration, etc), color under cursor, etc. might be useful to some.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on May 01, 2010, 03:05 PM
if the toggle could be made so that it only accelerated when a hotkey was held down then i wouldn't need a visual cue as to what mode the speed is in. i didn't ask if this could be included with MAT as i thought the visual cue would be simpler/easier to do. but, if i'm honest, the accelerate only when hotkey/button is down is the method i need. this is also how i'd expect a built in mouse acceleration to work - is this how a gaming mouse works?

as MAT works through switches that are either set or not - would it be possible to adapt it do the acceleration only when a hotkey is held down?
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on May 01, 2010, 07:23 PM
You can't do it directly with MAT, but you can easily with a couple of AHK hotkeys set up like this:

Code: AutoIt [Select]
  1. ~^!+LButton:: Run, C:\path\to\MouseAccelToggler.exe accel=on speed=20 cursor="C:\path\to\cursor.cur"
  2. ~^!+LButton Up:: Run, C:\path\to\MouseAccelToggler.exe accel=off speed=10 cursor="Default"

This will let you use ctrl-alt-shift-left mouse button down to do one thing and another when releasing it.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on May 01, 2010, 08:36 PM
amazing. autohotkey to the rescue (and skwire) again.

i'll give this a try as soon as i'm back on the main pc.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on May 01, 2010, 09:26 PM
Yeah...but I don't see how this will help you since you can't do much with the LMB held down, right?  In other words, you may want to change the LMB to a key or something.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on May 02, 2010, 06:27 AM
good point. i changed it to the middle mouse button, MButton, and this appears to works brilliantly.

(my middle mouse button is actually next to my thumb so i can still easily press the left/right buttons at the same time. meaning, i can drag windows about and other functions whilst in the temporary "fast" mouse mode.)

i do like the visual cue on the cursor too.

i think this "accelerate only when button held down" method works really, really, well. i know exactly how fast my mouse is going to travel - and i like how the cursor changes (to a red dot) only when in fast mode. it doesn't get in the way of any other cursors that the system (or design) programs use.

i just need to make my logitech mouse behave now. i think it makes the alt key lock down sometimes - which was probably what was causing MAT to stop working. maybe.

anyway, great job, skwire.

Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on May 02, 2010, 09:06 AM
Great to hear.  I'll promote that test build to a full release.  Thanks for the feedback.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on May 02, 2010, 09:13 AM
Website (http://skwire.dcmembers.com/wb/pages/software/mat.php) | Download (http://skwire.dcmembers.com/apps/mouse_accel_toggler/MouseAccelToggler.zip)
v1.0.3 - 2010-05-02
   + Added ability to specify a custom cursor.  (Thanks, nudone)
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: nudone on May 02, 2010, 09:53 AM
i've realised that using the middle mouse button to control acceleration isn't that clever - there are other programs that can use the middle mouse button; silly of me to forget that.

so, if anyone is interested i've changed things to middle + right buttons (together) to accelerate.

keeping the return to default speed set at middle button release only (instead of middle + right button release), appears to have the extra benefit of acting like a toggle - so you can keep locked into acceleration mode until you just hit the middle mouse button again (the middle release obviously triggered the MButton Up action).

If you want to keep things so that only acceleration works when middle and right buttons are held down then change the 2nd line from "MButton Up" to "MButton & RButton Up"

Code: AutoIt [Select]
  1. MButton & RButton:: Run, "C:\Program Files\MouseAccelToggler\MouseAccelToggler.exe" accel=on speed=20 cursor="C:\Program Files\MouseAccelToggler\cursor large red.cur"
  2. MButton Up:: Run, "C:\Program Files\MouseAccelToggler\MouseAccelToggler.exe" accel=off speed=10 cursor="Default"
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: doctorfrog on November 03, 2010, 01:29 PM
Just saw this on gHacks: http://www.ghacks.net/2010/11/03/mouse-speed-switcher-configure-speed-settings-per-mouse/

It promises to be exactly what I need, a program that's smart enough to differentiate between multiple pointing devices and apply separate sensitivity settings for each.

Why Windows can't do this on its own is still a mystery, my work laptop has up to three devices on it: a touchpad, a joystick nub, and a wireless mouse, all with their own little sensitivity quirks. There are literally millions of laptops like this out there.

Down side: It's nagware, which costs 7.50 in european moon money to register.

edit: http://sourceforge.net/projects/automousesw/ appears to be an open source solution.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: tomos on November 03, 2010, 02:01 PM
7.50 in european moon money

moon calling earth lol
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: Shades on November 03, 2010, 05:00 PM
Hey, if they can go go from the moon called Europa to this planet for 7.5o euro, then why is the Europe Space Agency not the reeking in the profits from inter-planetary trade and/or resources?

 :P
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: hyz on September 16, 2011, 05:46 AM
I got this app and it seemed simple and great, but while the toggling works fine between the states, the acceleration-enabled state handles waay differently from what it was before using this app. I don't like it and am looking for ways to return it to the Windows (7) defaults, but it seems to have messed up some internal acceleration related values that Windows doesn't even let you access from the control panel.

I know I'm a bit late to the party here, but since there seem to be some actual value-based settings that need to be set instead of "just" toggling it, it could be nice to expose them with command line options, like the base speed.
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on September 16, 2011, 08:06 AM
I've never used any sort of mouse acceleration but the settings you're looking for might be found here:

Go to the Control Panel.
Click Ease of Access.
Click Change how your mouse works.
Click Set up Mouse Keys.

There's an acceleration slider in there.  On my Windows 7 VM, it's set directly in the middle.  If that doesn't work, I Googled for "windows 7 mouse acceleration fix" and it came back with a ton of hits so it appears you're not the only person to experience mouse acceleration issues in Windows 7.

Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: sediavindivoh on July 24, 2013, 02:50 PM
Hi guys! I'm sorry for the noob question but I am really frustrated. I downloaded MouseAccelToggler.exe, extracted it, and ran it and got the popup. That's all good... But I can't get it to actually do anything. I realize it needs "- parameters" but I CANNOT get my windows to give it -params.

I have tried renaming MouseAccelToggler.exe to MouseAccelToggler.exe -speed=18 but that doesn't work because it changes from an exe file to one that windows doesn't recognize so it will not launch.

I have tried creating a shortcut and changing the target to "C:\Users\Alan\Desktop\MouseAccelToggler\-speed=18 MouseAccelToggler.exe" -speed=18

Then it says the following variable name contains an illegal character ARG_-speed the current thread will exit.

I've tried changing Start In to including a -speed=18 on the end, and that didn't work either.

Please tell me how, specifically, to just make this change thing work, as its the only program I've been able to find that will fix my problem. Thankyou :)
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on July 24, 2013, 03:17 PM
Hi, sediavindivoh, and welcome to the DonationCoder site.

I have tried creating a shortcut and changing the target to "C:\Users\Alan\Desktop\MouseAccelToggler\-speed=18 MouseAccelToggler.exe" -speed=18
-sediavindivoh (July 24, 2013, 02:50 PM)

There are no dashes in MAT's parameters so, based on your current path, change the target to:

"C:\Users\Alan\Desktop\MouseAccelToggler\MouseAccelToggler.exe" speed=18

Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: sediavindivoh on July 24, 2013, 04:42 PM
That did the trick. Thanks very much :D
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: skwire on July 24, 2013, 04:45 PM
That did the trick. Thanks very much :D
-sediavindivoh (July 24, 2013, 04:42 PM)

You're welcome.  Good to know you got it working.   :Thmbsup:
Title: Re: DONE: Toggle mouse acceleration with a simple program
Post by: doctorfrog on February 11, 2020, 03:53 PM
Bump to Skwire: I recently installed Windows 10, and this program works fine on it. I use it to flip between a mouse and a wireless touchpad regularly. Works as well as ever.

What's interesting about MAT (don't know if I mentioned this earlier in the thread) is that it--and thus the Windows registry as well--offers a slightly finer-grained control over mouse speed than the control panel applet. The sweet spot for my mouse is actually between two of the ticks in the applet! So I can ditch the heavy Logitech application that I'd otherwise need to install and have continually running in the background.

So yeah, I've been using the two projects you've made for me: this, and Anuran, for going on a decade now. Thanks!