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