Jump to content

Recommended Posts

Guest vash17
Posted

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!

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...