Creating menus

NMENU control commands and options

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.

EXEC
Executes a DOS or NetWare command following an ITEM statement.

SHOW
Displays a submenu from the same .DAT file.

LOAD
Calls and displays a menu as a submenu from a different .DAT file than the one you are running.

GETO
Requests information from the user before a menu item is executed. User input is optional. (See ``GETx (GETO, GETP, GETR)'').

GETP
Requests information from the user before a menu item is executed. User input is required for the program to proceed. Assigns a variable (%n) to the information so it can be used again. (See ``GETx (GETO, GETP, GETR)'').

GETR
Requests information from the user before a menu item is executed. User input is required for the program to proceed. (See ``GETx (GETO, GETP, GETR)'').

EXEC

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.

EXEC CALL
Runs a batch file and returns to NMENU. If you want to return to NMENU after a batch file executes, use this command to call batch files.

EXEC DOS
Runs the DOS command processor. If this command is used, the menu user must type ``EXIT'' when DOS processing is completed in order to return to NMENU.

EXEC EXIT
Exits the user from NMENU, but leaves the user logged in to NetWare. For security reasons, users cannot access the NetWare prompt unless this command is included in the menu.

EXEC LOGOUT
Exits the user from NMENU and logs the user out of the network, leaving the user at the DOS prompt. (See ``Setting up the user environment'').
EXEC must follow the ITEM to which it applies. It must also follow other control commands needed by ITEM.

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

LOAD

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

SHOW

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 3
   

ITEM Spreadsheets SHOW 5

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

GETx (GETO, GETP, GETR)

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

Replace prompt with the text (instructions) to be displayed to the user (40 characters maximum). For example: ``Enter your Password''.

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.


NOTE: Append does not work with GETP.

Following are some general guidelines on the use of the GETx commands.

For example:
© 1999 The Santa Cruz Operation, Inc. All rights reserved.
UnixWare 7 Release 7.1.1 - 5 November 1999