E1M1 8 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 Share this post Link to post Share on other sites
jaberwacky 327 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? Share this post Link to post Share on other sites
E1M1 8 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 Share this post Link to post Share on other sites
Drifter 0 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 Share this post Link to post Share on other sites
jaberwacky 327 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? Share this post Link to post Share on other sites
seandisanti 6 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 Share this post Link to post Share on other sites
E1M1 8 Posted August 13, 2010 none of solutions above worked, but help file helped me again, I modified _WinAPI_SetWindowsHookEx example. edited Share this post Link to post Share on other sites
PsaltyDS 39 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 Share this post Link to post Share on other sites