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

(Win32) Turn on NumLock if needed

by Mr. Muskrat (Canon)
on Jul 10, 2003 at 21:58 UTC ( [id://273158]=CUFP: print w/replies, xml ) Need Help??

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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://273158]
Approved by The Mad Hatter
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-24 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found