Num Lock state? 
Author Message
 Num Lock state?

Hello,

Is there a way to check the state of the Num Lock key?

I know how to toggle the key on and off but want to turn off the num lock
when I login on a laptop using the laptop keyboard.

set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{NUMLOCK}"

Thanks,
Bill



Thu, 16 Sep 2004 01:32:57 GMT  
 Num Lock state?
There are 2-3 cumbersome tricks - no native function, but you can, for example, Word (!!) to check this -

x = IsNumlocked
wscript.echo x

Function IsNumLocked()
 Dim oWrd
 Set oWrd = CreateObject("Word.Application")
 IsNumLocked = oWrd.Numlock
 oWrd.Application.Quit True
End Function

This raises another question, though: How are you going to tell that you don't have the external keyboard on?

Quote:

> Hello,

> Is there a way to check the state of the Num Lock key?

> I know how to toggle the key on and off but want to turn off the num lock
> when I login on a laptop using the laptop keyboard.

> set WshShell = CreateObject("WScript.Shell")
> WshShell.SendKeys "{NUMLOCK}"

> Thanks,
> Bill



Thu, 16 Sep 2004 01:57:58 GMT  
 Num Lock state?
Thanks Alex. That works great. What I want is to always turn off the num
lock when I login. When I login with the laptop at home I use an external
keyboard with a ten key pad. I enable the number pad to login to VPN. When I
use the laptop at work without the keyboad the num lock turns on after I
login to Windows 2000. Since the laptop keyboard does not have a separate
ten-keypad, regular keys become number keys.

Here is what I put in the user startup directory.

option explicit

Dim x, oWshShell

x = IsNumlocked
'wscript.echo x
If x = -1 Then
  set oWshShell = CreateObject("WScript.Shell")
  oWshShell.SendKeys "{NUMLOCK}"
End If

Function IsNumLocked()
 Dim oWrd
 Set oWrd = CreateObject("Word.Application")
 IsNumLocked = oWrd.Numlock
 oWrd.Application.Quit True
End Function

"Alex K. Angelopoulos" <alex_angelopoulos_at_hotmail_dot_com_remove__> wrote

There are 2-3 cumbersome tricks - no native function, but you can, for
example, Word (!!) to check this -

x = IsNumlocked
wscript.echo x

Function IsNumLocked()
 Dim oWrd
 Set oWrd = CreateObject("Word.Application")
 IsNumLocked = oWrd.Numlock
 oWrd.Application.Quit True
End Function

This raises another question, though: How are you going to tell that you
don't have the external keyboard on?


Quote:
> Hello,

> Is there a way to check the state of the Num Lock key?

> I know how to toggle the key on and off but want to turn off the num lock
> when I login on a laptop using the laptop keyboard.

> set WshShell = CreateObject("WScript.Shell")
> WshShell.SendKeys "{NUMLOCK}"

> Thanks,
> Bill



Thu, 16 Sep 2004 02:57:30 GMT  
 Num Lock state?
So you're just always undoing what appears to be set in your profile?

If it works, it works.  The nice thing would be if it were possible to determine your hardware profile easily, then take measures accordingly. (it would also be nice to not have to launch Word to check numlock.)

Quote:

> Thanks Alex. That works great. What I want is to always turn off the num
> lock when I login. When I login with the laptop at home I use an external
> keyboard with a ten key pad. I enable the number pad to login to VPN. When I
> use the laptop at work without the keyboad the num lock turns on after I
> login to Windows 2000. Since the laptop keyboard does not have a separate
> ten-keypad, regular keys become number keys.

> Here is what I put in the user startup directory.

> option explicit

> Dim x, oWshShell

> x = IsNumlocked
> 'wscript.echo x
> If x = -1 Then
>   set oWshShell = CreateObject("WScript.Shell")
>   oWshShell.SendKeys "{NUMLOCK}"
> End If

> Function IsNumLocked()
>  Dim oWrd
>  Set oWrd = CreateObject("Word.Application")
>  IsNumLocked = oWrd.Numlock
>  oWrd.Application.Quit True
> End Function

> "Alex K. Angelopoulos" <alex_angelopoulos_at_hotmail_dot_com_remove__> wrote

> There are 2-3 cumbersome tricks - no native function, but you can, for
> example, Word (!!) to check this -

> x = IsNumlocked
> wscript.echo x

> Function IsNumLocked()
>  Dim oWrd
>  Set oWrd = CreateObject("Word.Application")
>  IsNumLocked = oWrd.Numlock
>  oWrd.Application.Quit True
> End Function

> This raises another question, though: How are you going to tell that you
> don't have the external keyboard on?



> > Hello,

> > Is there a way to check the state of the Num Lock key?

> > I know how to toggle the key on and off but want to turn off the num lock
> > when I login on a laptop using the laptop keyboard.

> > set WshShell = CreateObject("WScript.Shell")
> > WshShell.SendKeys "{NUMLOCK}"

> > Thanks,
> > Bill



Thu, 16 Sep 2004 04:52:03 GMT  
 Num Lock state?
I agree. I set HKCU\Control Panel\Keyboard\InitialKeyboardindicators to 0
then when I login again it has reset to 2. If the num lock is off the key
will reset to 0. So it would be better to read this key then run the sendkey
is needed.

Bill

"Alex K. Angelopoulos" <alex_angelopoulos_at_hotmail_dot_com_remove__> wrote

So you're just always undoing what appears to be set in your profile?

