dgarrett8 Posted January 29, 2010 Posted January 29, 2010 (edited) It has been a long time since I used au3, so bear with me. I forgot how to use _IsPressed function and I can not even do this one simple code. At this point I am just trying to get the function to work properly. The problem here is that 'a' is pressed and it sends 'aka' instead of 'ka'; the elseif is not being properly used IMO, and when 'b' is pressed 'zu' does not even show up Anybody have suggestions? $dll = DllOpen("user32.dll") While 1 If _IsPressed("41", $dll) Then send("ka") Elseif _IsPressed("42 ", $dll) Then send("zu") EndIf WEnd DllClose($dll) My goal is when you hit the 'a' key 'ka' will show up replacing 'a' and such forth with the other keys. Edited January 29, 2010 by dgarrett8 "I think, therefore I am"[size="1"]René Descartes[/size]
Malkey Posted January 29, 2010 Posted January 29, 2010 Elseif _IsPressed("42 ", $dll) Then There is an inappropriate space after 42 in your example. This works #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 If _IsPressed("41", $dll) Then ;A key Do Sleep(10) Until Not _IsPressed("41", $dll) Send("{BS}ka") EndIf If _IsPressed("42", $dll) Then ;B key Do Sleep(10) Until Not _IsPressed("42", $dll) Send("{BS}zu") EndIf If _IsPressed("1B", $dll) Then Exit ; Esc Key WEnd DllClose($dll) And this works HotKeySet("a", "Showa") HotKeySet("b", "Showb") HotKeySet("{ESC}", "Terminate") While 1 Sleep(10) WEnd Func Showa() HotKeySet("a") Send("ka") HotKeySet("a", "Showa") EndFunc ;==>Showa Func Showb() Send("zu") EndFunc ;==>Showb Func Terminate() Exit 0 EndFunc
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