Jump to content
Macro Express Forums

Howto: Break Out Of A Repeat Loop With Mouse


Recommended Posts

This is my general purpose routine for breaking out of a repeat loop without keyboard input.

 

With this routine, you only need to move the mouse cursor to the upper left-hand corner of your screen to break out of a loop (or even your macro).

 

The routine checks the current mouse cursor position, and if it's in the

upper left-hand corner, a Break command (formerly Repeat Exit) will

be issued, thus ending the loop.

 

The routine actually checks a 3x3 (9 pixel) square starting from the upper left-hand

corner (position 0,0). This is to account for "drifting" mice, and users with bad "aim".

 

AFAIK, this routine is not processor-intensive, so you can stick it into multiple points

in your repeat loops to ensure the mouse position is checked often.

 

// --- Start mouse position checker ---

Get Mouse Position Screen: %N7%, %N8%

If Variable %N7% <= 2

AND

If Variable %N8% <= 2

Break

// break out of loop if upper left-hand corner

End If

// --- Ends mouse position checker ---

 

Lemming B)

 

<REM2:Author: Lemming - Company: Star Publications><REM2:A general purpose routine for breaking out of a repeat loop.><REM2:This checks the current mouse cursor position, and if it's in the><REM2:upper left-hand corner, a Break command (formerly Repeat Exit) will ><REM2:be issued, thus ending the loop.><REM2:><REM2:--- Start mouse position checker ---><MOUSEPOS:T:07:08><IFVAR2:2:07:6:2><AND><IFVAR2:2:08:6:2><BREAK><REM2:break out of loop if upper left-hand corner><ENDIF><REM2:--- Ends mouse position checker --->

Link to comment
Share on other sites

  • 6 months later...

Heh. Your post made me think. Just fooling around, I decided to make a mouse-restriction macro. At first, I kept the cursor in a 100x100 box, so you could still move it around some, but couldn't get outside of set boundaries. That didn't work so well, you could get outside of the box momentarily; while ME was running a loop to check if you were outside of the right boundary, you could go outside of the top boundaries or left one for a moment, only to be snapped back inside when it came around to check that position.

 

Instead, I settled for a macro that first checks mouse position and then goes into a an infinate loop of setting the mouse position to that first one. Instead of a mouse trap, it's more of a mouse lock now.

 

I'm not real sure if it'll be of any use, but I thought it might come in handy.

<MOUSEPOS:T:07:08><REP3:08:000001:000001:0001:0:01:d><MMS2:7N,8N><MSD:1><ENDREP>

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...