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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAPS Status

Status
Not open for further replies.

pickletech

IS-IT--Management
Dec 20, 2004
88
0
0
US
Does anyone know how to get the status of capslock and/or numlock?
 
just for a laugh i would say have 2 scripts

Script1.

WshShell.Run script2.vbs
strReturned = InputBox("hmm", ,"specialwindow")
If strReturned = "INPUT" Then
''''
End If

Script2
Do
If WshShell.AppActivate("specialwindow") Then
WshShell.Sendkeys "input"
Exit Do
End If

Loop

'prob wont work but who knows ;-)

i am sure there will be a WMI class knocking around that will hold the info??
 
Oops. Forgot about this. Anyways, I was looking for something a little different, because I plan on making it work remotely once I figure out how to do it. Anyone else have any ideas?
 
WshShell.SendKeys {CAPSLOCK}

what scripting tasks avenues have you tried? what stuff have you found on the web? can you shed any light on this yourself to limit 'anyone' elses search? you posted the orginial thread about 9 days ago

cheers
 
when you say making it work remotely what do you mean?
i agree my suggestion is pretty flakey but i am not sure i see a reason why it wont work...other than it requres a explorer session to be active
 
mrmovie-that was fast! I think it took you about 30 seconds to respond. :)
Anyhow, about all I have found on the web is what you suggested, which would not really work for the part of my script I am having problems with. I want to write a script that will check the status of the Caps Lock and Num Lock keys on a remote computer, and then ask if you want to toggle them.
This script would be useful when remote controlling a computer (so you don't mess up your caps lock, numlock status in the process) or helping a user who keeps typing in the wrong password and can't figure out why. I have honestly answered calls from people who had no idea what I was talking about when I asked them if they had Caps Lock on.
 
Oh, the reason this sat idle for so long is I got busy with other stuff at work, and I didn't have time to play around with it.
 
if you can get the 2 scripts i suggested on the each machine then you could use WMI to start the script1, combine this with the LCase/UCase logic {CAPSLOCK} sendkeys and you will have something... :)

you would think there would be a Win32_Keyboard class..

perhaps a post to the 'proper' languages where one can use API calls... or try apinet.net or something like that
 
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As _
Long

' Get the current state of the CapsLock key

Function GetCapsLockKey() As Boolean
GetCapsLockKey = GetKeyState(vbKeyCapital)
End Function
 
Thank you for the help but, no luck. Couldn't get either script to work. When I tried your first idea it would always put it in as 'input' regardless of Caps status. I couldn't figure out how to get the second one to work at all. :-/ Is it for full VB?
 
It is VB and hence will not work as a VBScript I believe.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top