Classic Analysis: Command Driven Analyses and Data Management

PAGE 8 of 10

View Table of Contents

How to Use User-Defined Commands

Run Saved Program

Command Reference

The Run Saved Program command in Classic Analysis transfers control to the second program returning to the first automatically, beginning with the line following the RUN statement. A program being run from another program is similar to an INCLUDE or subroutine in other systems.

 

Run Saved Program dialog

Figure 9.51: Run Saved Program

 

  • Filename indicates the database or text file containing the program. If the path or filename contains a space, it must be enclosed in double quotes. If the program to be run is in the current project, the path does not need to be supplied.
  • Program indicates the program name if it’s in the database.
  • OK accepts the current settings and data, and subsequently closes the form or window.
  • Cancel closes the dialog box without saving or executing a command.
  • Clear empties the fields so information can be re-entered.
  • Save Only saves the created code to the Program Editor, but does not run the code.
  • Help opens the Help topic associated with the module being used. (Currently Disabled).

Save and Open a Program (PGM)

Commands entered into Classic Analysis generate lines of code in the Program Editor and can be stored in the current data source (.mdb file or SQL server). Programs can be saved internally within the project or externally as a text file with a .pgm7 file extension. Saved programs that can be run as data are updated. Programs can be saved as text files, and shared without sharing data tables or projects.

Example of Code Created in the Program Editor

 

Program editor with an example of commands in use

Figure 9.52: Example Code in Program Editor

 

Save Code as a PGM

  1. From the Program Editor Navigation bar, click the Save Pgm icon. The Save Program dialog box opens.
    Save program dialog

    Figure 9.53: Save Program Dialog Box

     

  2. In the Program field, type a name for the program.
  3. In the Author field, type a name or initials.
  4. In the Comments field, type a description of the program.
  5. Click OK.
    • When code is saved, it is written to a special table in the current .mdb, called Programs.
    • A saved program can be executed with the RUNPGM command, or opened in the Program Editor.
    • From the Save Program dialog box, click Text File to save code to a text file.

 

Open and Run a Saved PGM

  1. From the Program Editor, select File > Open Pgm or click the Open Pgm icon. The Read Program dialog box opens.
    Open program dialog

    Figure 9.54: Read Program Dialog Box

     

  2. From the Program drop-down list, select a saved Pgm.
    • Information about the program automatically populates the open fields in the dialog box.
    • To open a program that was saved externally, click Text File to view all available .pgm files.
  3. Click OK. The program code opens in the Program Editor.
    • Code can now be run, edited, or saved.
  4. Click Run Commands. The Program Editor runs all the code listed and displays the results in the Output window.
    • To run individual commands, use the cursor to highlight the commands you want to run. Click Run Commands.

Execute File

Command Reference

This command executes a Windows program in Classic Analysis. You can either explicitly name the command (e.g., WinWord.exe) or one designated within the Windows registry as appropriate for a document with the named file extension (C:TempMyDocument.doc). This provides a mechanism for bringing up whatever word processor or browser is the default on a computer without first knowing its name.

If the pathname is a long filename, it must be surrounded in single quotes. If the command takes parameters, surround the command and the parameters with a single set of double quotes. Do not use single quotes.

 

Execute command dialog

Figure 9.55: Execute File Dialog Box

 

  • Filename is the file name, program name, or command to execute. Enter a path and program name for .EXE and .COM files along with any desired command line arguments.
  • Wait for command to execute indicates whether the program should run before or after the command is executed.
  • OK accepts the current settings and data, and subsequently closes the form or window.
  • Cancel closes the dialog box without saving or executing a command.
  • Clear empties the fields so information can be re-entered.
  • Save Only saves the created code to the Program Editor, but does not run the code.
  • Help opens the Help topic associated with the module being used. (Currently Disabled).

Syntax

EXECUTE <filename>  
EXECUTE <program-name>  
EXECUTE "<program-name><command-line parameters>"  
EXECUTE NOWAITFOREXIT <filename>  
EXECUTE NOWAITFOREXIT '<filename>'  
EXECUTE NOWAITFOREXIT "<filename>"  
EXECUTE WAITFOREXIT <filename>  
EXECUTE WAITFOREXIT '<filename>'  
EXECUTE WAITFOREXIT "<filename>"
  • The <program name> represents the path and program name for .exe (filename for registered Windows programs) and .com (any Internet address) files, along with any desired command line arguments. If a parameter is added, the whole string should be enclosed within double quotes.
  • If EXECUTE is run modally, permanent variables are written before the command is executed, and reloaded after it is executed.

Comments

If the given name is not a program, but a file with an extension (the three characters after the “.”) registered by Windows for displaying the document, the correct program to display the file will be activated (i.e., WRITEUP.DOC might cause Microsoft Word to run and load the file on one computer). Usually .TXT will run NOTEPAD.EXE or WORDPAD.EXE, and image files will appear either in a browser or graphics program. An .HTM file will bring up the default browser.

Example

EXECUTE "C:Epi_Info_7Enter.exe sample.prj:oswego"
EXECUTE "C:Epi_Info_7OUT120.htm"
EXECUTE "C:windowsnotepad.exe c:Test1.txt"