robj Posted July 27, 2005 Share Posted July 27, 2005 I may be being stupid (in fact I'm almost certainly being stupid - such is usually the case...) but I can't change the state of the NumLock key with my script. From the help file I assumed that if I added the line: Send("{NumLock on}") it should turn NumLock on if it wasn't already. However it doesn't seem to work. Is there anything I'm missing (like a SendCapslockMode for the NumLock key or something?) Thanks Link to comment Share on other sites More sharing options...
GaryFrost Posted July 27, 2005 Share Posted July 27, 2005 Send("{NUMLOCK on}") works on mine SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
robj Posted July 27, 2005 Author Share Posted July 27, 2005 Send("{NUMLOCK on}")works on mine<{POST_SNAPBACK}>HmmmmCan't seem to get it to work on my system though.If I use the following:Opt("SendCapslockMode", 0) Send("{CAPSLOCK on}")Then I can toggle the capslock key ok. It just doesn't do anything when I try to do the same for numlock.Very puzzled... Link to comment Share on other sites More sharing options...
GaryFrost Posted July 27, 2005 Share Posted July 27, 2005 Send("{NUMLOCK toggle}") SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
robj Posted July 27, 2005 Author Share Posted July 27, 2005 Again I can toggle the status of the capslock key, but numlock remains unchanged. Are there any other options etc that need to be changed for this to work? I am using a separate keyboard and keypad if this makes any difference, and so actually have 2 numlock buttons (one on the main keyboard and one on the keypad). Could this be the problem? The Send command is somehow sending both buttons at once and cancelling itself out? If this is the case I can see how this would do nothing for the toggle command but not the set on or off option. I thought this would be simple but my brain is starting to hurt... Thanks for the help so far though. Link to comment Share on other sites More sharing options...
GaryFrost Posted July 27, 2005 Share Posted July 27, 2005 Again I can toggle the status of the capslock key, but numlock remains unchanged.Are there any other options etc that need to be changed for this to work?I am using a separate keyboard and keypad if this makes any difference, and so actually have 2 numlock buttons (one on the main keyboard and one on the keypad).Could this be the problem? The Send command is somehow sending both buttons at once and cancelling itself out? If this is the case I can see how this would do nothing for the toggle command but not the set on or off option.I thought this would be simple but my brain is starting to hurt...Thanks for the help so far though.<{POST_SNAPBACK}>No special options, just had the one line of code in the script nothing else,don't have the 2 numlocks so can't help you there. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
robj Posted July 27, 2005 Author Share Posted July 27, 2005 I'm also using Win98SE on the computer I'm trying to get it to work on if that makes a difference, although I can switch it easily to WinXP if it'll help. Link to comment Share on other sites More sharing options...
seandisanti Posted July 27, 2005 Share Posted July 27, 2005 I'm also using Win98SE on the computer I'm trying to get it to work on if that makes a difference, although I can switch it easily to WinXP if it'll help.<{POST_SNAPBACK}> you're using 2 keyboards on one computer on 98? neat. have to say i haven't seen that before... but question, is the numlock state being affected on either keyboard? Link to comment Share on other sites More sharing options...
JSThePatriot Posted July 27, 2005 Share Posted July 27, 2005 One thing I would like to ask is when you press the numlock on one keyboard does it affect both? If both lights are on does it work? Just a couple of questions that popped into my head as I was reading this, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
robj Posted July 28, 2005 Author Share Posted July 28, 2005 (edited) I'm not using 2 keyboards as such - I have a a ps2 mini 'laptop style' keyboard with the silly keypad in the middle of all the other letters which is only active when NumLock is on, and also a separate usb numeric keypad. When NumLock is off, I can type fine on the mini keyboard but the numeric keypad operates in curser mode, when NumLock is on the keypad operates like a numeric keypad but half of the keyboard buttons give me letters not numbers when I type. What I want my script to do is automatically switch NumLock on or off when I'm using different programs so I don't have to remember to press the key myself. Pressing the NumLock key on either keyboard toggles the NumLock state on both, but nothing I do with AutoIt seems to have any affect whatsoever. Any more help? Edited July 28, 2005 by robj Link to comment Share on other sites More sharing options...
Laine Posted January 13, 2006 Share Posted January 13, 2006 I sought this forum to see if this was a reported problem. I hate having the keyboard power up with numlock enabled. I don't know if it came sooner but was pleased to find WinXP had solved the problem for me. I tried NUMLOCK on the XP machine and it works as advertised on/off/toggle. I have another machine running 98se but the BIOS allows me to power up numlock OFF. A third 98se machine powers up with numlock on so I decided to write a script to shut it off on boot but was dismayed when it wouldn't work. I can report on both 98se machines: Send("{NUMLOCK on}") Send("{NUMLOCK off}") Send("{NUMLOCK toggle}") have no effect whatsoever in version 3.1.1.0 when executed under Win98se. Link to comment Share on other sites More sharing options...
CyberSlug Posted January 13, 2006 Share Posted January 13, 2006 Hmm, maybe http://www.rjlsoftware.com/software/utility/numlock/ ]this website has the answer: Windows 95/98/ME systems are not supported by this program. The API interface does not work for the NUM lock key. It only works on Windows NT/2K Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
CyberSlug Posted January 13, 2006 Share Posted January 13, 2006 Possible alternatives if anyone has a Delphi or Visual Basic compiler handy:http://members.chello.be/ws36637/keys.htmlhttp://www.blindprogramming.com/ftp/basic/statkeys.txt Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Laine Posted January 15, 2006 Share Posted January 15, 2006 While this isn't perfect it works for me. Although it worked first time every time in the debugger in practice I had to place 2 short cuts in the startup folder, running the program twice, to get the light to go out. Additionally you have to smack the Num Lock key several after running to get it in sync again with the light. I rarely use num lock so I can live with that. At least that damn light is extinguished. #include <windows.h> #include <stdio.h> #define VK_NUMLOCK 0x90 #define KEYEVENTF_KEYUP 0x02 int main (void) { BYTE key[256]; BOOL bResult=0; OSVERSIONINFO osVer; osVer.dwOSVersionInfoSize = sizeof(osVer); bResult = GetVersionEx(&osVer); bResult= GetKeyboardState( (LPBYTE)&key[0]); if(osVer.dwMajorVersion <5) { key[VK_NUMLOCK] &= 254; //11111110 bResult= SetKeyboardState( (LPBYTE)&key[0]); } else if(key[VK_NUMLOCK] & 1 == 1) { keybd_event( VK_NUMLOCK, 0, 0, 0); keybd_event( VK_NUMLOCK, 0, KEYEVENTF_KEYUP, 0); } return 0; } /* Remarks Because the SetKeyboardState function alters the input state of the calling thread and not the global input state of the system, an application cannot use SetKeyboardState to set the NUM LOCK, CAPS LOCK, or SCROLL LOCK indicator lights on the keyboard. */ Link to comment Share on other sites More sharing options...
Kulanb Posted March 9, 2006 Share Posted March 9, 2006 I may be being stupid (in fact I'm almost certainly being stupid - such is usually the case...) but I can't change the state of the NumLock key with my script. From the help file I assumed that if I added the line: Send("{NumLock on}") it should turn NumLock on if it wasn't already. However it doesn't seem to work. Is there anything I'm missing (like a SendCapslockMode for the NumLock key or something?) Thanks I know this is almost a year late but.... When you press the numlock on the USB keypad, does it also control the one on the keyboard or do the two numlocks seem to work independant? If they are independant try manually setting them both on, then press and hold the one on the USB keypad for about 1-2 seconds, then release it. Now try toggling the USB one and note if it now controls the keyboard as well. I can't remember if, once sync'd, the opposite is true and the main keyboard will also control the keypad. Basically, most USB keypads work on their own with their own circuitry to control the numlock. Some have an option, though, to toggle whether the USB keypad will control the keyboard as well simply by holding down the numlock for a moment. Also note, if you start with the two numlock lights opposite (one active, the other not) then once you "sync" them they will continue to be opposite all the time. Hope this helps someone out there. Link to comment Share on other sites More sharing options...
Tony4219 Posted October 25 Share Posted October 25 (edited) I'm still using Win10. For me, it only needs this one line, compiled from AU3 to EXE to toggle Numlock when run: Send("{NUMLOCK}") Edited October 25 by Jos Remove compiled script as that clearly doesn't serve any purpose. Link to comment Share on other sites More sharing options...
jchd Posted October 25 Share Posted October 25 After 18 years, all of them are dead or alike. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Developers Jos Posted October 25 Developers Share Posted October 25 (edited) @Tony4219, Could you PLEASE stop resurrecting old threads? Looking at your posting history it seems to be happening constandly! In this case that answer was already given so was totally unnecessary! Edited October 25 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts