Allen Posted September 18, 2006 Posted September 18, 2006 I don't wan tto have to always use _isPressed(etc.) because all it returns is a 1 if something si pressed else a 0 is returned. Well.. this is hugely slow and cpu intensive... but what happens if i have a while loop and I need to see if the user pressed the 1 key or if he pressed the 2 key or the esc key. Do I just keep going through the loop reeaalaly fast which uses up tons of cpu, or is there a function like in C to getch() or wait until a key is inputted... then return what key was inputted, and then I can test with that key in the if statements.. that would be way better.. but unfortunately I can't find any function like that in AutoIt... what should i do .
jvanegmond Posted September 18, 2006 Posted September 18, 2006 There isn't such a function. Loop the _IsPressed function with maximum 5 ms of sleep. If you add more functions in the loop, you have to try with smaller times. github.com/jvanegmond
PsaltyDS Posted September 18, 2006 Posted September 18, 2006 I don't wan tto have to always use _isPressed(etc.) because all it returns is a 1 if something si pressed else a 0 is returned. Well.. this is hugely slow and cpu intensive... but what happens if i have a while loop and I need to see if the user pressed the 1 key or if he pressed the 2 key or the esc key. Do I just keep going through the loop reeaalaly fast which uses up tons of cpu, or is there a function like in C to getch() or wait until a key is inputted... then return what key was inputted, and then I can test with that key in the if statements.. that would be way better.. but unfortunately I can't find any function like that in AutoIt... what should i do .Use HotKeySet() to monitor those three keys. Your script can go on about its business untill interrupted by the hot keys. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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