[MT-L] Scripting in VB using Meditech DLLs

76 views
Skip to first unread message

Brady, Tim

unread,
Dec 8, 2016, 8:45:56 PM12/8/16
to medit...@mtusers.com

I typically do my scripting in VB.Net using Meditech DLLs.  I have a problem where if the Meditech window is minimized the script hangs until the Meditech workstation is maximized.  Below is the code that I use to start the workstation and I have tried multiple things for the second argument and nothing I have tried starts the workstation maximized.  I believe the PromptBoolean2 function is the routine that hangs when the workstation is minimized…  

 

Any thoughts or suggestions for either how to get the workstation to start maximized, or other workaround for hanging if the workstation is minimized?

 

   result = MRWStartup("C:\Program Files\Meditech\Workstation3.x\T.exe", "")

 

​​​​​Thanks!

 

Tim Brady

Director of Information Systems

 

Mt. Washington Pediatric Hospital

1708 W. Rogers Ave.

Baltimore, MD 21209

410-578-2676 (office)

www.mwph.org

 

 

     



The information in this email is confidential and may be legally privileged. It is intended solely for the addressee or a person authorized to deliver it to the named addressee. Access to this email by anyone else is unauthorized. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.
Mt. Washington Pediatric Hospital, 1708 West Rogers Avenue, Baltimore, Maryland, 21209-4596.

Charles Still

unread,
Dec 10, 2016, 7:28:04 AM12/10/16
to Brady, Tim, medit...@mtusers.com
Found it, notes below..  I know you solved your issue, but others may find helpful.
Code would need to be compiled with Autoit




===============================================================================
Meditech RAD EDM Tracker Auto Login Utility and Notes - RADLT-r1.exe and RADLT-r1-Wrapper.exe

Two programs have been written to support the auto launch of the RAD EDM Read only Tracker.

RADLT-r1.exe
RADLT-r1-Wrapper.exe <-- Run in startup.

They are located herre:

file://issvhc/sharedir/IS/Meditech_EDM

To install to a workstation copy the two files to the

C:\Program Files\MEDITECH\Workstation4.x

and create a shortcut to the RADLT-r1-Wrapper.exe file in the computers SVMC auto start directory.

The program runs every 5 minutes and if the PC is idle, and the application is not running, it auto logs in and starts the tracker.


========================================================================
The SHARED INI file can be used to manage all trackers.

file://issvhc/ShareDir/EDCannedText/EDMTracker/RADLT.ini


[Version]
VersionCurrent="RADLT-r1.exe"
VersionOld="EDMLT-r7.exe"

[Location]
Source="\\issvhc\ShareDir\EDCannedText\EDMTracker\"
Destination="C:\Program Files\MEDITECH\Workstation4.x\"

[Status]
;Note Run, Disabled, Kill <- Changing this line can Disable or EXIT the application on all workstations entirely.
Status1="Run"

========================================================================
========================================================================Code Below RADLT-r1-Wrapper.exe
========================================================================
Code for Wrapper Application


;' This script wrapps the MEDITCH EDM RAD Tracker Application and runs it every 5 minutes
;' It will restart the program if it is closed, Maximize if minimized, If the pc is idle,
;' Charles Still, 2012 - 2013 ;' Added Move Mouse for Screensaver Disable 1/11/13


#include 
#include <_CompareFileTimeEx.au3>

DIM $switch=1
DIM $IniFile="\\issvhc\ShareDir\EDCannedText\EDMTracker\RADLT.ini"
DIM $version=IniRead($IniFile,"Version","VersionCurrent","NotFound")
DIM $hSource=IniRead($IniFile,"Location","Source","NotFound") & $version DIM $hDestination=IniRead($IniFile,"Location","Destination","NotFound") & $version DIM $Status=IniRead("\\issvhc\ShareDir\EDCannedText\EDMTracker\RADLT.ini ") DIM $iMethod=0 DIM $FileCompare=0 DIM $wtf=0 ;Debug Util

