#### Example - Using the External Command to Display a File

This example shows how to create a batch file (an external program) that works with the EXTERNALCOMMAND to open and display a file. For example, suppose you want to display an image file, but you don't want to use the Insert | Report Command | External Object menu option, you can use a command-line (or DOS) prompt inside of a batch file to do this.

Note: The advantage or disadvantage (depending on your needs) to this approach is that the image will not appear in the report at the end of part program execution.

First, create a batch file to display the image:

1. Open a text editor, such as Notepad, and on the first line put in this command:

start <PATHWAY>

where <PATHWAY> is the complete pathway to the picture (for example, start d:\temp\mypart.gif).

This command tells Windows to open the image file using its default image viewer application.

2. Save the file and give it a .bat filename extension.

Second, link the External Command dialog box to the batch file:

1. Select Insert | External Command. The External Command dialog box appears.

2. Click the ... button. An Open dialog box appears.

3. Under Files of Type list at the bottom of the Open dialog box, change the type to BAT Files (*.bat).

4. Navigate to and select your batch file.

5. Click the Open button. The Open dialog closes, and the External Command dialog box now contains the pathway to the batch (.bat) file.

Third, control what happens, and insert the command:

1. Choose either to display or not display a message that pauses the execution of the part program by selecting the Display or the No Display option from the External Command dialog box.

2. Ensure that the Link check box is cleared.

3. Click OK and the EXTERNALCOMMAND gets inserted into the Edit window.
   EXTERNALCOMMAND/DISPLAY ; E:\BATCH\TEST.BAT

Fourth, execute the program:

1. Mark the resulting command line in the Edit window.

2. Execute your part program.

3. PC-DMIS will run the specified batch program, displaying the picture and, depending on what you selected on the External Command dialog box, will either pause or continue the part program while you view the picture.