You have a script that requests numeric input from a user. Now you can check if the user has NumLock on and if not, turn it on for him.
#!/usr/bin/perl use strict; use warnings; use Win32::GuiTest qw(SendKeys); use Win32::KeyState qw(GetNumLock); # $self->toot('horn'); GetNumLock() or SendKeys("{NUMLOCK}"); my $number; GET_NUM: { print "Please enter a number between 0 and 9 and press <Enter>.\n"; $number = <STDIN>; chomp $number; redo if ($number !~ /^\d$/); } print "You entered $number.\n";
You are not able to set the status of NumLock on Win9x. This is documented behaviour. (reference)
|
|---|