Draygoes Posted November 15, 2017 Share Posted November 15, 2017 (edited) Hi all. Ok, so the idea is to check if the caps lock key is on and if so switch it off, run a function and exit. At least that is the idea for the final script. Right now I just have it executing a msgbox in place. Detection of key works fine, but switching it off not so much. Global Const $VK_CAPITAL = 0x14 If _Key_Is_On($VK_CAPITAL) Then Send("{CAPSLOCK Toggle}") If _Key_Is_On($VK_CAPITAL) Then MsgBox( 0, "", "") EndIf Func _Key_Is_On($nVK_KEY, $vDLL = 'User32.dll') Local $a_Ret = DllCall($vDLL, "short", "GetKeyState", "int", $nVK_KEY) Return Not @error And BitAND($a_Ret[0], 0xFF) = 1 EndFunc Any help would be wonderful. Thanks. Edited November 15, 2017 by Draygoes Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
badcoder123 Posted November 15, 2017 Share Posted November 15, 2017 (edited) Looking for something sort of like this? #Include <WinAPI.au3> $_Key = 0x14 $_Status = _WinAPI_GetAsyncKeyState($_Key) ConsoleWrite($_Status) Edited November 15, 2017 by badcoder123 Link to comment Share on other sites More sharing options...
TheDcoder Posted November 15, 2017 Share Posted November 15, 2017 @badcoder123 I suggest using $VK_CAPITAL: #Include <WinAPI.au3> #include <WinAPIvkeysConstants.au3> $_Status = _WinAPI_GetAsyncKeyState($VK_CAPITAL) ConsoleWrite($_Status) EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Draygoes Posted November 15, 2017 Author Share Posted November 15, 2017 Getting the status is not the problem. Turning it off does not work. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
PACaleala Posted November 15, 2017 Share Posted November 15, 2017 $WshShell = ObjCreate("WScript.Shell") $WshShell.SendKeys("{CAPSLOCK}") "Let AutoIt shine !" SouzaRM, Aphotic and Draygoes 2 1 Link to comment Share on other sites More sharing options...
Draygoes Posted November 15, 2017 Author Share Posted November 15, 2017 Yes, this works perfectly! Thank you PACaleala! Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. 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