If it works, it works.  The nice thing would be if it were possible to
determine your hardware profile easily, then take measures accordingly. (it
would also be nice to not have to launch Word to check numlock.)


Quote:
> Thanks Alex. That works great. What I want is to always turn off the num
> lock when I login. When I login with the laptop at home I use an external
> keyboard with a ten key pad. I enable the number pad to login to VPN. When
I
> use the laptop at work without the keyboad the num lock turns on after I
> login to Windows 2000. Since the laptop keyboard does not have a separate
> ten-keypad, regular keys become number keys.

> Here is what I put in the user startup directory.

> option explicit

> Dim x, oWshShell

> x = IsNumlocked
> 'wscript.echo x
> If x = -1 Then
>   set oWshShell = CreateObject("WScript.Shell")
>   oWshShell.SendKeys "{NUMLOCK}"
> End If

> Function IsNumLocked()
>  Dim oWrd
>  Set oWrd = CreateObject("Word.Application")
>  IsNumLocked = oWrd.Numlock
>  oWrd.Application.Quit True
> End Function

> "Alex K. Angelopoulos" <alex_angelopoulos_at_hotmail_dot_com_remove__>
wrote

> There are 2-3 cumbersome tricks - no native function, but you can, for
> example, Word (!!) to check this -

> x = IsNumlocked
> wscript.echo x

> Function IsNumLocked()
>  Dim oWrd
>  Set oWrd = CreateObject("Word.Application")
>  IsNumLocked = oWrd.Numlock
>  oWrd.Application.Quit True
> End Function

> This raises another question, though: How are you going to tell that you
> don't have the external keyboard on?



> > Hello,

> > Is there a way to check the state of the Num Lock key?

> > I know how to toggle the key on and off but want to turn off the num
lock
> > when I login on a laptop using the laptop keyboard.

> > set WshShell = CreateObject("WScript.Shell")
> > WshShell.SendKeys "{NUMLOCK}"

> > Thanks,
> > Bill



Thu, 16 Sep 2004 11:58:22 GMT  
 Num Lock state?
Check the MSKB article Q170903. The title is :  NUMLOCK Causes Logon
Problems with Portable Computers.  It tells you how control the numlock key
with couple of registry keys.

Quote:
> Hello,

> Is there a way to check the state of the Num Lock key?

> I know how to toggle the key on and off but want to turn off the num lock
> when I login on a laptop using the laptop keyboard.

> set WshShell = CreateObject("WScript.Shell")
> WshShell.SendKeys "{NUMLOCK}"

> Thanks,
> Bill

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.333 / Virus Database: 187 - Release Date: 3/8/2002


Fri, 17 Sep 2004 02:52:12 GMT  
 Num Lock state?
Worth trying to see if it works.

It might not; he indicated it was resetting to "On", which might be a part of domain policies at his office.

Quote:

> Check the MSKB article Q170903. The title is :  NUMLOCK Causes Logon
> Problems with Portable Computers.  It tells you how control the numlock key
> with couple of registry keys.


> > Hello,

> > Is there a way to check the state of the Num Lock key?

> > I know how to toggle the key on and off but want to turn off the num lock
> > when I login on a laptop using the laptop keyboard.

> > set WshShell = CreateObject("WScript.Shell")
> > WshShell.SendKeys "{NUMLOCK}"

> > Thanks,
> > Bill

> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.333 / Virus Database: 187 - Release Date: 3/8/2002



Fri, 17 Sep 2004 03:20:47 GMT  
 Num Lock state?
The registry value is set during logoff to preserve the numlock state.
According to Q170903 this is intended functionality. The simplest resolution
seems to be to check the registry and if the numlock state is on to then
turn it off using SendKeys.

option explicit

Dim x, oWshShell

set oWshShell = CreateObject("WScript.Shell")

x = oWshShell.RegRead("HKCU\Control
Panel\Keyboard\InitialKeyboardIndicators")

If x = 2 Then
  oWshShell.SendKeys "{NUMLOCK}"
End If

"Alex K. Angelopoulos" <alex_angelopoulos_at_hotmail_dot_com_remove__> wrote

Worth trying to see if it works.

It might not; he indicated it was resetting to "On", which might be a part
of domain policies at his office.

Quote:
> Check the MSKB article Q170903. The title is :  NUMLOCK Causes Logon
> Problems with Portable Computers.  It tells you how control the numlock
key
> with couple of registry keys.


> > Hello,

> > Is there a way to check the state of the Num Lock key?

> > I know how to toggle the key on and off but want to turn off the num
lock
> > when I login on a laptop using the laptop keyboard.

> > set WshShell = CreateObject("WScript.Shell")
> > WshShell.SendKeys "{NUMLOCK}"

> > Thanks,
> > Bill

> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.333 / Virus Database: 187 - Release Date: 3/8/2002



Sat, 18 Sep 2004 15:25:05 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Checking And Changing Num Lock State

2. Setting Num Lock and Caps Lock key states

3. Key State Control (Num Lock Status)

4. HELP: Lock on Num Lock?

5. Shift Lock/Num Lock

6. GetKeyState for Caps Lock or Num Lock...

7. CAPS and NUM, et al on status bar do not change state when the keyboard changes

8. Requery caused Num Lock OFF....Bug?

9. Num Lock off

10. NUM LOCK

11. Excel VBA - Num Lock

12. Setting Caps, Insert and Num Lock programmatically

 

 
Powered by phpBB® Forum Software