spymare Posted February 7, 2011 Posted February 7, 2011 Hi. Is it possible to prevent hotkeyset from making a loop when holding down a button, "in this case "ESC"If you hold down esc, it keeps writing the date alot of times :/.HotKeySet("{ESC}", "test")While 1Sleep(100)WEndFunc test()Send("Today's time/date is {F5}")EndFunc
jvanegmond Posted February 7, 2011 Posted February 7, 2011 Hey spymare, this is a possible solution: #include <Misc.au3> ; Required for ispressed HotKeySet("{ESC}", "test") While 1 Sleep(100) WEnd Func test() HotKeySet("{ESC}") ; Unbind escape so function is not called again Send("Today's time/date is {F5}") While _IsPressed("1B") ; While escape is held down Sleep(50) ; do nothing WEnd ; Once escape is released, rebind the hotkey HotKeySet("{ESC}", "test") EndFunc github.com/jvanegmond
spymare Posted February 7, 2011 Author Posted February 7, 2011 (edited) well I guess I could just use ispressed instead:#include <Misc.au3>$dll = DllOpen("user32.dll")While 1If _IsPressed("23", $dll) ThenSend("Today's time/date is {F5}")sleep(200)EndIfWEndbut i would prefer hotkeyset . Edited February 7, 2011 by spymare
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