sleep(50000) ;50 Second Sleep Delay before running script for first time should help with slow booting computers

While 1
;Disables screen saver with mouse move every 4 min if device is idle
Global $iIdleTime = _Timer_GetIdleTime()

If $iIdleTime > 240000 Then
MouseMove(10, 100, 0)
EndIf

IF Mod(@MIN,5) = 0 Then
If FileExists($hDestination)=0 Then FileCopy ($hSource, $hDestination, 1)
If FileExists($IniFile)=0 Then
MsgBox("Error","Inifile not found at" & $IniFile, 5)
Exit
EndIf
Global $FileCompare = _CompareFileTimeEx($hSource, $hDestination, $iMethod)
If $FileCompare=1 then FileCopy ($hSource, $hDestination, 1)
If $switch = 0 and $Status="Run" Then
Run($hDestination)
$switch=1
Else
$switch=0
EndIf
Endif
;EndIf
Sleep(10000)
WEnd


======================================================================Code for RADLT-r1.exe
======================================================================
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'
;' SVMC Tracker Board Script (Via Auto-It!) ;'
;' Written by Damian Shepard in IT NAMC, to assist with automatically logging into
;' the ED Tracker board in the Emergency Room for our EDM Module Go-LIVE
;' - 6/2012 - updated by Charles Still SVMC ;' - Includes exits if a step in the macro fails
;' - Includes stop if Meditech is Already Running
;' - Includes stop if Script is already executing
;' - Includes Maximize Window on launch ;' - Added functionality to handle Login Messages displaying on screen
;' - 12/2012 Added idle timer so script will not run if device has been used in last 30 seconds
;' - 1/2013 Rewritten from scratch to handle multiple startup options
;' - 1/2013 Added feature to maximize window of tracker if it is minimized
;' - Note the EDMLT-r#-Wrapper or RADLT-r# application calls this script every 5 min.
;' - version RADLT-r1 - revision 1 - 1/25/13
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;' Start of Script
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim $Test=0
Dim $numberOfAppInstances=0
Dim $FAIL=0
Dim $FAIL1=0
DIM $FAIL2=0
Dim $ProcessName = "T.exe"
Dim $Y=0
Dim $state=0
Opt("WinTitleMatchMode", 2)

#include 
#include 

$numberOfAppInstances = ProcessList(_ProcessGetName(@AutoItPID))
$numberOfAppInstances = $numberOfAppInstances[0][0] Global $iIdleTime = _Timer_GetIdleTime()

;MsgBox(64, "_Timer_GetIdleTime", "Idle time = " & $iIdleTime & "ms") ;'Checks idle time delay, and does not run if computer has been used in last 30 sec.
;To use this script as an autolauncher shortcut, remark it out with ;'s If $iIdleTime < 30000 Then
Exit
EndIf

$state = WinGetState("Radiology Tracker") ;gets the state of your ticker window
If BitAnd($state, 16) Then ;if it's minimized WinSetState("Radiology Tracker","",@SW_RESTORE) ;restore it EndIf

If $numberOfAppInstances > 1 Then
Exit
EndIf

If ProcessExists($ProcessName) Then
Exit
EndIf

;' Run("C:\Program Files\MEDITECH\Workstation4.x\T.exe")
Run("C:\Program Files\MEDITECH\Workstation4.x\T.exe", "" , @SW_MAXIMIZE)

Do
$FAIL1 = WinWaitActive("[CLASS:MRWF]","Sign On",2)
$FAIL2 = WinWaitActive("[TITLE:Magic Workstation]","MIS Directories",2)

If $FAIL1 = 0 AND $FAIL2 = 0 Then
Send("{ENTER}")
$Y=$Y+1
EndIf

If $FAIL1 <> 0 Then
Send("radtracker{ENTER}")
Send("password{ENTER}")
Sleep(200)
Send("{ENTER}")
Exit
EndIf

