core

#### 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.

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 measurement routine execution.

Step 1: Create a batch file to display the image:

1. Open a text editor, such as Notepad. On the first line, enter this command:

start <PATHWAY>

where <PATHWAY> is the complete path 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.

Step 2: 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 path to the batch (.bat) file.

Step 3: Control what happens, and insert the command:

1. Choose either to display or not display a message that pauses the execution of the measurement routine. See "Display Check Box" for more information.

- Select the Display check box from the External Command dialog box to display a message.

- Clear the Display check box from the External Command dialog box to not display a message. When not checked, the Wait option becomes enabled. See "Wait Check Box" topic for more information.

2. Ensure that the Link check box is cleared.

3. Click OK. The EXTERNALCOMMAND gets inserted into the Edit window.

EXTERNALCOMMAND/DISPLAY ; E:\BATCH\TEST.BAT

Step 4: Execute the routine:

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

2. Execute your measurement routine.

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