How to turn off "Caps Lock" from Perl script.

S

Sisyphus

katera said:
How to turn off "Caps Lock" from Perl script.

This is a problem close to my heart. (I only ever hit the "Caps Lock" by
mistake ... well ... to be honest, I have occasionally intentionally turned
"Caps Lock" on when typing in product keys - which always seem to use upper
case alpha chars).

A quick question to the perlmonks CB ascertained that (as far as was known)
there's no perl solution to the problem.

There are, however, bound to be software solutions (depending upon your OS).
On Win32, PowerToy is apparently one such solution.

However, acting on the judicious advice handed out on the perlmonks CB, I've
just taken the hardware solution of prizing off the "Caps Lock" key and
covering the hole with cellotape (to prevent foreign objects such as
dandruff and breadcrumbs from getting into the guts of the keyboard).

It's working really well, so far, and looks like being the permanent
solution to *my* woes wrt "Caps Lock".

Hth.

Cheers,
Rob
 
J

Jürgen Exner

Sisyphus said:
This is a problem close to my heart. (I only ever hit the "Caps Lock"
by mistake ... well ... to be honest, I have occasionally
intentionally turned "Caps Lock" on when typing in product keys -
which always seem to use upper case alpha chars).

A quick question to the perlmonks CB ascertained that (as far as was
known) there's no perl solution to the problem.

There are, however, bound to be software solutions (depending upon
your OS). On Win32, PowerToy is apparently one such solution.

If you are running Windows:
- Control Panel
- open Keyboard
- open tab Key Settings
- select "Caps Lock" and click "Edit"
- check "Disable the CAPS LOCK key

Works for me on a MS wireless keyboard. Other keyboards that come with other
drivers maybe don't have this option.

Of course this has nothing to do with the original question or Perl any
longer.

jue
 
D

Dan Mercer

: Sisyphus wrote:
: > : >> How to turn off "Caps Lock" from Perl script.
: >
: > This is a problem close to my heart. (I only ever hit the "Caps Lock"
: > by mistake ... well ... to be honest, I have occasionally
: > intentionally turned "Caps Lock" on when typing in product keys -
: > which always seem to use upper case alpha chars).
: >
: > A quick question to the perlmonks CB ascertained that (as far as was
: > known) there's no perl solution to the problem.
: >
: > There are, however, bound to be software solutions (depending upon
: > your OS). On Win32, PowerToy is apparently one such solution.
:
: If you are running Windows:
: - Control Panel
: - open Keyboard
: - open tab Key Settings
: - select "Caps Lock" and click "Edit"
: - check "Disable the CAPS LOCK key
:

On Windows ME you can reassign the CAPS LOCK key - I reassign to the
control key. On X11 you can use xmodmap and XKeyCaps is a nifty
GUI front end to xmodmap.

Dan Mercer

: Works for me on a MS wireless keyboard. Other keyboards that come with other
: drivers maybe don't have this option.
:
: Of course this has nothing to do with the original question or Perl any
: longer.
:
: jue
:
:
 
U

Uri Guttman

MD> On Wed, 4 Apr 2007 21:11:05 +1000, "Sisyphus"

MD> Actually, judging from similar such discussions, I'm appearently the
MD> only one to use it on purpose, although on a sparse basis. Oh, and
MD> when I do, I *do* happen to forget it on, too, which is the problem
MD> many people see in it. Whatever, I'm not removing it. No way!!

anyone ever heard of xmodmap? easy way to redfine keys so capslock
becomes control like it was before ibm ruined the keyboard. know why
they did that? capslock was a useful key on manual typewriters since you
had to really push hard on shift to lift up the key carriage. when
electric typewriters came out they kept that evn though it wasn't hard
to push shift anymore (especially with the selectric golf ball where
keys were all electronic). so when ibm created the pc they wanted to
keep it just like the office typewriter to ease conversions. well, they
kept capslock but needed a control key so they put that in a lousy
place. now no one in their right mind needs capslock on a computer
(other than spammers or aolers). but it has remained there wasting space
which should rightfully be control. i swap capslock and control when i
can with xmodmap. and i use sun keyboards when i can which are much
better than any pc/mac keyboard and has control and escape where they
belong.

uri
 
U

Uri Guttman

MD> No, no one *needs* it. And I understand your, and all those other
MD> people's concerns. But I find it convenient whenever I have to type
MD> more than say three consecutive uppercase letters. For example it
MD> certainly *faster* for me to press caps lock, write "BEGIN" and press
MD> caps lock again than keeping shift pressed and also press the
MD> individual keys corresponding to the letters of "BEGIN". To each
MD> his/her own...

holding shift down for 5 letters is easy enough. also in emacs it is
trivial to change casing of a word or paragraph.

MD> I know I am annoying and you won't answer anyway, but... by any chance
MD> did you remap the shift keys as well?

