Jump to content

Calling experienced coders!

Guest vash17

Recommended Posts

Guest vash17

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!

Link to comment
Share on other sites

Try this code, based on modified _IsPressed function.

While 1
    $nKey = _IsPressedMod()
    If $nKey > 0 and _CapsLockOn() Then Send(Chr($nKey))

Func _CapsLockOn()
    Local $ret = DllCall("user32.dll", "int", "GetKeyState", "long", 0x14); VK_CAPITAL
    Return(BitAND($ret[0], 1))

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
  Return 0
Link to comment
Share on other sites

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...