Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 02, 2015, 07:54:27 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Request: Force NUMLOCK always on  (Read 12045 times)

Ralf Maximus

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 927
    • View Profile
    • Donate to Member
Request: Force NUMLOCK always on
« on: June 28, 2007, 12:36:23 PM »
Howdy,

I've searched for a utility (or HotKeys script) that automatically forces NUMLOCK to remain on at all times.  I have some ill-behaved apps that turn it off, and when I go to use the keypad...

So, anything?

Thanks,
Ralf

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #1 on: June 28, 2007, 01:27:20 PM »
In autohotkey, the following code was supposed to do what you're asking for:

Code: [Select]
;
;By jgpaiva
;date: June 2007
;Function:

#installkeybdhook
SetNumLockState,On
SetNumLockState,AlwaysOn
return
It isn't working here, maybe because i own a laptop, so.. Just give it a go ;)

Ralf Maximus

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 927
    • View Profile
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #2 on: June 28, 2007, 02:13:08 PM »
Thanks for the reply!

Alas, I tried it here and no workee.  I've got a Dell Optiplex with a standard 101 keyboard (USB).  All the other AutoHotKey stuff I have works fine, and the code above compiles without complaint.  But the numlock refuses to stay locked on.

Bah...


app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,560
    • View Profile
    • App's Apps
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #3 on: June 28, 2007, 02:33:02 PM »
I found this:

http://www.petri.co....ck_default_state.htm

Quote
To control the state of the NumLock key follow these steps:

1. Open Registry Editor.

2. In Registry Editor, navigate to the following registry key:

Code: [Select]
HKEY_USERS\.DEFAULT\Control Panel\Keyboard
3. Create the following value (DWORD):

Code: [Select]
InitialKeyboardIndicators
and give it a value of 0 (zero) or 2 (two)

  • 0 = NumLock is turned off after logon
  • 2 = NumLock is turned on after logon

Note: As always, before making changes to your registry you should always make sure you have a valid backup. In cases where you're supposed to delete or modify keys or values from the registry it is possible to first export that key or value(s) to a .REG file before performing the changes.

4. Close Registry Editor and reboot the computer.

Have you tried something like this yet?

Also check here to see if the setting is 0 or 2:
Code: [Select]
HKEY_CURRENT_USER\Control Panel\Keyboard\ [InitialKeyboardIndicators]
If you have a 2 in the first key but a 0 in the 2nd one that could be the problem.

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #4 on: June 28, 2007, 02:35:46 PM »
Interesting... Apparently, the command does have an effect on my computer: the led signaling numlock's state doesn't change anymore. Too bad that numlock's state does :(

Ralf Maximus

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 927
    • View Profile
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #5 on: June 28, 2007, 03:02:47 PM »
Hacking the registry only sets the default state upon Windows login.  Alas, it does not prevent the numlock state from toggling.

Too bad...

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #6 on: June 28, 2007, 11:22:42 PM »
try this then: KLOCKS - Commandline Lock Keys Controller. :)

Klocks is a Win32 commandline utility for NT4/W2K/XP/2003 that allows the Num, Caps and Scroll lock keys to be turned on, off or toggled. Just put create a shortcut in the startup folder with the appropriate parameter.

http://www.commandli...uk/klocks/index.html


