Adding custom items to the Analytics main menu

You can add custom items such as your own Analytics scripts, and frequently used commands, to the Analytics main menu. The custom items appear under the Applications menu. This capability is especially useful if you create scripts for others to use, and you want a single, easy-to-use location for accessing the scripts.

Project-level or global access

You can create custom menu items that are restricted to individual Analytics projects, or you can make the items available globally, whenever Analytics is open.

  • project-level access locate the text file (*.mnu) containing the custom menu items in the same folder as the Analytics project (*.acl)
  • global access locate the text file (*.mnu) containing the custom menu items in the same folder as the Analytics executable (ACLWin.exe)

You can also combine approaches, and create both project-level and global custom menu items.

Note

If you want other Analytics users to have the custom menu items, give them the *.mnu file with instructions about where to locate the file.

The configurable menu file (*.mnu)

You use one or more text files with a .mnu file extension to build your custom menu items.

Sub-menu entries

Each *.mnu file creates a separate sub-menu entry under the Applications menu. For example, Account scripts.mnu creates the Account scripts sub-menu entry and this menu structure: Applications > Account scripts.

Sub-menu entries appear in alphanumeric order on the Applications menu.

Custom menu items

Contained within each sub-menu entry are the individual custom menu items. For example, you might have two items that run the following scripts:

  • Accounts Payable Analysis

    (Applications > Account scripts > Accounts Payable Analysis)

  • Accounts Receivable Analysis

    (Applications > Account scripts > Accounts Receivable Analysis)

Custom menu items appear on sub-menus in the order that the items are listed in the *.mnu file.

Using one or more *.mnu files, you can build multi-level, cascading sub-menus to meet your requirements.

Tip

Users can become disoriented by too many sub-menu levels. A best practice is to limit sub-menu levels to three.

Maximum number of custom menu items

The Applications menu can contain a maximum of 179 custom menu items. The maximum applies to the total number of custom menu items across all sub-menu levels and all *.mnu files.

Menu file syntax

Note

The required syntax in the menu file must be specified precisely. Even a single extra space can cause Analytics to ignore the menu file and the custom menu items do not appear.

Follow the requirements below exactly.

Tip

Create or edit your menu files in a text editor such as Notepad++ with all non-printing characters displayed so that you can see exactly what characters are contained in the file.

Use a monospaced or fixed-width font so that individual characters align vertically.

A sample menu file, Template.mnu, is included in the Sample Data Files folder installed with Analytics.

  • Template.mnu creates the sub-menu entry Template in the Applications menu in Sample Project.acl, and in the three other sample Analytics projects contained in the Sample Data Files folder.
  • The Template sub-menu entry contains six custom menu items at the first level.
  • One of the first-level custom menu items, Margin Analysis, contains four custom menu items at the second level.
  • Most of the custom menu items in Template.mnu are simply placeholders to illustrate the concept of menu files.

The content of Template.mnu is reproduced below, with accompanying syntax requirements.

Content of Template.mnu

MAIN MENU                           6                                        .
Margins Analysis                    8 menu_def                               .
Inventory Analysis                  PAUSE 'SAMPLE INVENTORY ANALYSIS BATCH'  .
Accounts Payable Analysis           PAUSE 'LAUNCH YOUR A/P BATCH(ES)'        .
Accounts Receivable Analysis        PAUSE 'DO A/R BATCH(ES) HERE'            .
Internal Audit Functions            PAUSE 'SAMPLE INTERNAL AUDIT PROCESSES'  .
Quit ACL                            QUIT                                     .
                                                                             .
MARGINS ANALYSIS                    4                                        .
Exception Listing                   PAUSE 'DO Batch  where margin<=0'        .
High Margin Products                PAUSE 'Sample Batch top 5 margins'       .
Low Margin Products                 PAUSE 'Calculate lowest 5 margins'       .
Margin Statistics                   STATISTICS                               .

                                                                                                                                                                                             

Menu file syntax requirements

Property Requirement
Line length

Each line of the menu file must be exactly the same length.

Although not required, it is good practice to use a period (.) to visually mark the end of each line, immediately before the line break.

Line numbering

The lines in the menu file are counted from zero (0).

