Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP 9000 Networking: Supervising the Network > Chapter 6 Creating Menus

Using the NMENU Commands

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

Menu programs use two types of commands: organizational and control. The following sections describe these commands and their options.

NMEN Organizational Commands and Options

Organizational commands establish the content and organization of the menus the user sees on the screen. Use these commands to determine what the menus look like.

Table 6-1 gives an overview of the organizational commands. Detailed information about each command follows the table.

Table 6-1 NMENU Organizational Commands

Command

Explanation

MENU

Marks the beginning of a new menu or submenu screen in the text.

ITEM

Identifies an item to be listed on the menu. Specifies execution parameters.

 

MENU

Indicates a new window definition within your menu file.

Command Format

MENU menu_number,menu_name

Replace menu_number with the number you want to assign to this menu. Menus are called and displayed by their number.

A menu number can be any number from 1 through 255. Each menu within a source file must be assigned a unique number, but the number sequence doesn't matter.

Replace menu_name with the title you want to appear at the top of the menu. Menu names can be a maximum of 40 characters long.

Using MENU

The first menu defined in the source file is always the first menu displayed, no matter what number is assigned to it. Subsequent menus are referenced by their numbers, no matter what order they appear in the .SRC file.

For example, if you have defined three menus and assigned them numbers 1, 2, and 5, and menu 5 is the first menu in the source file, menu 5 is displayed first. Menus 1 and 2 are referenced in control commands and displayed depending upon user selection.

Example

To define a main menu for a program to be used by accountants in your company, type a line similar to the following:

MENU 1,Accounting Main Menu

Since this is the first menu you want to appear, place it at the beginning of your menu program.

ITEM

Indicates an option in the menu.

Command Format

ITEM item_name {[option...]}

Replace item_name with the list item you want to appear in the menu. The maximum length for an item is 40 characters.

Replace option with one or more of the options shown in Table 22. Separate multiple options with a space. Enclose all options for a single ITEM within a single set of braces.

These options provide you with better control of menu execution. You determine how memory is used, which directory the user remains in, and what information is presented to those users.

Table 6-2 ITEM Command Options

ITEM option

Explanation

BATCH

Removes the menu program from memory before executing the item. Without this option, a portion of the memory stays resident, requiring approximately 32 KB of available memory, even though an application may be running. For example, if you type ITEM Word 5.0 {BATCH} the menu program is removed from memory when Word 5.0 is executed. Setting this option automatically sets the CHDIR option. Do not use this command with the EXEC DOS command; use EXEC CALL. For more information, see "EXEC" in this chapter.

CHDIR

When the word-processing application is closed, the directory is changed to the original directory for the menu. Changes back to the drive and directory that were in effect before an ITEM was executed. For example, to change back to the drive and directory the user was in before executing a word- processing application in another directory, type ITEM Word 5.0 {CHDIR}.

PAUSE

Allows users to read messages associated with a command being executed from the menu by pausing the screen display. The message "Press any key to continue" is also displayed, and the screen does not change until a user presses a key. For example, to display a message when a user selects the item "DOS Copy" from the menu, include this line: ITEM DOS Copy {PAUSE} When the copy function is complete, the display waits at the "Press any key..." prompt for a key to be pressed before returning to the menu.

SHOW

Displays the command name, such as COPY or DIR, in the upper left corner of the screen. For example, if you type ITEM Copy Files {SHOW} the DOS command COPY is displayed when the item is executed.

 

Using ITEM

List items appear on the menu in the same order as they appear in the source file. They are not displayed in alphabetical order.

Each item is automatically assigned an alphabetic selection character.

If you want to assign a different character, place a carat (^) and the character you want in front of the item name (no spaces).

NOTE: Forcing the selection character shortens the maximum line length to 38 characters.

If you assign any selection letters, you should assign a letter to all menu list items. Otherwise an item may be automatically assigned a letter you assigned previously.

Example

For example, if the first menu item is "Word Processing" and you want to assign it the letter "W" instead of the automatic letter designation of "A," type

ITEM ^WWord Processing

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.

Table 6-3 gives an overview of the control commands. Detailed information about each command follows the table.

Table 6-3 NMENU Control Commands

Command

Explanation

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)" in this chapter.)

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)" in this chapter.)

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)" in this chapter.)

 

EXEC

Instructs NMENU to perform the command that follows EXEC.

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 Table 6-4.

Table 6-4 EXEC Command Options

EXEC option

Explanation

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" in this chapter.)

 

Using EXEC

EXEC must follow the ITEM to which it applies. It must also follow other control commands needed by ITEM.

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

Instructs NMENU to execute a separate menu file.

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.

Using LOAD

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.

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

Instructs NMENU to execute a submenu defined within the same file.

Command Format

SHOW menu_number

Replace menu_number with the number of the submenu to be displayed.

Using SHOW

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.

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 { }.

Command Format

GETx prompt {prepend} length,[prefill], {append}

Replace x with the letter "O," "R," or "P."

  • If you want the user to decide whether to enter information, use GETO.

  • If you want to require the user to enter information (such as a password), use GETR.

  • If you want user input to be used by more than one EXEC command after it is entered, use GETP. The information is assigned a variable (such as %1, %2, etc.).

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. (See the GETx examples on the following page.)

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.

Using GETx Interactive Commands

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

  • You must define commands for each menu ITEM separately.

  • Enter commands between the ITEM and the EXEC command(s) associated with the ITEM.

  • Enter the commands in either uppercase or lowercase.

  • Limit each prompt to one line.

GETx Command Examples

  • Assume that you want to require users to enter a project code to keep track of work performed for that project. Type the following:

    GETR Please enter the project code: { } 08,, { }
    GETR Please enter your password: {} 08,, {}
    GETO Load default macros? { } 01,, { }
  • To get input for a program that calculates mortgages, using GETR, type

    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.

  • To create the previous program using GETP in place of other GET commands, type

    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
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1996 Hewlett-Packard Development Company, L.P.