Page 1 of 1 1
Topic Options
#121249 - 2004-06-15 12:07 PM What is NumLock key status?
Pierre FREMION Offline
Getting the hang of it

Registered: 2000-01-11
Posts: 66
Loc: Paris, France, Europe, Sun3
Is there any way to get the status of the NumLock key?

When I want to use the sendkeys command with an ip address for example, it reacts exactly like if the keys are hits from the keyboard (depending of the NumLock status)

example :
with numlock off - the screen result of SENDKEYS ('\\123.456.789.012') is \\123.456.789.012
with numlock on - the screen result of SENDKEYS ('\\123.456.789.012') is \\&é".'(-.è_ç.à&é (using a french keyboard)

To avoid this kind of trouble I need to known the ACTUAL status of numlock before using SENDKEYS('{NUMLOCK}') if needed.

How can I check this ?
_________________________
Comments always welcome. French native so I apologize for my (mis)use of English!

Top
#121250 - 2004-06-15 11:08 PM Re: What is NumLock key status?
jpeachman Offline
Fresh Scripter

Registered: 2002-11-18
Posts: 39
Not a real elegant solution, but could you use SendKeys() to echo a number to a temp file, then read that file? With suitable error checking to be sure the file was created properly, if you then read the file's contents and it is the number you sent, your NumLock state is OK; otherwise SendKeys("{NUMLOCK}"). You could even restore the NumLock state after your commands if you had to change it and you want to be nice

Joe

Top
#121251 - 2004-06-16 09:18 AM Re: What is NumLock key status?
Pierre FREMION Offline
Getting the hang of it

Registered: 2000-01-11
Posts: 66
Loc: Paris, France, Europe, Sun3
Thanks Joe

it's the way I do. I wonder if exist a more elegant solution, perhaps using COM, but my knowledge in this matter is so poor.

Does anybody want to help me this way?

The challenge is open.

Thanks anyway for your reply

Have a good kix !!!
_________________________
Comments always welcome. French native so I apologize for my (mis)use of English!

Top
#121252 - 2004-06-16 11:44 AM Re: What is NumLock key status?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Not sure if this will work for you or not on a French system, but you could try it and let us know.

http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB4&Number=120207

Top
#121253 - 2004-06-16 01:54 PM Re: What is NumLock key status?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

I wonder if exist a more elegant solution, perhaps using COM



AutoIT
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#121254 - 2004-06-16 07:08 PM Re: What is NumLock key status?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
AutoIt Home Page
http://www.autoitscript.com/autoit3/


Quote:

Introduction
AutoIt v3 is an opensource BASIC-like scripting language designed for automating the Windows GUI. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys).

AutoIt was initially designed for PC "roll out" situations to configure thousands of PCs, but with the arrival of v3 it is also well suited to performing home automation and the scripting of repetitive tasks.

AutoIt can:

Provide a general-purpose scripting language
Execute Windows and DOS executables
Simulate key-strokes (supports most keyboard layouts)
Simulate mouse movements and clicks
Move, resize and manipulate windows
Interact directly with "controls" on a window (set/get text from edit controls, check boxes and radio buttons, select items in drop-down lists, etc.)
Work with the clipboard to cut/paste text items
Work with the registry




Top
#121255 - 2004-06-17 10:50 AM Re: What is NumLock key status?
Pierre FREMION Offline
Getting the hang of it

Registered: 2000-01-11
Posts: 66
Loc: Paris, France, Europe, Sun3
Thanks to you all

I've tried the numon/numoff given in the first NTDOC's answer, and it fits perfectly.
I've just shell numoff before sendkeys and it works great.
This gives an instant answer to the problem.

I'll check AutoIt but this stuff would be more time consumer.

Thanks to all of you one more time.
_________________________
Comments always welcome. French native so I apologize for my (mis)use of English!

Top
#121256 - 2004-06-17 12:56 PM Re: What is NumLock key status?
Pierre FREMION Offline
Getting the hang of it

Registered: 2000-01-11
Posts: 66
Loc: Paris, France, Europe, Sun3
In the same way is there a capson/capsoff.exe
_________________________
Comments always welcome. French native so I apologize for my (mis)use of English!

Top
#121257 - 2004-06-17 07:29 PM Re: What is NumLock key status?
jpeachman Offline
Fresh Scripter

Registered: 2002-11-18
Posts: 39
OK...except it doesn't answer your original question about getting the NumLock status! The only reason for wanting to know that I can think of would be to return it to how it was before the script ran, to avoid annoying/confusing your users (which I tried to allude to in my response above). If you don't care about that, then you probably don't need to know the original status, and this solution is fine!

Joe

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1045 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.061 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org