Jump to content

filter pressed keys and get efficient way to "remap" keys


Recommended Posts

Hello, im trying to make a script which "remapps" keys when capslock is pressed.

#include <Misc.au3>
Local $hDLL = DllOpen("user32.dll")

While WinExists("Unbenannt - Editor")
   If _IsPressed("14", $hDLL) Then
      ConsoleWrite("Key PRESSED" & @CRLF)

      ;Wait until key is released
      While _IsPressed("14", $hDLL)

         If _IsPressed("51") Then
            Send("j")
         EndIf

      WEnd
      TurnOffCapslock()
   EndIf
WEnd

Func TurnOffCapslock()
   Opt("SendCapslockMode", 0)
   Send("{CAPSLOCK OFF}")
EndFunc

DllClose($hDLL)

Sorry for the messy Code, Im new to AutoIt :)

My questions are:

1) when I open notepad and press Capslock + Q to send an j, it sends something like "qjjjjjj".
    - how can I remove the q and is there a easy way included to get only one "j"?
    - since Im holding Capslock, it sends a upper case "J", is there a way to lower-case it?

2) I'd like to remapp keys while holding capslock what would be the best way to realise this for more than one key?
 

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
 Share

  • Recently Browsing   0 members

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