Rich, A Webinar would be awesome....
Denise -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich McNeil Sent: Friday, March 31, 2006 8:40 AM To: [email protected] Subject: RE: [Talk] How to build a robust script for Meditech --- best practices? Examples gratefully accepted! Henry, I believe we're going to develop a Webinar on the subject of running reliable, unattended scripts. In the mean time, I thought I might address it directly. These scripts are actually rather simple in structure... Sub Script Do Reset Doit Wait x 'seconds Loop Until Done End Sub Reset is a big Do...Loop with PauseLoop's and At's (or Rules in Rules based scripting) that gets the app to an "anchor point" from anywhere it might be from within the app and even starting the app if necessary. It should have an "ultimate reset" which shuts down everything and starts over. This is easily accomplished with our BootMgr which, after a period of script inactivity, will reboot the PC, login, and restart the script. Doit is the script which, if it has problems, reports them and exits. For scripts that run continuously, the Done conditional logic isn't necessary. This strategy is the result of, and has saved us from, a lot of 2AM calls, and it should work for you. Rich McNeil Boston Software Systems 866 653 5105 x813 -or- 508 318 5327 www.bostonworkstation.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Henry Hansen Sent: Thursday, March 30, 2006 5:03 PM To: [email protected] Subject: [Talk] How to build a robust script for Meditech --- best practices? Examples gratefully accepted! Hello, Generally speaking, my scripts work OK when conditions are good. It's when the "edge" cases of Meditech client instability, network link failures etc., come into play. I sure would appreciate reading about the strategies successful scripters use so they can sleep at night and know their scripts are printing things such as pharmacy MARs reports reliably every evening. Unfortunately, the network instability is something totally out of my control - as is the Meditech installation. (We are geographically about 300 miles away from our data centre hosting the Meditech servers). Overall, it's pretty good, but we'll see a few Citrix session drops a week, and a few times per day the 3 Tier Meditech client's startup/shutdown will take anywhere from .5 seconds to a few minutes, or completely freeze. Obviously I'd have a lot more hair if this situation improved ... but I still need to build some type of error recovery, and this environment seems like a real good place to perfect error recovery coding. My strategy so far has been to use a VB6 EXE and the three tier client for the added Boston Scripting functionality. MeditechCS connection BTW. When the time comes to run the report. Start the Meditech client. Set a timeut of a couple of minutes. Save the window handle. Set an on error goto Do normal script processing that generally works fairly well. Call Shutdown and exit. The error handler looks like this: ------------- ScriptError: Logit ("RunMedStan - Error handler: " & Err.Source & " " & Hex(Err.Number) & " " & Err.Description) If Err.Number = seDoEvents Then DoEvents: Resume Call ExitMeditech Logit ("Error handler finished.") The ExitMeditech sub looks like this: Sub ExitMeditech() Dim I As Integer If Active Then Logit ("ExitMeditech: Attempting to shutdown and exit.") Logit ("ExitMeditech: Sending 4 ESCs - waiting 1 second between each.") For I = 1 To 4 Key "{ESC}" Wait 1# Next Logit ("ExitMeditech: Sending 4 ESCs - waiting 0.25 second between each.") For I = 1 To 4 Key "{ESC}" Wait 0.25 Next Logit ("ExitMeditech - Connecting to non existant stream.") Connect "fred", stStream ' Close Boston Scripting Logit ("ExitMeditech - Setting Shutdown=True") Shutdown = True Wait 0.5 Logit ("ExitMeditech: Meditech client should be closed.") Logit ("ExitMeditech: Sending @_UNLOAD") Key "@_UNLOAD" Else Logit ("ExitMeditech: Meditech doesn't appear to be active.") End If ' ' If the Window is still hanging around. ' If IsWindow(meditech_hwnd) Then Logit ("ExitMeditech - hwnd still valid, killing process.") KillProcess (meditech_hwnd) End If End Sub Thanks, Henry Hansen @ Palliser Health
