marcoval Posted September 30, 2004 Report Share Posted September 30, 2004 Not really a breakpoint question.. Different question. Is it possible to have the macro wait for either of 2 conditions? Here's what I mean.. Wait for Right mouse click OR wait for a pixel color to change on the screen. Quote Link to comment Share on other sites More sharing options...
Noggin the Nog Posted September 30, 2004 Report Share Posted September 30, 2004 That is quite an easy one, I hope! Just go into an endless loop with: Repeat start If right mouse click or If pixel color Actions (such as Break to exit Repeat and continue macro) Endif 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. Quote Link to comment Share on other sites More sharing options...
marcoval Posted September 30, 2004 Author Report Share Posted September 30, 2004 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. Quote Link to comment Share on other sites More sharing options...
Noggin the Nog Posted September 30, 2004 Report Share Posted September 30, 2004 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. Quote Link to comment Share on other sites More sharing options...
Noggin the Nog Posted October 1, 2004 Report Share Posted October 1, 2004 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 Actions Endif 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 Or If Variable %N22% = color to be detected 13160660 Actions Endif This will only work properly on pages where the color gray 13160660 is not extensively used. I really meant ugly!! Quote Link to comment Share on other sites More sharing options...
Noggin the Nog Posted October 3, 2004 Report Share Posted October 3, 2004 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. Right_mouse_click_test_macro.mxe Quote Link to comment Share on other sites More sharing options...
marcoval Posted October 4, 2004 Author Report Share Posted October 4, 2004 Hmm doesn't seem to work for me but my context menus aren't that pixel color. How do you edit these MXE files? Quote Link to comment Share on other sites More sharing options...
Noggin the Nog Posted October 4, 2004 Report Share Posted October 4, 2004 File/Import/Import a Playable Macro. edit 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. Quote Link to comment Share on other sites More sharing options...
terrypin Posted February 18, 2007 Report Share Posted February 18, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.