At a certain point in one of my scripts, I need to determine the state of the CapsLock key, and proceed accordingly.
I grabbed the following VB script from the Microsoft website. However, it wil not compile. I'm really not much of a VB scripter yet though.
Can someone advise me on how I might be able to determine the state of the CapsLock key while running a Macro Scheduler script?
Thanks,
Tim
------------------------------------------------------
VBSTART
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
As Integer
Const VK_NUMLOCK = &H90
Const VK_SCROLL = &H91
Const VK_CAPITAL = &H14
Key = GetKeyState(VK_CAPITAL)
If Key And 1 Then
Text3.Text = "Caps Lock is On"
Else
Text3.Text = "Caps Lock is Off"
End If
VBEND
Testing CapsLock Status?
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
That was also my first reaction lumumba. But then I read his question more carefully.Why won't this work for you ?
CapsOff
CapsOn
I thought that tmallardi wanted to know what the current status was:
Since that status could be set by any other program, commands, user intervention, etc. it sounded like an IF command would be coming based on status of CAPS On/Off.I need to determine the state of the CapsLock key, and proceed accordingly
That's not the same as wanting to to set it to a value. Using CapsOff/On may or may not toggle the status, but if used, then the original status will be lost.
But I guess that I misunderstood the question.

Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!