Control commands tell NMENU how to perform an action, such as displaying a submenu or user prompt, performing a DOS function, or starting an application. You also use these commands to tell the menu program how to process information and execute commands.
The following list gives an overview of the control commands. Detailed information about each command follows the list.
The EXEC command instructs NMENU to perform the
command that follows EXEC. It has the following command format:
EXEC command
Replace command with the command required to execute the ITEM. This could be the name of an executable file, a DOS or NetWare command, or one of the options associated with EXEC. The EXEC options are described in the following list.
For example, to load Word®5.0 from a menu, include in the menu file the two following lines:
ITEM Word 5.0 EXEC Word5
The LOAD command instructs NMENU to execute a
separate menu file. It has the following command format:
LOAD filename
Replace filename with the name of another NMENU program.
If you have several menu programs created with the .DAT extension, use this command to call another menu program from the active menu program. LOAD always calls menus by their filename, not by number.
Use this command when you have multiple menu programs defined. Although you can define up to 255 menus per source file, smaller separate files are easier to manage and update.
The NMENU file being loaded must be in the current directory, or you must have a search path to the file defined.
For example, if you are writing a menu program for Sales and you want to call up the Accounting menu program, type
MENU 1,Sales Main Menu ITEM Accounting Menu LOAD ACCOUNT
The SHOW command instructs NMENU to execute a
submenu defined within the same file. It has the following command
format:
SHOW menu_number
Replace menu_number with the number of the submenu to be displayed.
Include SHOW commands to identify the submenu to be displayed when an item is selected from a menu.
SHOW commands always use menu numbers, not titles.
For example, if you have a menu with items listing categories of applications such as ``Word Processing'' and ``Spreadsheets'', each ITEM has the following SHOW commands to call up the appropriate submenus for those categories:
ITEM Word Processing SHOW 3To continue this example, if menu 3, ``Word Processing'' is a list of available word processing programs needed by both Sales and Accounting, and each group has its own menus defined, the programs can ``share'' that screen and the screen's calls to execute the applications.ITEM Spreadsheets SHOW 5
The GETx commands provide access to user input. You can request or require user input. You can even store user input for future use. Each variation of the GETx command uses the same parameters to control what the user sees and does. Pay close attention to the use of spaces, commas, and braces ({}).
GETx has the following command format:
GETx prompt {prepend} length,[prefill], {append}
Replace x with the letter ``O'',``R'', or ``P''.
prepend is a value added to the beginning of the user response. A space is usually required in the first GETx command to separate it from the command issued in its associated EXEC command.
Replace length with the maximum number of characters the user can enter. This parameter is required. For example, if you use GETR for a phone number, limit the length to 11 characters to match the field length for the phone number. Or if you want a state or country abbreviation entered, limit the length to two characters.
Replace prefill with a default response displayed with the prompt. The user can accept the default, change the response by typing over the default, or cancel selection of the item. prefill cannot be longer than the specified length.
The prefill parameter is optional. If you do not want to include a default response, enter the two commas together.
append is the value added to the end of the user response. If no value is needed, enter braces with a blank space between them.
Following are some general guidelines on the use of the GETx commands.
GETR Please enter the project code: { } 08,, { }
GETR Please enter your password: {} 08,, {}
GETO Load default macros? { } 01,, { }
GETR Enter the loan amount: { } 7,,{ }
GETR Enter the interest rate: { } 5,8.5, { }
GETO Enter the period (/m=months or /y=years):+ { } 7,/y=30, { }
EXEC mortgage
The input values are appended to the ``EXEC mortgage'' command before
it is executed.
GETP Enter the loan amount: { } 7,,{ }
GETP Enter the interest rate: { } 5,8.5, { }
GETP Optional-Enter the period (/m=months or+ /y=years): { } 7,/y=30, { }
EXEC echo %1
EXEC echo %2
EXEC echo %3
EXEC mortgage %1 %2 %3
EXEC pause