keypad woes

Posted by Cron0 on Thu 09 Oct 2003 11:49 PM — 5 posts, 25,265 views.

United Kingdom #0
I have a system of aliases which use letters and numbers in different combinations, eg. 1, 2, 3, 23, 22, n2, g1, k1, x4, etc. I would like to use the numeric keypad to input the numbers part of these aliases, but would still like to retain the ctrl-keypad macros for movement. I can't think of any way to do this, is it possible at all?

It would work with keypad keys enabled, and set to the actual numbers, if there was an 'insert' option like macros have, so I could use the keypad to add the correct number to the letter in the command window.

If I disable keypad keys, I can use the numbers in my aliases ok, but I lose the ctrl macros. I had thought of world.DoCommand to toggle the keypad on or off, but there doesn't seem to be an option to 'enable keypad keys'. I know you can bring up the keypad dialogue, but thats not really good enough for what I want.

Anyone have any thoughts on this please?
USA #1
world.setoption "keypad_enable", 1
and
world.setoption "keypad_enable", 0

To Enable/disable keypad things.
You could even couple this with getoption to toggle it...
But, a toggle might not be a good idea, since if you toggle it one too many times, youll be using numbers when you really want Ctrl-Keys, etc.
Greece #2
You can have an alias like "set_number_in_command *" or whatever, and write in the keypad numbers:
set_number_in_command 1
set_number_in_command 2
set_number_in_command 3
etc.
And the alias would be a small script that would append the number to the command box... but if you had the text caret positioned between 2 letters, it would still append it instead of positioning it in the right place... Well, that's good enough, i assume...
United Kingdom #3
Thanks guys, I have the keypad keys set to 'keypad 1' 'keypad 2' etc., with an alias 'keypad *' calling this small script:


sub number (thename, theoutput, thewildcards)
	world.execute world.GetCommand() & thewildcards(1)
end sub


This works just great, but i would also like to clear the command window, so i don't have to delete the letter i have just entered. I have tried setcommand "" and deletecommandhistory, but neither seems to work.

For example, I type the letter 'a' in the command window, then press 1 on the keypad and 'a1' is sent to the scripting engine. Now I have to delete 'a' from the command window manually, but is there a way to accomplish this in the script?
Canada #4
PushCommand
http://www.gammon.com.au/scripts/function.php?name=PushCommand

This actually pushes the command into the history stack, and then clears the command box. You can recall the text you had on the command line by standard means (Eg: Pressing up arrow).