tsincaat Posted March 5, 2009 Posted March 5, 2009 (edited) I'm wondering how I can set up a "while" for when a key is being held down? If not for a while, then something that would allow me to execute some kind of loop while a key is being held down. Right now I know how to send keys, hold down keys with autoit, and set hotkeys to run a function, but not how to do this. Thanks! Edited March 5, 2009 by tsincaat
jvanegmond Posted March 5, 2009 Posted March 5, 2009 replace key by key code for _IsPressed. #include <Misc.au3> While 1 While _IsPressed(key) ; do somethign Wend Sleep(500) Wend github.com/jvanegmond
James Posted March 5, 2009 Posted March 5, 2009 (edited) For simplistic needs, a function: #include <Misc.au3> While 1 _IsDown("09", "_Do") Sleep(500) WEnd Func _IsDown($ioKey, $ioFunc) While _IsPressed($ioKey) Call($ioFunc) Sleep(10) WEnd EndFunc Func _Do() ConsoleWrite("Tab is held!" & @CRLF) EndFunc Edited March 5, 2009 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Andreik Posted March 5, 2009 Posted March 5, 2009 (edited) I'm wondering how I can set up a "while" for when a key is being held down? If not for a while, then something that would allow me to execute some kind of loop while a key is being held down. Right now I know how to send keys, hold down keys with autoit, and set hotkeys to run a function, but not how to do this. Thanks!_IsPressed function: #include <Misc.au3> While 1 If _IsPressed("41") Then TrayTip("TEST","You hold down key A",1) Else TrayTip("","",1) EndIf Sleep(10) WEnd EDIT: a little too late Edited March 5, 2009 by Andreik
tsincaat Posted March 5, 2009 Author Posted March 5, 2009 You guys are SO helpful! Thank you, all 3 of you
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