Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I intercept and correct keypresses at a low level?

I keep typing "t eh" instead of " the" which is, of course, annoying in the amount of time it takes me to correct myself.

The obvious answer is "Learn to type, noob!" or at least to type more slowly and/or more correctly. This error is frighteningly consistent so it appears I've trained my muscle memory for that pattern already.

But I'm wondering if it's possible to write a small, windows portable script or application that, when it detects the incorrect sequence, backspaces and corrects it automatically at a layer where it would apply to any keyboard input.

  • Does C# have access to that layer of the OS that intercepts keypresses systemwide?
  • Will I run into UAC issues with Vista?
  • Am I re-inventing the wheel (ie, are there open source tools I can modify or use out of the box)?

In DOS this sort of thing was quite easy and one could make TSRs (Terminate and Stay Resident) programs that would, for instance, give you a calculator onscreen with a special keypress. Not to mention the many, many practical joke programs based on this concept (dial "M" for monster!)...

I would, of course, never suggest such a utility could be used that way for co-workers...

-Adam

like image 605
Adam Davis Avatar asked Dec 05 '25 06:12

Adam Davis


1 Answers

On windows you could use AutoHotKey. That allows you to create little scripts or macros to automate and correct things like mistypes.

One use was posted on lifehacker which took the common mistyped words and corrected them. It is at http://lifehacker.com/192506/download-of-the-day-universal-autocorrect


UPDATE Per Comment: This is Free software and windows only as far as I know.

The above script is just an example of what it can do. There are a slew of scripts available at AutoHotkeys Site

like image 188
Rob Haupt Avatar answered Dec 08 '25 00:12

Rob Haupt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!