Showkey

Wednesday, September 24, 2008

I've used one version or another of the following macro, Showkey, in the macro languages of most of the different editors I've used over the years. Prior to Slickedit my editor was Kedit for a long time. My love of Kedit stemmed from my enjoyment of using Xedit on the IBM mainframe VM/CMS system.

If you asked me now, "What's the usefulness of this Showkey macro?" I don't know that I could remember. I remember that it came in very handy at times. Execute showkey and it will report the exact key or key combination you press. To stop showing your keypresses, press the ESC key.

One example of a use that I had for the showkey macro was to test keystrokes and key combos to make sure the computer understood the keyboard input the same way I thought I was issuing it. For instance, I've had several keyboards that, for some reason, didn't "get" the Ctrl keypress from the Ctrl key on the right side of my keyboard when used in certain key combinations. The Ctrl key on the left side of the keyboard worked fine.

By trying key combinations with the right Ctrl key while showkey was active, I could see that the computer didn't register the right Ctrl key when pressed in conjunction with certain other keys.

Showkey doesn't work on the Print Screen, Pause/Break, or modifier keys (Shift, Ctrl, Alt, or Windows keys) when they are pressed alone. I hope you find a good way to use this macro one day.

// show which key was pressed
_command showkey()
{
message('Reading keystrokes to message line; press ESC to stop');
for (;;) {
binary_key=get_event();
key_name=event2name(binary_key);
if (key_name == 'ESC') {
message('Keypress ' key_name'; reading keystrokes ended');
break;
} else {
message('Keypress: 'key_name);
//return(key_name);
}
}
}
}

0 comments:

Post a Comment

GlossyBlue Blogger by Black Quanta. Theme & Icons by N.Design Studio
Entries RSS Comments RSS