November 3, 2021

Using Command-Line Arguments for Magic Systems

Command-Line Arguments can be passed in with your call to the Meditech Remote Workstation.  These Command-Line Arguments can
then be parsed out.

This example will demonstrate how to create your own sign-on Program using an NPR Report Macro.  This Macro will parse out the Command-Line Arguments.  If there are no Command-Line Arguments, then the usual Meditech sign-on Program will be used.  If there are Command-Line Arguments, then PCI will be launched for whichever patient is included in the Command-Line Arguments.  This sort of Sign-On Program can make it possible for another vendor to link automatically to Meditech's PCI from their own software.

The usual Command-Line executed when accessing the Meditech Remote Workstation is:

C:\Program Files\MEDITECH\Workstation3.x\Client.mtad

The Arguments we will be adding will change this Command-Line to appear like this:

C:\Program Files\MEDITECH\Workstation3.x\Client.mtad MIS|UNIT.NUM|USER|FACILITY

There are four Arguments added to the end of the Command-Line.  There is a blank space after the original Command-Line.  The four Arguments are separated by the "pipe" character.  Those Arguments are the mnemonic of the Meditech MIS (MIS), the Patient Unit Number (UNIT.NUM), the MIS User mnemonic (USER), and the MIS Facility mnemonic (FAC).

Here is how the Command-Line would appear with the following Arguments:

MIS                    ARL5.61
UNIT.NUM    M000000305
USER                 SHIJO
FAC                    ARL

C:\Program Files\MEDITECH\Workstation3.x\Client.mtad ARL5.61|M000000305|SHIJO|ARL

Here are the steps for creating an NPR Report Macro to parse out the Command-Line Arguments and launch PCI:

1) Create an NPR Report with Report DPM Z and Report Name

2) Add any Report Title you like and set the Active Field to Y, and then File and Translate your Report.

3) Add a Report Macro called signon with the following code:




DO{># #S},D(31,0,0,192)^#,E(#T[1])^V=2_.=.


D(30)_"CT"^#,E(#T[1])^L,IF{L>0 #T[L]^CMDTL},


4) File and Translate the Report Macro.

5) Add your Report Macro as the Sign On Program in OPS for whichever device you like.  

          The Pgm? prompt will be answered with

So if the Command-Line Arguments are included, then the user will automatically be brought into PCI.  Otherwise, the regular MEDITEH sign-on Program will be used.

Topics: MEDITECH, Report Writing, NPR Report, CS System

You Might Also Enjoy

Create an NPR Report to produce a downloaded file and add the following Footnote:    AL ...

You can send emails from a CDS in CS but you must have the Meditech Parameters set up to ...

The Footnote FD (Field Delimiter) requires you to enter the ASCII code for a keystroke.  ...

You can modify your report so that everything that prints is sent to your Windows ...

Users can attach "Icons" from the NPR.ICON dictionary to "Desktop" style menus for the ...