Keep this numbering scheme in mind whenever you specify line number references in the menu file syntax. If the text editor you are using displays and counts line numbers beginning at 1, you need to decrement the text editor line number by 1 when you specify menu file line number references.

In the example above, the Margins Analysis menu item appears on line 1, and the MARGINS ANALYSIS sub-menu syntax block appears on lines 8 through 12.

Blank lines

Blank lines can appear between syntax blocks but not within syntax blocks.

Blank lines, composed of space characters, must be the same length as the other lines in the menu file.

Although not required, one or more blank lines between syntax blocks provides visual separation in the menu file.

Syntax blocks

Syntax blocks define each group of custom menu items. You can use multiple syntax blocks to create multiple menu levels.

  • The left side of the block contains the names of the menu items, one per line. These are the names that appear on the menu in Analytics.
  • Names can be a maximum of 35 characters.
  • The right side of the block contains either an ACLScript command or a line reference to a lower-level block of syntax.
  • Lines on the right side of the block must all start at character position 37.
  • Use only space characters to align text elements. Do not use tab characters.

    Note

    Even one tab character in a menu file will cause the file to be ignored. Use a text editor that can display tab characters so you can check for their presence.

Block heading

Each syntax block begins with a single heading line.

The left side of the line contains the block identifier in uppercase and the right side contains the number of lines within the block.

In the example above, line 0 contains the block identifier MAIN MENU and specifies that there are 6 lines in the block. The heading line is not counted.

Block identifiers are optional. They keep syntax blocks organized within the menu file. They do not appear anywhere in the Analytics Applications menu structure.

If you omit a block identifier, the specified number of lines in the block must still start at character position 37.

Reference to a lower-level block of syntax

A reference from a menu item to a lower-level block of syntax takes the form num menu_def. num specifies the line number on which the lower-level block of syntax starts – that is, the heading line of the lower-level syntax block.

In the example above, line 1 contains the Margins Analysis menu item, which refers to the line on which the MARGINS ANALYSIS lower-level syntax block starts ( 8 menu_def ).

Custom menu items

Custom menu items can specify:

  • any valid ACLScript command
  • a line reference to a lower-level block of syntax

To create a custom menu item that runs an Analytics script, specify DO SCRIPT script_name. For example:

Calculate Median Value script       DO SCRIPT Calculate_Median_Value

Note

The script must be included in the Analytics project in which the custom menu item appears.

Short commands can be entered directly in the .mnu file. Longer commands with multiple parameters should be saved in a script, which can be referenced using the DO SCRIPT command.

Create or edit a menu file

The easiest way to create a menu file is to copy the Analytics sample menu file (Template.mnu) and then modify it.

Keep the following points in mind when you edit a menu file that is already in use:

  • Before you edit any menu file, make a backup copy of it.
  • If you add or remove lines, make sure to adjust any line number references appropriately.
  • Wherever possible, add new items at the end of the menu file in order to maintain the existing line references.
  1. Copy Template.mnu from the Analytics Sample Data Files folder to a working location.

    Caution

    Do not edit the original template file. If you run into problems you can recopy the original file and start again.

  2. Rename the copied file to something appropriate.

    The name you give the file becomes the name of the sub-menu entry on the Analytics Applications menu.

    Note

    If you are creating a menu file from scratch, change the file extension to .mnu.

  3. Open the renamed file in a text editor such as Notepad++ and edit it to build sub-menus and custom menu items.

    Follow the Menu file syntax requirements above exactly.

  4. Do one of the following:
    • Save the file in the folder containing the Analytics project in which you want the custom menu items to appear.
    • Save the file in the Analytics executable folder to make the custom menu items available in all Analytics projects opened on the computer.

    Tip

    You can create both project-level and global menu files, if required.

  5. Close and reopen Analytics to refresh the Applications menu.

    The sub-menu entry and the custom menu items should now be available in the Applications menu.

    If the sub-menu and the custom menu items do not appear, carefully check the content of your menu file against the syntax requirements above. Make all non-printable characters visible in the text editor you are using. An extra space at the end of a line, or a tab character anywhere in the menu file, causes the file to be ignored.