To create a NPR report that will launch a specified Windows application, follow the steps listed below:
Step 1: Create an NPR Report called Z.zcus.launch.app
Step 2: Create a macro called ‘shell’ with the following code:
IF{/ALREADY.RAN;
@INIT,
IF{PGM @W.display("Launching Microsoft Word..."),
@SHELL.APP,
@W.display("")}};
INIT
1^/ALREADY.RAN,
IF{0=A ""^A},
1^/Z.SCHED.LOG,
1^/R.HOLD.PRT,
1^/Z.RPT.SUPPRESS.DIALOG,
1^/R.NO.PRT.MSGS,
1^/R.FRAGMENT,
%Z.printer.close.px(""),
IF{A;/.MENU.ARG|0;""}^PGM
SHELL.APP
%Z.link.to.shell(PGM)
Step 3: Create a macro called ‘closeup’ with the following code. This is used for cleanup:
""^/ALREADY.RAN,
IF{/.MENU.ARG|0 KILL[""](/.MENU.ARG)}
Step 4: Move to Page 1 of the report and set the Report Title field to the name of the ‘shell’ macro using the following syntax:
"_%Z.zcus.ip.launch.app.M.shell(0)_"
Step 5: Call the ‘closeup’ macro in a footnote at CLOSE.UP
Step 6: Create a custom menu for launching the NPR Report
Step 7: Set the routine to the name of the NPR Report. In the Arguments? field, specify the path and filename of the application to launch.
Additional Comments:
By utilizing temporary variables, you can pass information regarding the current user or current patient to other applications:
Variable Description
/[“.USR”] Contains the current user mnemonic
/[“..LAST.ACCT.NUM”] If accessing a patient, this contains the current account number
/[“..LAST.UNIT.NUM”] If accessing a patient, this contains the current medical record number