E1M1 Posted August 12, 2010 Share Posted August 12, 2010 _IsPressed detects given keypress but how to dedect anykey/mouse move? I want to close my window as soon as user presses any key/moves mouse. edited Link to comment Share on other sites More sharing options...
jaberwacky Posted August 12, 2010 Share Posted August 12, 2010 Query the mouse location and then compare for changes? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
E1M1 Posted August 12, 2010 Author Share Posted August 12, 2010 Thanks. Now close my app for mouse move I just would like to close for keypress too. At the moment only esc closes it. edited Link to comment Share on other sites More sharing options...
Drifter Posted August 13, 2010 Share Posted August 13, 2010 (edited) unfortunately all i can think of is going through all possible key combos and combining them with the "Or" operator, this way any key press would register. This method is messy, but it would work. You could probably do it in steps or build a seperate function like keyIsPressed() that returns a boolean value. I wonder if anyone else has a simpler option... Edited August 13, 2010 by Drifter Link to comment Share on other sites More sharing options...
jaberwacky Posted August 13, 2010 Share Posted August 13, 2010 (edited) Here's somethig I've been fiddling with lately. You may find it useful. Keep in mind that I'm new to using DLLs and whatnot.Link to the MSDN article: GetKeyboardStateGlobal Const $byteArray = DllStructCreate("BYTE lpKeyState[256]") Global Const $lpKeyState = DllStructGetPtr($byteArray) DllCall("User32.dll", "bool", "GetKeyboardState", "ptr", $lpKeyState) Global Const $KeyboardState = DllStructGetData($byteArray, "lpKeyState") Global $j = 1 For $i = 3 To StringLen($KeyboardState) Step 4 ConsoleWrite($j & " " & StringMid($KeyboardState, $i, 4) & @LF) $j += 1 Next Edited August 13, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
seandisanti Posted August 13, 2010 Share Posted August 13, 2010 unfortunately all i can think of is going through all possible key combos and combining them with the "Or" operator, this way any key press would register.This method is messy, but it would work. You could probably do it in steps or build a seperate function like keyIsPressed() that returns a boolean value.I wonder if anyone else has a simpler option... this has been addressed before... search for "any key pressed" i think will find it Link to comment Share on other sites More sharing options...
E1M1 Posted August 13, 2010 Author Share Posted August 13, 2010 none of solutions above worked, but help file helped me again, I modified _WinAPI_SetWindowsHookEx example. edited Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 13, 2010 Share Posted August 13, 2010 Did you try _Timer_GetIdleTime()? The time resets with any activity on mouse or keyboard. 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 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