owilsky Posted August 29, 2007 Share Posted August 29, 2007 (edited) Hi, I have a script which is running every 10 seconds (with Window's Task Scheduler). But I only want it to run if I am not working in a special window ($windowtitle). I now have this which checks if the mouse has been moved: if WinActive($WindowTitle) then $pos1 = MouseGetPos() Sleep (2000) $pos2 = MouseGetPos() ; exit if mouse has been moved if ($pos1[0]<>$pos2[0]) or ($pos1[1]<>$pos2[1]) then exit endif But I would also like to check if a button has been pressed in that window. Is that possible? Thanks, Oliver Edited August 29, 2007 by owilsky Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 29, 2007 Share Posted August 29, 2007 But I would also like to check if a button has been pressed in that window. Is that possible?Thanks,OliverAny button, or a particular one? You can register your own handler for button messages, but it gets into some advanced technique (at least advanced to me) and has a high risk of interfering with the normal operation of the control. You could perhaps check for other things more easily, like left mouse button with IsPressed(), combined with mouse coordinates over that control. 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...
owilsky Posted August 29, 2007 Author Share Posted August 29, 2007 Any button, or a particular one?Yes, any button. I do not want to run my script if the computer is being used. And I don't want to interfer or catch the button presses, I only want to know IF a button has been pressed. Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 29, 2007 Share Posted August 29, 2007 Yes, any button. I do not want to run my script if the computer is being used. And I don't want to interfer or catch the button presses, I only want to know IF a button has been pressed.There was an interesting DLL call (written by Larry, I think) posted that gave the idle time of the console (no mouse movement or keystrokes). That would be much easier and more reliable, but I can't find it on a quick search. Poke around the search function for the forum and look for it. 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...
owilsky Posted August 29, 2007 Author Share Posted August 29, 2007 Thanks, I will try it. 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