Guest vash17 Posted June 23, 2005 Posted June 23, 2005 Okay, I was wondering if it is possible to use Caps Lock to toggle hitting a key twice, into another application. Case 1: Caps Lock is OFF! I press A, it inputs A into "Application". Case 2: Caps Lock is ON! I press A, and it inputs A, A (at approximately 10 milliseconds) into "Application". It doesn't matter if the letter A is in caps or not. That can be fixed later. Thanks a lot!
Lazycat Posted June 23, 2005 Posted June 23, 2005 Try this code, based on modified _IsPressed function. While 1 Sleep(10) $nKey = _IsPressedMod() If $nKey > 0 and _CapsLockOn() Then Send(Chr($nKey)) Wend Func _CapsLockOn() Local $ret = DllCall("user32.dll", "int", "GetKeyState", "long", 0x14); VK_CAPITAL Return(BitAND($ret[0], 1)) EndFunc Func _IsPressedMod() Local $aR For $i = 0x41 To 0x7A ; A..Z, a..z $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", '0x' & Hex($i,2)) If BitAND($aR[0], 0x8000) Then Return $i Next Return 0 EndFunc Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
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