I'm having the same problem.  Several times I come in and see a window memory manager error, with the script hung in the background. 
 
What is the best way to logically install timeouts in your script?  I was hoping to put a timeout on the step (BWS8), however, it seems that a timeout must be placed in a rule.  I never seem to hang at the same rule, so, I cannot imagine placing a timeout instruction for everyone of them.
 
Also, one great help with my Meditech scripts has been to include a stable 0.5 on every rule though.  I'm not sure if we have system resources on our Meditech machines or it is just a nuance of NUI, but stable helped my prevent hangs by 80%.
 
 
 
Lori Shook Kent, Database Analyst
Catawba Valley Medical Center
810 Fairgrove Church Road SE
Hickory, NC 28602
 
phone:  828.326.3446
      fax:  828.326.3023
   email:  [EMAIL PROTECTED]
 
*************************************************************************************************************
The information contained in this email may contain confidential information.
It is intended for the use of the addressee.  If you are not the intended recipient, any
disclosure, copying, or distribution of this information is strictly prohibited.  If you received
this in error, please inform the sender immediately and remove any record of this message.
*************************************************************************************************************


>>> [EMAIL PROTECTED] 3/31/06 >>>
Henry,
It sounds like you have a problem similar to one I have.  My script gets stuck looking for windows and screens that aren't there because the application/network connection got dropped temporarily.  I asked the guys from BWS about it, and they suggested including a timeout or a call to a timeout script in each of the loops that's looking for something.  Depending on the app, If you have a specific screen/window that should be open whenever the script is running, you could intersprerse your code with calls to a script to look for that window, and if not found, to restart the main script.  Or if you know approximately how long the script should take based on the number/size of files/records to process, you could allow a generous timeout to restart the script after that time.  Just some ideas I had. I wish you well with it. 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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

Reply via email to