Sign in to follow this  
Followers 0
ymn

Capital Letter Hotkey

6 posts in this topic

I've run across this issue when trying to remap keyboard letters, best shown in this code

Opt("SendCapslockMode", 0)
HotKeySet("a","func1")
HotKeySet("A","func2")
While 1
Sleep(10)
WEnd
Func func1()
Send("b")
EndFunc
Func func2()
Send("B")
EndFunc

If I hold SHIFT, the first time I press "a", func2 will be called. But as long as I keep holding SHIFT after that, func1 will be called instead, which isn't the desirable behavior for me. I have to release SHIFT and hold it again to call func2. I want func2 to be called as long as SHIFT is held. What can I do about this, and why is it happening in the first place?

Share this post


Link to post
Share on other sites



I tried replace "A" and "B" with "+a" and "+b" (and any combination of those), but I still get the same behavior.

Share this post


Link to post
Share on other sites

The only other way I can see to do it would be to point both HotKeys to func1, and then do an If statement to check whether SHIFT is pressed. Something like this perhaps:

#include <Misc.au3>
Local $hDLL = DllOpen("user32.dll")
HotKeySet("a","func1")
HotKeySet("A", "func1")

While 1
Sleep(10)
WEnd

Func func1()

   If _IsPressed(10, $hDLL) Then
     func2()
   Else
     MsgBox(0, "", "a was selected.")
   EndIf

EndFunc

Func func2()

MsgBox(0, "", "A was selected.")
 
EndFunc

DllClose($hDLL)

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Yeah, I guess that's not too bad of an alternative.

Thanks JLogan

Share this post


Link to post
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
Sign in to follow this  
Followers 0