app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,560
    • View Profile
    • App's Apps
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #7 on: June 29, 2007, 02:44:21 AM »
I was just taking a look at that Klocks thing (didn't try it though).

Is that just some sort of switch that turns it on & off that needs to be run each time you want it done?

He said that some application keeps switching it off and he doesn't know which one it could be. If he were to run that Klocks thing to turn it back on, exactly how could he do it and it be in any way effective and automated? On a timer, as a scheduled task? If so, how often?

I have been thinking about this little problem and how to solve it. I think what needs to be done is some sort of application that can run in the background that has a global keyboard hook that on every keypress will check to see if the numlock is on, and if not then turn it on. Then if some application turns it off, the next key that is pressed would turn it back on automatically. It would be turning every key on the keyboard into a 'numlock on' key, in addition to the normal key functionality.

Then at the very worst it would just be one keypress that would be affected if he were to use the numpad without it being on. (which is a bit unlikely to happen if he is a keyboard freak that switches windows with alt+tab or uses something like FARR to run applications)

Ralf Maximus

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 927
    • View Profile
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #8 on: June 29, 2007, 08:33:54 AM »
App103:  Bingo, that's it.

I have something called CAPShift that does that for the Caps Lock; the minute you turn on Caps Lock, CAPShift toggles it off again.  CAPShift gets loaded at the start of my Windows session and runs silently in the background.  It stays in memory until the machine reboots.

I need something that does that same trick for Num Lock, but in this case keep the bugger turned on forever.

Thanks!     

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #9 on: June 30, 2007, 03:31:14 AM »
ah, i misread the earlier posts but still a script written in AHK could monitor the situation and toggle the numlock status. i'll post one in a day or two if no one beats me to it.. ;) btw, Ralf what's the model of your Optiflex?

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #10 on: June 30, 2007, 05:10:12 AM »
ah, i misread the earlier posts but still a script written in AHK could monitor the situation and toggle the numlock status. i'll post one in a day or two if no one beats me to it.. ;) btw, Ralf what's the model of your Optiflex?
I also thought so,but apparently an ahk script that toggles the state of numlock has no effect on my computer, other than toggling the led that reports numlock's state...
Possibly it's because a laptop, but that means i can't test any script i make :(

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #11 on: June 30, 2007, 05:21:59 AM »
i suspect that it's a laptop too, that's why i asked for the model because sometimes laptop manufacturers put in their own combinations with the Fn keys..

Ralf Maximus

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 927
    • View Profile
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #12 on: June 30, 2007, 11:39:04 AM »
I've got an Optiplex GX620.  Love it, love it, love it.  Bought it for cheap at the Dell outlet store online.

USB keyboard, if that matters.  The only software I've discovered that it doesn't like is anything that tries to toggle the keyboard LED's in real-time according to disk activity.  No big loss. :-)

To summarize the thread so far:

0. Need a utility to monitor the state of NUMLOCK and switch it back on if it gets turned off, either by keyboard action (butterfingers) or via a rude application.

1. The "standard" AHK script to toggle NUMLOCK doesn't work here, but according to others it doesn't seem to work anywhere.

2. I have other AHK scripts purring along in the background that work fine.  I keep everything in autohotkey.ini, but a standalone .exe would be fine.

3. Hacking the registry only sets the state of NUMLOCK at startup.  Not my problem, since the Dell BIOS has a nice feature to configure that.

Thanks!

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #13 on: July 01, 2007, 01:59:15 AM »
thanks Ralf, can you try this script and let me know if it works? since you already have AHK, i haven't compiled the script into an EXE. :)

NumLock Enforcer
• monitors and keeps your NumLock key on.
• needs Autohotkey.

the source
; NumLock Enforcer
; To monitor and switch on the NumLock key
; Date: 01/07/2007  ;Last Updated: 01/07/2007
; Refer: hxxp://www.donationcoder.com/forum/index.php?topic=9018
; Changes since:
; *****
;
#SingleInstance force
;#NoTrayIcon  ;if you don't need a tray icon
#InstallKeybdHook
#Persistent

;Menu, tray, Icon, %A_WinDir%\System32\shell32.dll, 105
appname=NumLock Enforcer
SetTimer, EnforceNumLock, 500
Return

EnforceNumLock:
   NumLockStatus := GetKeyState("Numlock", "T")
    IfEqual, NumLockStatus, 0
      {
      SetNumLockState, On
      ;Uncomment the below line if you want some kind of feedback.
      ;TrayTip,%appname%,NumLock Status = On,,1
      }
Return

;Win+p pauses the script,just in case you need the NumLock.
#p::Pause

;Win+q exits...
#q::ExitApp


* NumLock Enforcer.ahk (0.79 kB - downloaded 786 times.)

Ralf Maximus

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 927
    • View Profile
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #14 on: July 01, 2007, 12:48:56 PM »
Yayy!  That works!  Exactly what I need.

Thank you.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: Request: Force NUMLOCK always on
« Reply #15 on: July 01, 2007, 09:16:38 PM »
you're welcome! glad to be of help.. 8)