MGuyM Posted May 25, 2007 Report Share Posted May 25, 2007 I have a macro that I wrote do automatically click on certain locations within a program. However, after the Click, I have to wait for the Screen to Redraw and display a message for my Macro to click on the Close Button. Problem I'm running into is that usually, everything runs great. But sometimes the Redraw doesn't take place. I currently check for the Change of a Pixel using the following routine: Get Pixel: Window Coords: 430,275 into %N1% Repeat Until %N1% = 1071789 Wait Time Delay 0.5 Seconds Get Pixel: Window Coords: 430,275 into %N1% If Variable %N1% = 1071789 Repeat Exit End If Repeat End What I'd like to add to this is a secondary check for an elapsed amount of time and then exit but I'm not sure how to implement the second level and was hoping that someone could help me (most likely Cory) Basically, if my screen doesn't redraw properly, my Macro hangs in the above loop waiting for the Pixel at 430,275 to change. When this happens, I can move the mouse around the location to allow the change to be seen and my macro continues. However, If I do a for loop to move the mouse around this location, it doesn't seem to work. I'm thinking that if there is a way to get a "TIME" when the First Get Pixel is recorded into %N1% and then during my Repeat Loop, do a Check against the time to see if 1 Minute has elasped, then it could exit the Repeat Loop. But how do I evalute this???? I'll be waiting patiently for a response.... Thank You Very Much in Advance. BTW.... Feel free to post the appropriate code Sincerely! MGuyM Quote Link to comment Share on other sites More sharing options...
joe Posted May 26, 2007 Report Share Posted May 26, 2007 These changes will maximize your loop time to about 10 seconds. By changing the loop counter (%N2%) or the delay time (currently 0.5 seconds), you can increase or decrease the loop time. Variable Set Integer %N2% to 1 Get Pixel: Window Coords: 430,275 into %N1% Repeat Until %N1% = 1071789 Wait Time Delay 0.5 Seconds Get Pixel: Window Coords: 430,275 into %N1% If Variable %N1% = 1071789 OR If Variable %N2% >= 20 Repeat Exit End If Variable Modify Integer: Inc (%N2%) Repeat End Quote Link to comment Share on other sites More sharing options...
MGuyM Posted May 26, 2007 Author Report Share Posted May 26, 2007 Thanks Joe! I think that's going to work perfectly. Might be something to include in a future release of your most outstanding book! Thank You Again! 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.