Jump to content
Macro Express Forums

Breakpoint Question


Recommended Posts

That is quite an easy one, I hope!


Just go into an endless loop with:


Repeat start

If right mouse click


If pixel color


Actions (such as Break to exit Repeat and continue macro)



Time Delay 1 sec (or whatever)

Repeat End


To get an endless repeat I usually use something that will never occur such as

Repeat Until %N99% = 1 where%N99% is never set (ie always zero)


Afterthought You may have trouble trapping a short mouse click so the time delay may have to be removed.

Link to comment
Share on other sites

Yeah getting the endless loop isn't the problem as much as getting the "If right mouse click" or "If Pixel color" change.


I use the scripting editor as the direct one is just not up to my level yet, and If mouse clikc and Pixel color change are not an option.


I've tried creating something within a loop that might look to see if this has happened, but again.. Nothing that I can see that will say change variable N1 to 1 if right mouse button is clicked at any point.

Link to comment
Share on other sites

I don't know whether you caught my afterthought. Your reply was too quick!


I'm not sure the relevance of the Scripting Editor - that's all I use. The Get Pixel/If statement is quite easy but the right mouse click trap is not. I have some ideas but don't want to confuse the issue. I'll post if there are no other workable solutions.

Link to comment
Share on other sites

In the absence of a flood of ideas (!), here's a really ugly solution:


As noted before, this is part of a loop constantly checking the two parameters.


For the pixel color


Get Pixel Color (System menu) Color goes into variable %N20%

If Variable %N20% = color to be detected




You may have to write a small test macro to determine the integer color value you want to detect

Get Pixel Color (under mouse) %N1%

Text box display %N1%



For the right mouse click trap:


Use the fact a right click normally brings up a context menu. The mouse right button must be held down long enough to bring up the menu plus the loop time.


The position of the menu may be at cardinal directions NW, SW, SE, NE relative to the cursor position depending on where the cursor is on the screen. Make a routine that checks the pixel color at each of these cardinal points and looks for the menu background color (gray in standard Windows 13160660). Example for NE (above and right), followed by SE (below and right) only:


Get Mouse Position %N1%, %N2%


Add 5 to %N1%, Subtract 5 from %N2%

Get Pixel Color at %N1%, %N2% Color goes into variable %N21


Add 5 to %N1%, Add 5 to %N2% (the original values of %N1%, %N2%)

Get Pixel Color at %N1%, %N2% Color goes into variable %N22%


If Variable %N21% = color to be detected 13160660


If Variable %N22% = color to be detected 13160660






This will only work properly on pages where the color gray 13160660 is not extensively used.


I really meant ugly!!

Link to comment
Share on other sites

Just for fun I wrote the right mouse click trap macro, which works surprisingly well. The attached file is set to check 100 times at 1/2 sec intervals. Modify repeat to suit application.


Set macro running and then click right mouse within 50 secs. On right mouse click a beep occurs and the macro stops. See macro listing to automatically cancel context menu. Replace Break and Beep to suit application.


As a safeguard where the context menu color is used extensively on the screen, one could check if more than one cardinal point is the menu color and give a warning or other logic.


Link to comment
Share on other sites

File/Import/Import a Playable Macro.



Once you have imported, it can be treated like any other macro. It was not intended as a playable macro (easiest way to send the code).


To determine the menu color you can make a macro to do it. Alternatively, there is a text box (disabled) in the macro which gives the four measured color values. On a plain part of the screen, three will be the same and the fourth will be the menu color. If you enable the text box and shift it's position within the macro, you can run the macro and note the color value. Disable or remove after use.

Link to comment
Share on other sites

  • 2 years later...

FWIW, the macro worked OK here (on my XP Home PC). But interestingly that only became clear after some time. I was getting no beep, so assumed it was the macro at fault. Not so. When I replaced the Beep command with a WAV of my own, all was OK.


OT, but anyone have any idea

- Why internal speaker might not be working?

- What other (non ME) test can be done to test it is working?



Terry, West Sussex, UK

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.

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.

  • Create New...