gte Posted May 8, 2009 Share Posted May 8, 2009 (edited) I've been searching old posts for about 2 hours now and cannot find a script that works successfully with key strokes and mouse movement. I want it to check for mouse movement or keystrokes in an if statement, so that the function will only run when it does not have mouse movement or keystrokes for 5 seconds or more ... anyone? if ProcessExists('scguiw32.exe') <> 1 Then While 1;Infinite Loop $MPos1 = MouseGetPos() MsgBox(0, "1Mouse x,y:", $mpos1[0] & "," & $mpos1[1]) Sleep(3000) $MPos2 = MouseGetPos() MsgBox(0, "2Mouse x,y:", $mpos2[0] & "," & $mpos2[1]) if $MPos1 == $MPos2 then MsgBox(0, 'timer window', 'move your mouse') elseif caprskeepalive() EndIf WEnd Edited May 8, 2009 by gte HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
Qousio Posted May 8, 2009 Share Posted May 8, 2009 (edited) I've been searching old posts for about 2 hours now and cannot find a script that works successfully with key strokes and mouse movement.I want it to check for mouse movement or keystrokes in an if statement, so that the function will only run when it does not have mouse movement or keystrokes for 5 seconds or more ... anyone?You will need to use:Timers.au3 UDF_Timer_Init and _Timer_Diff to capture the time between mouse move or keystrokeMouseGetPos to see if the mouse has movedNot sure how to propperly check if a keystroke has occured....Continue reading to Melba23's post. He has a better way Edited May 8, 2009 by Qousio Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 8, 2009 Moderators Share Posted May 8, 2009 gte,Look up _Timer_GetIdleTime in that ever useful Help file. :-)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Qousio Posted May 8, 2009 Share Posted May 8, 2009 gte,Look up _Timer_GetIdleTime in that ever useful Help file. :-)M23Gah, I completely forgot about that. Good one Melba! I'l just remove my previous post now Link to comment Share on other sites More sharing options...
gte Posted May 8, 2009 Author Share Posted May 8, 2009 Nice, thanks!I was looking everywhere, and this works perfect!gte,Look up _Timer_GetIdleTime in that ever useful Help file. :-)M23 HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script 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