ymn Posted July 6, 2012 Share Posted July 6, 2012 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? Link to comment Share on other sites More sharing options...
JohnOne Posted July 6, 2012 Share Posted July 6, 2012 (edited) HotKeySet("+a","func2") perhaps. Edited July 6, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ymn Posted July 17, 2012 Author Share Posted July 17, 2012 I tried replace "A" and "B" with "+a" and "+b" (and any combination of those), but I still get the same behavior. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 17, 2012 Moderators Share Posted July 17, 2012 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) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
ymn Posted July 20, 2012 Author Share Posted July 20, 2012 Yeah, I guess that's not too bad of an alternative. Thanks JLogan Link to comment Share on other sites More sharing options...
JohnOne Posted July 20, 2012 Share Posted July 20, 2012 It could also be down to sticky key. Look in wiki for _SendEX AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
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