Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Remapping Keyboard on Win32

by gryphon (Abbot)
on Mar 23, 2006 at 03:15 UTC ( #538644=perlquestion: print w/replies, xml ) Need Help??
gryphon has asked for the wisdom of the Perl Monks concerning the following question:

Greetings all,

I recently had wrist surgery on my right wrist to remove a gamglion cyst and other problems with the joint. The surgery was a success, and things are healing well, but I'm stuck in a cast-like thing for at least another two weeks, likely longer. This makes typing with both hands all but impossible. (Yes, I'm typing this message with one hand.) I started Googling and found out about one-handed keyboards like this and this, and that got me thinking: couldn't I just do the same thing with Perl?

I use both Windows and Linux at work and at home, but most of the typing I need to do over the next couple weeks is in Word on Windows, so while I'd love a solution that works on both platforms, I'm biased toward a Win32 solution. I started looking into Win32::API a bit, and then I wandered down the rabbit hole of C# by reading this keyboard hook example. I also searched around on PerlMonks and found code to activate and deactivate the keyboard.

Has anyone else tied this? Am I wandering in the right direction? Is there an easier solution? Thanks very much.

gryphon Development Manager (WDDC)
code('Perl') || die;

Replies are listed 'Best First'.
Re: Remapping Keyboard on Win32
by zentara (Archbishop) on Mar 23, 2006 at 12:33 UTC
Re: Remapping Keyboard on Win32
by gryphon (Abbot) on Mar 24, 2006 at 17:22 UTC

    Greetings all,

    The bad news is that I haven't been able to solve this problem yet. The good news is that my wrist is healing much faster than expected, and I'm now in a smaller splint that frees up my right hand for typing. So I'm abandoning this effort; however, just in case someone else wants to work on this in the future, here's the code I ended up with:

    I primarily used this example along with Win32::API. Although I'm not seeing any errors, I don't think I'm getting the keyboard hook set correctly because $n never increments no matter how many keys I hit while the script runs. The $get_key_state call works just fine, but I can't seem get $callback to get called on keypress. Oh well.

    gryphon Development Manager (WDDC)
    code('Perl') || die;

      Again, in case someone else ends up here, you might want to check out the Scan Code Mapper for Windows. Basically, you add a registry key saying what keys you want to remap. Its simpler than writing anything if your requirements are straightforward. Night

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://538644]
Approved by jfroebe
[choroba]: That was at least why my cb talker wasn't working.
[Tanktalus]: curious, then, why the reader works :)
[Tanktalus]: or posting the last hour of cb... well, maybe I should double check that first :)
[Tanktalus]: yup, it's working. :)
[choroba]: https://github. com/choroba/pm-cb/ commit/7b57f513596 7bf8a29d74f1c307de 9a76894cdcf
[choroba]: Also, a thread here on PM mentioned that one of or should now work
[choroba]: Tidings
[Tanktalus]: So, I can log in, I can update last hour of cb, I can read the cb, I just can't post a message to it :(

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2018-07-15 21:30 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (326 votes). Check out past polls.