Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display of CAPS LOCK key status in title bar? 2

Status
Not open for further replies.

grofaty

IS-IT--Management
Jan 16, 2003
370
SI
Hi,
I really like the CAPS LOCK key to have an upper keys typed in. But I forget what is the current status of caps lock, so I need to check to look at the keyboard light to see if caps lock is turned on or off.

Is there a way to display some caps lock notification in titlebar of all of the applications that I am using (or at least on active window)?
Thanks
 
@strongm, I know this is not supported natively in Windows. I am just looking for a program to display status of caps lock in TITLE BAR or in the location top center of scren!
 
@strongm, PalmTest, both suggested the same application, but like I have written. I would like to have caps lock indicator in TITLE BAR (on in a location top center). Application suggested it displays caps lock status in "system tray", I don't want this.s
 
By the way I have tested:
and both do not work properly on my system. They have a few seconds delay (not always) or just don't react on capslock press action. I have figure it out that when capslock indicator is wrongly displayed if I press NumLock then status of CapsLock gets immediately displayed correctly. Strange... So there are bugs in this applications or I have some system specifics (like keyboard driver).
 
Alternatively you could just roll your own using something like AutoHotkey or AutoIt.

For example, here's a screenshot of the results of an AutoHotkey script I adapted from this post in an Autohotkey forum:
caps_control.jpg

It shows a CapsLock status control centred at the top of the screen.

Here's an AutoHotkey script that does what you want, i.e. display the CapsLock status at the top centre of the screen. The script toggles the background colour of the control depending on whether CapsLock is on or off. The control doesn't display until the first time you use the CapsLock key then stays on top of other windows (i.e. topmost Z-order). You can, if you want, click on the CapsLock status control to toggle CapsLock. If you want the control to be even more unobtrusive it's really easy to change the control text from "CAPS" to just "C".

Here's the code:
Code:
#noenv
#singleinstance, ignore
setbatchlines, -1
setworkingdir, %a_scriptdir%

gosub, osd_create
return

osd_create:
 {
   gui, -caption +toolwindow +alwaysontop +lastfound
   gui, color, 8b0fc6
   gui, font, s10 w600, Arial Bold
   gui, margin, 0, 0
   winset, transcolor, 8b0fc6

   gui, add, listview, x63 y0 w40 h16 -hdr -e0x200 -multi background5481E6 v_capslock glv altsubmit
   gui, add, text, x63 y0 w40 h16 0x201 cwhite backgroundtrans vtxt_capslock, CAPS ; overlay the word CAPS on top of the ListView control

 }
return

capslock::
 {
   sleep, 10
   if (!locked_%a_thishotkey%)
    {
      _toggle_key(a_thishotkey)
      soundplay, beep.wav
      color := getkeystate(a_thishotkey, "t") ? "00FF00" : "FF0000"
      guicontrol, +background%color%, _%a_thishotkey%
      guicontrol, hide, txt_%a_thishotkey%
      guicontrol, show, txt_%a_thishotkey%
    }
   sysget, var_, monitorworkarea
   gui, show, xCenter y0 NA, OSD
   ; xCenter centres the control horizontally, y0 sets the control at the top of the screen using normal x/y co-ordinates,
   ; NA displays the control without activating it (although you can click on the control to toggle CapsLock status.
   
   ;settimer, cancel, -3000 ; Control in milliseconds how long the control remains on screen
 }
return

lv:
{
   if (a_guievent = "normal") or (a_guievent = "doubleclick")
    {
      control := ltrim(a_guicontrol, "_")
      if (!locked_%control%)
       {
         _toggle_key(control)
         soundplay, beep.wav
         color := getkeystate(control, "t") ? "00FF00" : "FF0000"
         guicontrol, +background%color%, %a_guicontrol%
         guicontrol, hide, txt%a_guicontrol%
         guicontrol, show, txt%a_guicontrol%
       }
      ;settimer, cancel, -3000 ; Control in milliseconds how long the control remains on screen
    }
 }
return

_toggle_key(key)
 {
   if (key = "capslock")
    {
      setcapslockstate, % getkeystate(key, "t") ? "off" : "on"
    }
   else if (key = "scrolllock")
    {
      setscrolllockstate, % getkeystate(key, "t") ? "off" : "on"
    }
   else if (key = "numlock")
    {
      setnumlockstate, % getkeystate(key, "t") ? "off" : "on"
    }
   return
 }


cancel:
 {
   gui, cancel
 }
return

Download AutoHotkey from here and SciTE4AutoHotkey (an IDE editor for AutoHotkey) from here.

Hope this helps...
 
@Rick998, I have installed AutoHotKey and this is working excellent. I have one more little wish. I have a dual monitor and this script display icon only on first monitor. Is there a way that I can have this icon on both monitors?
 
Hmmm... you've posed an interesting question.

How should I respond?

How about... I thought I could help and spent a considerable amount of my own time to find, amend and test a solution for you.

You, in turn, waited three weeks to reply, not with thanks but - instead - with an additional request.

I suggest you ask for additional help in the AutoHotkey forums.
 
@Rick998, I was on vacation (that was why my late response) and coming back I got millions of things to do with high priority, so CAPS lock 'problem' is one of least important to me - actually it is very important to me, but not to my boss. I thought there is solution to just install, spend like 5 minutes and problem is solved. But Rick998 solution is working excellent on one monitor, so thank you very much for this solution I really appreciate the effort. But you also need to know that I just don't have time to learn some programming language like script etc because of my other high priority tasks I have. It was my mistake that I have forgotten to mention the two monitors, I am deeply sorry for that. I have just assumed that someone will provide the name of the program that has this kind of dual monitor support, I have seen such a programs, but where hopelessly broken, not working at all. So thank you very much for your effort.

@all, is there any other solution/program that is capable of displaying CAPS lock state on the top of my both monitors? I tested several, but none of them are really working like I would like: display at the top of screen in title bar.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top