If $FAIL2 <> 0 THEN
Send("1{ENTER}")
Sleep(100)
Send("radtracker{ENTER}")
Send("password{ENTER}")
Sleep(200)
Send("{ENTER}")
Exit
EndIf

Until $Y=4

Exit

==============================================================================

On Fri, Dec 9, 2016 at 8:06 AM, Charles Still <cha...@patientsaferx.com> wrote:
Hello Tim;

You can create a simple Autoit script to open and maximize the screen.  You can further set it to monitor the window and re-maximize it if someone minimizes the screen.

Free tool
https://www.autoitscript.com/site/autoit/

I'll look and see if I have a copy of my monitoring script I created for Magic.  I used it for autologin and maximizing the ER tracker board and other functions.

Charles J. Still, MBA, CPPS, CPHQ

===###===###===###===###===###===###===
To unsubscribe from the meditech-l, follow the instructions at the URL http://mtusers.com/mailman/options/meditech-l_mtusers.com/

Please do NOT send messages that ask "Please post to the list" or "I'd like to see your answers" or "Send that info to me, too"  These are useless messages that just waste the email server's resources.  Instead, email the original requester and ask that they send you or post the results of their question.

Go to http://MTUsers.net for other information on the list, as well as:
1) reading meditech-l messages online
2) job opportunities
3) vendor products and service


Do NOT send email to meditech...@MTUsers.com.  This is a system email box that is NOT monitored by a human. If you need help or advice on how to use the meditech-l, email  ju...@MTUsers.net.  Julia helps manage the meditech-l, so she is your best resource.

===***===***===***===***===***===***===



--
Charles J. Still, MBA, CPPS, CPHQ
Cha...@PatientSafeRx.com



--
Charles J. Still, MBA, CPPS, CPHQ
Cha...@PatientSafeRx.com

Charles Still

unread,
Dec 10, 2016, 7:28:27 AM12/10/16
to Brady, Tim, medit...@mtusers.com
Hello Tim;

You can create a simple Autoit script to open and maximize the screen.  You can further set it to monitor the window and re-maximize it if someone minimizes the screen.

Free tool
https://www.autoitscript.com/site/autoit/

I'll look and see if I have a copy of my monitoring script I created for Magic.  I used it for autologin and maximizing the ER tracker board and other functions.

Charles J. Still, MBA, CPPS, CPHQ
On Wed, Dec 7, 2016 at 4:28 PM, Brady, Tim <TBr...@mwph.org> wrote:
===###===###===###===###===###===###===
To unsubscribe from the meditech-l, follow the instructions at the URL http://mtusers.com/mailman/options/meditech-l_mtusers.com/

Please do NOT send messages that ask "Please post to the list" or "I'd like to see your answers" or "Send that info to me, too"  These are useless messages that just waste the email server's resources.  Instead, email the original requester and ask that they send you or post the results of their question.

Go to http://MTUsers.net for other information on the list, as well as:
1) reading meditech-l messages online
2) job opportunities
3) vendor products and service


Do NOT send email to meditech...@MTUsers.com.  This is a system email box that is NOT monitored by a human. If you need help or advice on how to use the meditech-l, email  ju...@MTUsers.net.  Julia helps manage the meditech-l, so she is your best resource.

===***===***===***===***===***===***===

Brady, Tim

unread,
Dec 10, 2016, 7:28:44 AM12/10/16
to Charles Still, medit...@mtusers.com

Thanks!  For the second argument, I replaced the double quotes with the keyword Nothing and that did the trick.  I will checkout that tool though.

Joel Otto

unread,
Dec 10, 2016, 8:58:29 PM12/10/16
to Brady, Tim, Meditech L (meditech-l@mtusers.com)
Hello Tim,

    Have you tried changing the program properties for meditech workstation to open maximized?

     I have attached a screen image illustrating where that is.

Sincerely,
Joel Otto
Meditech Consultant
otto...@gmail.com
60537608670

shortcutpropertiesrun.png
Reply all
Reply to author
Forward
0 new messages