vinay Posted November 21, 2011 Report Share Posted November 21, 2011 Hi, Started using Macro Express Pro and am loving the feature so far. I have run into one problem so far. I have a script that scrolls through some transactions in Quickbooks and prints each one to a PDF file (the Print Batch option in Quickbooks doens't play well with printing to PDF). The script usually works - however, when my computer slows down it breaks. It seems like the delays I am putting in there are not long enough when my computer slows down for whatever reason. My question is, is there any way to have a "repeat delay until a prompt pops up". However the print prompt is itself within Quickbooks so not sure how I would check for it? Thanks! Quote Link to comment Share on other sites More sharing options...
Cory Posted November 21, 2011 Report Share Posted November 21, 2011 There are many methods of controlling timing but I think in this case a Wait for Window title would suffice. FYI timing is one of the big challenges in writing macros. Quote Link to comment Share on other sites More sharing options...
acantor Posted November 22, 2011 Report Share Posted November 22, 2011 Cory has said it well... timing is often a challenge when developing macros. Even with an elegant solution, such as waiting for a window title, control, mouse cursor shape, or whatever, sometimes timed delays become necessary. While fine-tuning a script, I get rid of timed delays, but inevitably, some are needed. I try to balance reliability, speed, portability, and robustness. My starting assumption is that no macro is 100% reliable. I am willing to give up a smidgeon of reliability to gain a little speed. At least for my own use. One of my more complex scripts fails once every 15 or 20 runs. I can get it to fail once every 25 runs, but it takes twice as long to execute. There is a whole other art to getting scripts to fail gracefully... Quote Link to comment Share on other sites More sharing options...
Cory Posted November 22, 2011 Report Share Posted November 22, 2011 Imagine 36k iterations on a webpage form;) Handling misfires gracefully is not difficult, the trick is to plan the design of the macro for this eventuality from inception. It's a PitA to take a fully developed script and back error handling into it. And working from a home point. In many cases I completely close out the form, web browser, or whatever and start from scratch each time. It adds to the cycle time but the run time will be a lot less if you don't have to keep recovering and restarting the macro. It is amazing though. When I create a rough draft of a macro it might be 20 lines. But if I make it even a little user-proof it will easily grow an oder of magnitude. Add graceful error handlinganotherhter order. Add tricks to decrease the cycle time eanotherhter order. So what was 20 can easily be 500 at the end of the day without even getting super error proof. And clients often don't understand because like me it seems to them it should only be a little more complicated than 20 lines. Quote Link to comment Share on other sites More sharing options...
vinay Posted November 22, 2011 Author Report Share Posted November 22, 2011 Thanks! I will check it out and let you know how it goes. Quote Link to comment Share on other sites More sharing options...
girijaprasad Posted November 27, 2011 Report Share Posted November 27, 2011 Thanks! I will check it out and let you know how it goes. loop until your requirement satisfied, I followed that pattern. I have a need to click a button until page is loaded fully with fully ajax functionality. wait until Webpage loading is not working at that situation, I tried to loop until I get the solution. the Solution is first i stored the desired fields when the page is loaded. After the page loaded my condition satisfied. My macro worked fine at all levels. Hope this will be useful. 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.