Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

ronnetp (Programmer)
2 Aug 03 16:30
I have the following code to enable the Num-lock Key,
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{NUMLOCK}"

but I need it to be able to verify the state before,

if Num-lock key is active
   dont change state
is Num-lock key is inactive
   Activate Numlock key.
Any advice is well appreciated.

Thanks,
tsuji (TechnicalUser)
5 Aug 03 9:49
Hello ronnetp,

This is an utterly unrewarding little task to do with vbs. It is so unreliable. Not to mention a routine to check it first, even the sendkey by itself seems very unreliable to toggle the light on the keyboard. Do your experience convince you that the result being consistent?

To check the numlock state, one of the trick is to use the winword as a vehicle to do it for you.

Set objWord=CreateObject("Word.Application")
boolStat=objWord.NumLock
objWord.Quit
Set objWord=Nothing

Remember to quit the word by .Quit otherwise the silent process would build up in number and bloat your box by repetitive testing.

Warning: This is very unreliable. If you go to test it, you know what I mean. It is as unreliable as the SendKeys, no more no less.

So, both little tasks, I am not enthusiastic about.

regards - tsuji
ronnetp (Programmer)
5 Aug 03 18:23
Thanks, tsuji

For sharing, another problem besides not been reliable
is that I have workstations that dont have Word Installed.

I have not found a way of doing this!!!
strongm (MIS)
5 Aug 03 18:48
Sadly, the most reliable way of doing this is with the SetKeyState API call. Unfortunately you cannot make direct API calls with VBScript
ronnetp (Programmer)
5 Aug 03 18:53
I can use other way, for me it does not have to be
vbscript, I just wanted to make something without
needing to compile.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close