SteveR Posted March 18, 2016 Report Share Posted March 18, 2016 I am having a reliability problem with a macro. It will run anywhere from a few to several hundred times okay, then it will stop. I assume it is at one of my wait for commands, but how can I tell where it has stopped? That would be a big help in understanding what I need to fix. Quote Link to comment Share on other sites More sharing options...
acantor Posted March 19, 2016 Report Share Posted March 19, 2016 When you say the macro stops, what is happening? Does the macro complete? Get stuck at a step? Could you give us a code sample? Quote Link to comment Share on other sites More sharing options...
rberq Posted March 19, 2016 Report Share Posted March 19, 2016 One approach would be to scatter commands "Log Message to Default Error Log" at a few (or many) key spots in the macro. Start by putting them just before the "wait for" situations that you suspect. Just number the messages sequentially. Then after a failure you can review the log and see what was the last message logged and that should put you close to the problem spot. I have used log messages extensively for debugging and the macros still ran very fast. Generally I would have a "trace" switch I could turn on and off, stored in an environment variable, and the macros would bypass logging when the switch was off. For your one-time search for this problem, you don't have to get that fancy. Quote Link to comment Share on other sites More sharing options...
SteveR Posted March 19, 2016 Author Report Share Posted March 19, 2016 Attached is the macro I am working with. There are a number of waits which are indefinite. When the macro "fails" it is stopped somewhere I assume on a wait. I can abort the macro with the hotkey. Most of the time at present, the screen shows the open file window. The macro has a wait for this window, I do not know if it is waiting or has gone past it (perhaps the application ignoring the text the macro types) or exactly what is happening. Upg.mex Quote Link to comment Share on other sites More sharing options...
SteveR Posted March 19, 2016 Author Report Share Posted March 19, 2016 I changed all of the indefinite waits to time out after 30 seconds. This seems to give me meaningful error messages so I can chase down the problem. I guess I was confused and thought the macro would continue after a wait timeout. Having it abort and provide appropriate message is great. 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.