Jump to content
Macro Express Forums

Wait for Mouse Movement?


Recommended Posts

I don't know o any "wait for" commands but you could create a loop with a small delay that gets the mouse coordinates and advances only when the coordinates change.

Link to comment
Share on other sites

This is what I do in a macro which is only called by other macros. It displays a countdown message ("sleeping in n seconds") where n reduces by 1 each second. If any mouse movement is detected, the macro stops since I don't want to put the computer to sleep if I'm using it.

 

n91 is preinitialized to 10.

Text Box Display: Pausing
Get Mouse Position into (%nMouseX1%, %nMouseY1%) Relative to Screen
Repeat Until %n[91]% Equals "0"
 Delay: 1 seconds
 Get Mouse Position into (%nMouseX2%, %nMouseY2%) Relative to Screen
 If Variable %nMouseX1% Does not Equal "%nMouseX2%"
Or
 If Variable %nMouseY1% Does not Equal "%nMouseY2%"
Macro Stop
 Else
If Window "Pausing" is running
  Variable Modify Integer %n[91]%: Decrement
Else
  Macro Stop
End If
 End If
 Update Textbox: Pausing
End Repeat

Link to comment
Share on other sites

Thanks Paul, Cory

 

BTW did you know the command Get the Idle Time in the Variable Set Integer command already?

 

Get the Idle Time

Get the Idle Time calculates the computer idle time and saves the value to a variable. The idle time is specified as no mouse or keyboard activity occurring. The amount of time since the last mouse event or keyboard activity is saved to the Integer variable. The value is saved in time increments of seconds.

 

Thank You

Alexandra

Link to comment
Share on other sites

I knew that but you said mouse movement and idle time is based on multiple things. Also in my experience some programs can reset the idle time counter with no user input.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...