billblinn Posted June 6, 2007 Report Share Posted June 6, 2007 I need to connect to a Web-based service to poll retailer records for approximately 100 stores per day. The menu structure varies somewhat from store to store, so I need to keep track of how many Tab keys to press for each store to position the focus on the appropriate button. Easy enough; the information is all provided by a CSV control file. But what if something changes? The store could add or drop a service and that could change the number of tabs. As a result, the application could go to the wrong place. Once I'm logged on, the window-like panels are created (apparently) by an ActiveX control. Because of this, I can't wait for the window title. I can see 4 places in the script where trouble could occur (noted below as "failure points" 1 through 4. I'm looking for a way to detect errors here and, if there is an error, stop the macro. Variables from CSV text file: Login (T21) - Password (T22) - Co# (T23) - Job (T24) - File Count (T25) - File (T26) - Tabs-Extract (T27) Tabs-Job (T28) - Tabs-Close (T29) - Tabs-Exit (T30) - Retailer-directory (T31) - Project-subdirectory (T32) Dates (T33) - OK button present (T34) - Output directory (T35) - Begin date = one year ago (T91) - End date = today (T92) The following code-like text shows the overall structure of the macro, but is not really code. LOGFILE:VIP.log—Starting ... LOGFILE:VIP.log—######### Retailer %T31% *** PROCESS TEXT FILE BEGIN Delete files in local download directory. Open browser and logg on with %T21% & %T22%. Use mouse to click work button. (POSITION MAY VARY depending on IE plug-ins.) Second log in requires the password a second time. The login window (a pop-up) must be selected and moved or the password cannot be entered. Windows from this point on do not report their names; all I can do is wait. Wait 10 seconds, then use Tab to position cursor on Reports button. Enter. (Failure point 1) Wait 10 seconds, then use Tab to position cursor on appropriate Report. Enter. (Failure point 2) *** IF T33 > 0 Enter start date and end date *** ENDIF Wait for file to be ready, then click OK. *** IF T34 > 0 Enter to click "OK". *** ENDIF Tab to Close button. Enter. (Failure point 3) Tab to Exit button. Enter. (Failure point 4) Close the browser. Connect to ftp site. Chage to directory specified by T31/T32/. Send file specified by T35\T26 *** PROCESS TEXT FILE END LOGFILE:VIP.log—Process complete! Thanks! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.