strate Posted February 3, 2006 Share Posted February 3, 2006 I have a program that loops really fast non-stop. I want the program to slow down to a crawl when nothing has been typed for a period of time. I know I can do something with the Timer functions with the mouse position to slow it down. I'm stumped with the keyboard part though. Can you pull the button being sent with the driver, or some other function? I don't think IsPressed will work for me. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 I think _IsPressed() would work, you just have to check enough keys. This in fact checks everything - all keys and mouse buttons. #include <misc.au3> HotKeySet ("{ESC}", "quitme") While 1 For $i = 1 To 255 If _IsPressed (Hex ($i)) Then MsgBox (0, "pressed", $i) EndIf Next WEnd Func quitme() Exit EndFunc Link to comment Share on other sites More sharing options...
Valuater Posted February 4, 2006 Share Posted February 4, 2006 need a sleep in your while/wend loop 8) Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 Actually you don't _need_ one, it's just a nice thing to do. Even with Sleep (100) it still uses 12% of CPU... interesting. Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 I know you're right Larry, but I just did it to show that it could be done with _ispressed, and I don't really know a better way (I've tried something, but it didn't work out for me). If you'd like to say the way you'd do it (or PM me if posting it would be bad), that'd be really cool. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 4, 2006 Moderators Share Posted February 4, 2006 ancient chinese secret...Lar.I remember that commercial... Wasn't that a 'Tide' Commercial? 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...
strate Posted February 4, 2006 Author Share Posted February 4, 2006 GUIRegisterMsg + dll WH_KEYBOARD hook... but that's a key logger... ancient chinese secret...Lar.Could I get an example of the dllcall that uses GetAsyncKeyState? I believe it is in one of lazycats UDFs I want it so that I can try pluging in SendInput into it to see what I might get.Thank you. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... 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