From: tereza on
How to control if CAPS LOCK key ON or OFF form Perl program?



Thanks



From: E.D.G. on
"tereza" <tereza(a)majka.trw> wrote in message
news:i1eqhn$jde$1(a)localhost.localdomain...
> How to control if CAPS LOCK key ON or OFF form Perl program?

This has to be a first. I am actually able to answer a Perl question.

Perl experts should probably make sure that some unexpected problem does not
arise from this.

Regarding the CAPSLOCK key and some of the other keys:

If you are using ActiveState Perl with Windows XP or Vista on a PC type
computer this should work. I don't know about other operating systems etc.

Also, you need to be careful when you use these keyboard control commands.
The experience that I myself have had is that they can at times cause the
Windows operating system to become temporarily unstable. Then you need to
log off the active account and then back on. Or just restart the computer.

First you need to get the Win32::GuiTest related module linked with
Perl. Then the following commands will toggle the CAPSLOCK key on or off.
And that type of command can also be used to toggle other keys like NUMLOCK
on and off. Again, I recommend some caution with these commands.

Win32::GuiTest::SendKeys("{CAPSLOCK}");

From: Ben Morrow on

Quoth "tereza" <tereza(a)majka.trw>:
> How to control if CAPS LOCK key ON or OFF form Perl program?

How would you do it from a C program, or a Python program?

You need to find out what (if any) facilities your OS provides for
controlling caps lock. Once you know that, it may be possible to work
out how to invoke those facilities from Perl.

Ben

From: E.D.G. on
"E.D.G." <edgrsprj(a)ix.netcom.com> wrote in message
news:VZidnarHRrLmMqbRnZ2dnUVZ_rWdnZ2d(a)earthlink.com...
> "tereza" <tereza(a)majka.trw> wrote in message
> news:i1eqhn$jde$1(a)localhost.localdomain...
>> How to control if CAPS LOCK key ON or OFF form Perl program?

There is a an additional startup command that has to be added. And there
are also probably more efficient formats to use with these commands.

use Win32::GuiTest;# This command is probably normally stored near the start
of the program

Win32::GuiTest::SendKeys("{CAPSLOCK}");

From: Peter J. Holzer on
On 2010-07-12 10:24, tereza <tereza(a)majka.trw> wrote:
> How to control if CAPS LOCK key ON or OFF form Perl program?

Do you actually mean "control" or do you mean "check"?

hp