Cory Posted March 3, 2007 Report Share Posted March 3, 2007 Again I’m being lazy here and asking if anyone has a solution for me before I burn up too many brain cells thinking of a solution. I have several macros that repetitively plow thru thousands of records or files in a program extracting data. ME excels at this. Normally they run pretty smooth but often I have to baby sit them as something like 1 in 100 bomb out for unknown reasons. It’s only been a mild inconvenience and I usually structure my macro so that I can easily restart it from where I left off. But it annoys me and I would like to handle this better. Now the kind of advice I’m looking for is broad in scope and generalized and would focus on how to design the program than technicalities. I have many things like this but I’ll make a simple example. My client uses some government form software and I find a need sometimes to manually extract a bunch of records. Unfortunately the software vendor’s QC is scary and the export facility is broken and they don’t seem to have much interest in fixing it. Now I use timing commands like Wait for Window and Wait for Control but once in a blue moon it fails. The window or control pops right up and for whatever reason ME doesn’t see it. So after 20 seconds of displaying the window or whatever it bombs out. The problem is now the macro is still running and doing nothing. If it errors I would like to be able to do something like send me an SMS message or maybe even close the record and reopen. But the only thing ME will do is display the error box. I’ve thought of a couple of solutions but they’re ugly, add a lot of complexity and usually slow the run tie down a lot. So if anyone has an idea of how better to deal with this I would love to hear it. Quote Link to comment Share on other sites More sharing options...
paul Posted March 4, 2007 Report Share Posted March 4, 2007 Well, my general approach to problems like this is to avoid all ME commands which do an automatic "Wait for" and bomb out when they fail. Instead, within as many Repeat loops as you need, I use some sort of IF command, or write a subroutine in a separate macro, and look after my own loops and error conditions. Here's a practical example: Variable Set String %T91% "13395456/15/415/130/Mozilla Firefox" Macro Run: { Utility - Wait for Pixel } If Variable %N99% = 0 Macro Stop End If T91 (delimited with "/") contains - Pixel - TimeoutSeconds - X-Offset1 - Y-Offset1- - X-Offset2 (optional) - Y-Offset2 (optional) - X-Offset3 (optional) - Y-Offset3 (optional) - WindowName If N99 is 0, then we timed out and the pixel colour never appeared at the x,y location (of which I can have multiple pairs). Imagine that ME contained a "Wait n seconds for Pixel colour at x,y", and that if it failed it would issue an error message (just like Wait for control, or Wait for Window Title). My code above would be how I'd avoid using such a command. Yes, it's certainly more code, but you retain control. And once you've written and debugged the subroutine (in this case "{ Utility - Wait for Pixel }"), then you're actually writing about the same amount of code. Quote Link to comment Share on other sites More sharing options...
Cory Posted March 4, 2007 Author Report Share Posted March 4, 2007 This was what I ihad in mind in the beginning. Instead of Wait for Window do a series of commands that gather and test teh top window name with a little dealy in each. I suppose it shouldn't be too much more difficult. It's just no very elegant. I feel a feature request coming on.... 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.