IPeople Blog

How can I use the NPR Report Writer to launch Windows applications from MEDITECH CS?

Written by Gary | Apr 25, 2022 5:00:00 AM

There are two NPR Macros that can either launch a PC-based executable or automatically open a file with the correct executable: 

  1. @Shell.execute(UNCName)
    If [UNCName] points to an executable, such as Notepad.exe, the executable is invoked.  If [UNCName] points to a document, such as ABC.TXT, the associated program is executed and the document given as the in-line argument.  So, if Notepad is associated with '.TXT' extension files, this command is equivalent to running NOTEPAD.EXE ABC.TXT.  If no association exists for the document type, Windows displays the Open With dialog in an attempt to resolve the problem.
  2.     @Call.windows(pathCommandTail,windowShowCalledWin,windowShowCallingWin,modailty)

[pathCommandTail]

The complete path to the specified program.  Include '.EXE' (or whatever extension) on the program name.  Anything after the initial <SPACE> will be passed to the new procedure as command-tail arguments.

[windowShow]

The value of this argument is passed directly to Windows as the ShowWindow state.

            1=Normal

            2=Minimize

            3=Maximize

            4=Normal but not active

            5=(don't use)

            6=Minimize

            7=Minimize but do not activate

            8=Show but do not activate

            9=Restore

[modality]

0=Asynchronous (the function returns immediately, with the new window either active or not, depending on the [windowShow] parameter; if the new window is Active, MagicCS will not actually run until MagicCS becomes the active window).

>0=Synchronous  (the function does not return until the user explicitly terminates the process created with this command, regardless of whether or not MagicCS becomes the active window)

Please let me know if you have any further questions about using these NPR Macros.