supraspecies Posted January 29, 2018 Share Posted January 29, 2018 I use Send("{CapsLock off}") I just started writing a script, and immediately faced a problem. I need to turn off CapsLock key. I can not shut off CapsLock button. Try it - the button LED will flash, but it sure as Hell won't turn off. Ive tried everything. So how do I shut the damned thing on or off? It's either beyond my current skills, or I missed something. Link to comment Share on other sites More sharing options...
badcoder123 Posted January 29, 2018 Share Posted January 29, 2018 $WshShell = ObjCreate("WScript.Shell") $WshShell.SendKeys("{CAPSLOCK}") Link to comment Share on other sites More sharing options...
alienclone Posted January 29, 2018 Share Posted January 29, 2018 or set option at start of script.. Opt("SendCapslockMode", 0) ;1=store and restore, 0=don't then your send capslock on/off/toggle will work supraspecies 1 If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
supraspecies Posted January 29, 2018 Author Share Posted January 29, 2018 19 minutes ago, badcoder123 said: $WshShell = ObjCreate("WScript.Shell") $WshShell.SendKeys("{CAPSLOCK}") Above my level... Eager to learn. I can see it triggers CapsLock On and Off, but how do i modify it to only trigger Caps Lock Off? Link to comment Share on other sites More sharing options...
supraspecies Posted January 29, 2018 Author Share Posted January 29, 2018 31 minutes ago, alienclone said: or set option at start of script.. Opt("SendCapslockMode", 0) ;1=store and restore, 0=don't then your send capslock on/off/toggle will work Your method worked like a charm, thank you very much. And thank you, badcoder123 that was a really neat small piece of code.! Link to comment Share on other sites More sharing options...
badcoder123 Posted January 29, 2018 Share Posted January 29, 2018 (edited) 44 minutes ago, supraspecies said: #include <WinAPIvkeysConstants.au3> #include <WinAPISys.au3> Opt("SendCapslockMode", 0) Send("{CapsLock}") $_Status = _WinAPI_GetKeyState($VK_CAPITAL) ConsoleWrite($_Status) This will tell you if it's on or off... Now it's just a case of you inserting an If statement. Edited January 29, 2018 by badcoder123 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now