jimbo Posted December 5, 2005 Report Share Posted December 5, 2005 I have a macro that uses the CaptureControlBeneathMouse and GetControlClass functions. Sometimes the functions return an error when the control does not exist. This is probably true as the screen repaints (without any visible trace to the user). The problem that I have is when the error is generated it aborts the macro. Is there anyway to trap an error like this and handle it rather than aborting the macro? Below is a code I am using. Mouse Left Button Click Delay 0.5 Seconds // Capture Control where mouse was clicked Capture Control to %C8% Variable Get Control Class: %C8% to %T18% Thanks, jimbo Quote Link to comment Share on other sites More sharing options...
kevin Posted December 5, 2005 Report Share Posted December 5, 2005 You might try adding a Log Errors command at the top of the macro. With some macro commands, this causes the errors to be written to a file instead of popping up an error dialog. You could then have your macro examine the error log file to see if an error occurred. The macro may stop, however. If this is the case you may need to have a second macro examine the error log file. Quote Link to comment Share on other sites More sharing options...
jimbo Posted December 6, 2005 Author Report Share Posted December 6, 2005 Thanks Kevin for the idea. I figured out that the error that caused the macro to abort was the GetControlClass function and not the CaptureControlBenaeathMouse function. So I setup a loop to make sure the control was visible (i.e. captured) before I tried the GetControlClass function. That appears to have worked last night as this macro takes an hour or so to run. It would still be nice to have an error trap so you could handle problems more gracefully. Repeat Until %T22% = "Valid" Capture Control to %C8% If Control %C8% Visible Variable Get Control Class: %C8% to %T18% Variable Set String %T22% "Valid" End If Repeat End 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.