no. i do use shift for symbols and when writing documentation and code
and other writings. i just don't use it as much when doing email and
usenet. just an old habit.

uri
 
L

Lambik

katera said:
How to turn off "Caps Lock" from Perl script.

No idea how to do it in perl but given your newsreader here is some windows
code (98 and above) to toggle the caps lock key.

#include <stdio.h>
#include <windows.h>

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
INT nCmdShow)
{
INPUT input[2];
ZeroMemory(input, sizeof(input));
input[0].type = input[1].type = INPUT_KEYBOARD;
input[0].ki.wVk = input[1].ki.wVk = VK_CAPITAL;
input[1].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(2, input, sizeof(INPUT));

return 0;
}
 
P

Peter J. Holzer

easy way to redfine keys so capslock becomes control like it was
before ibm ruined the keyboard. know why they did that? capslock was a
useful key on manual typewriters since you had to really push hard on
shift to lift up the key carriage. when electric typewriters came out
they kept that evn though it wasn't hard to push shift anymore
(especially with the selectric golf ball where keys were all
electronic). so when ibm created the pc they wanted to keep it just
like the office typewriter to ease conversions. well, they kept
capslock but needed a control key so they put that in a lousy place.

Historically that can't be right. The first IBM keyboards did have the
control key where caps lock is now and caps lock in the lower right
corner[1][2]. The caps-lock key only moved to its current position in
1986. IBM may have considered catering to former typewriter users more
important than catering to existing computer users, but they had to make
a conscious decision to *change* the layout - they didn't just keep
the typewriter layout.

(BTW, the story I heard at that time was that IBM had to change it to
conform to existing standards: The layout for typewriters was
standardized and the keyboards of "text processing systems" had to be
the same as for typewriters, so if they wanted to sell their computers
for that purpose they had to supply conforming keyboards).

hp

[1] http://www.pcguide.com/ref/kb/layout/stdXT83-c.html
[2] http://www.pcguide.com/ref/kb/layout/stdAT84-c.html
 
U

Uri Guttman

PJH> Historically that can't be right. The first IBM keyboards did have the
PJH> control key where caps lock is now and caps lock in the lower right
PJH> corner[1][2]. The caps-lock key only moved to its current position in
PJH> 1986. IBM may have considered catering to former typewriter users more
PJH> important than catering to existing computer users, but they had to make
PJH> a conscious decision to *change* the layout - they didn't just keep
PJH> the typewriter layout.

PJH> (BTW, the story I heard at that time was that IBM had to change it to
PJH> conform to existing standards: The layout for typewriters was
PJH> standardized and the keyboards of "text processing systems" had to be
PJH> the same as for typewriters, so if they wanted to sell their computers
PJH> for that purpose they had to supply conforming keyboards).

that may be the correct story but it isn't far from what i tell. the
typewriter market did decide to put the almost never needed anymore
capslock in control's spot. as if anyone would care if it really was put
in the lower right corner. you press it once and later again. it doesn't
need to be an easy spot. control is used so much more in computers but
they kowtowed to the marketers who always know best. :(

uri
 
J

John W. Kennedy

Peter said:
easy way to redfine keys so capslock becomes control like it was
before ibm ruined the keyboard. know why they did that? capslock was a
useful key on manual typewriters since you had to really push hard on
shift to lift up the key carriage. when electric typewriters came out
they kept that evn though it wasn't hard to push shift anymore
(especially with the selectric golf ball where keys were all
electronic). so when ibm created the pc they wanted to keep it just
like the office typewriter to ease conversions. well, they kept
capslock but needed a control key so they put that in a lousy place.

Historically that can't be right. The first IBM keyboards did have the
control key where caps lock is now and caps lock in the lower right
corner[1][2]. The caps-lock key only moved to its current position in
1986. IBM may have considered catering to former typewriter users more
important than catering to existing computer users, but they had to make
a conscious decision to *change* the layout - they didn't just keep
the typewriter layout.

(BTW, the story I heard at that time was that IBM had to change it to
conform to existing standards: The layout for typewriters was
standardized and the keyboards of "text processing systems" had to be
the same as for typewriters, so if they wanted to sell their computers
for that purpose they had to supply conforming keyboards).

The 3270 series of dumb terminals for mainframes and the 5250 series of
dumb terminals for mid-size systems also had to be considered. (And they
had multiple keyboards, too. The 3270 series had general-purpose,
data-entry, mainframe-operator-console, APL, and text keyboards, not
counting the special 3270-emulation PCs, which had keyboards of their
very own.) IBM was making something like twenty basically different
keyboard layouts for the US alone, and something had to be done.

--
John W. Kennedy
"...if you had to fall in love with someone who was evil, I can see why
it was her."
-- "Alias"
* TagZilla 0.066 * http://tagzilla.mozdev.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top