DeepRidge Posted August 18, 2014 Share Posted August 18, 2014 Hi guys, hope it's ok for me to ask this question because I had a look around and couldn't find any other threads covering the same thing. I was wondering if it's possible to make a script so that when you press 2 specific keys on your keyboard together then nothing registers, however if you press them individually then they work as normal. I tried a script of the form: While 1 If _IsPressed('31')=1 AND _IsPressed('32')=1 Then Send("{1 UP}") Send("{2 UP}") EndIf WEnd but the problem is that when I release the 1 key, I want it to send the 2 key that I'm still holding down. I thought about adding some more IsPressed checks to see if I'm still holding a key but those all fail too because of the Send Up commands. Simply put I want to be able to press 1 or 2, but if I press both nothing gets sent, but when I release one of the keys the end other continues sending as normal. Sorry if I didn't explain very clearly, really I'm hoping there's just some simple command that I'm overlooking but any help or suggestions that I can look into would be great, thanks for your help. Link to comment Share on other sites More sharing options...
Exit Posted August 19, 2014 Share Posted August 19, 2014 (edited) Welcome to the forum. Hope this helps. #include <Misc.au3> _HotKey("{ESC}") _HotKey("{1}") _HotKey("{2}") Func _HotKey($hotkey = "") Switch @HotKeyPressed Case "{ESC}" Exit MsgBox(64 + 262144, Default, "Exit", 1) Case "{1}" If _IsPressed("32") Then Return Beep(1000, 100) Case "{2}" If _IsPressed("31") Then Return Beep(2000, 100) Case Else If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed) If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.") EndSwitch EndFunc ;==>_HotKey While Sleep(100) ; here should be your application. WEnd ; meanwhile, here is a dummy loop. Edited August 19, 2014 by Exit App: Au3toCmd UDF: _SingleScript() 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