Ridock Posted October 20, 2006 Share Posted October 20, 2006 (edited) Sorry if this is a re-post. Didnt see if my 1st one went through. My question is; Is it possible to tell how long a key has been press for? I'm using _Ispressed command and $begin = TimerInit(), $dif = TimerDiff($begin) Thanks for any help. Edited October 20, 2006 by Ridock Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 20, 2006 Moderators Share Posted October 20, 2006 Sorry if this is a re-post. Didnt see if my 1st one went through. My question is; Is it possible to tell how long a key has been press for? I'm using _Ispressed command and $begin = TimerInit(), $dif = TimerDiff($begin) Thanks for any help.Yes it's possible, I've shown this before, It was just a very long time ago, and I have no idea what it was for. #include <Misc.au3> Global $keytime While 1 Sleep(10) $keytime = _KeyPressTime('01');01 left mouse click If $keytime Then ToolTip('The key / mouse click was held for: ' & $keytime & ' seconds', 0, 0) WEnd Func _KeyPressTime($nValue) Local $iTimer If _IsPressed($nValue) Then $iTimer = TimerInit() While _IsPressed($nValue) Sleep(100) WEnd Return Round(TimerDiff($iTimer) / 1000, 2) EndIf Return SetError(1, 0, 0) EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Ridock Posted October 20, 2006 Author Share Posted October 20, 2006 Thank you. What I am trying to do is, be able to map a path in a game by simply recording the the keys and how long they were held for. Then call from a recorded list using those new parameters. Well hope it works thanks again. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 20, 2006 Moderators Share Posted October 20, 2006 Thank you. What I am trying to do is, be able to map a path in a game by simply recording the the keys and how long they were held for. Then call from a recorded list using those new parameters.Well hope it works thanks again.Thats It!!! It was for a game that someone needed to know how long each key was held down for, I'd tell you to look at my posts, but that would take you longer than just coding it yourself Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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