
HiWIRE II's Custom Commands... menu item was intended to allow you to add your own menu items to the built-in menus of the HiWIRE executive, HW2.EXE. For reasons that will soon be obvious, this feature was never documented. Neverless, several "power" users have managed to infer most of what they need to expand and modify the Custom menu. Recently, a Wintek disk archeologist , exploring a deep subdirectory of a seldom-visited drive, uncovered an interesting document that should be of interest to anyone who wants to embellish HiWIRE's menus. The following is a translation of the original document (which appears to be written in an obscure dialect of Sanskrit with accompanying hieroglyphics).
HiWIRE used to include a multitude of small utility programs such as CHGLAYER.EXE, CHGPADS.EXE, CHGTRCS.EXE, and GETLAYER.EXE. These programs required a wide variety of idiosyncratic command-line parameters that controlled their operation. Many were simple filter programs which read a drawing, modified some small aspect of it, and wrote a modified version of the original drawing. By combining these simple filters (in sometimes complex ways), HiWIRE could automatically produce useful auxiliary drawings (e.g. for solder masks and power planes).
The functionality provided by the old utility programs has lately been replaced by DE scripts. The DE scripting language allows Wintek to distribute its filter programs in source form and allows you to modify their operation with your wits and your favorite text editor.
A design goal of the custom menu system was to provide a mechanism to gather up all the parameters (e.g., input files, output file, layer lists, etc.) required for some processing step, paste them together into a well-formed command line, and feed the result to DOS's COMMAND.COM for subsequent execution. Within this context, it was decided that each line on the Custom Commands... menu would correspond to the preparing and executing a single .COM, .EXE, or .BAT file. Thus if several .EXE's were required to perform a certain task, they would be combined into a single .BAT file that doled out the parameters as required by its subordinates.
When HW2 first loads, it reads a text file, CUSTOM.MNU. The directory that holds this file is specified by the HW2_USR= line in the setup data file; you can always find it in the parent directory of your projects. HW2 uses this file to construct the custom menu and any required submenus.
Typically, each significant line in CUSTOM.MNU begins with a keyword which is followed by a single parameter. Blank lines and lines that begin with # are ignored. The format of the menu file is:
title menutitle
command cmdline
file
perform execline
cd execpath
sd srchpath
prefix string
type prompt
default string
suffix string
:
prefix string
type prompt
default string
suffix string
:
where items in boldface appear literally in the file; items in italics represent the following items:
menutitle - the title of the custom menu. The title begins with the first non-blank character following title and continues through the end of the line. It must contain no more than 38 characters. This text will appear embedded in the bottom of the frame that surrounds the menu.
cmdline - the text of the menu item that will appear within the menu named by menutitle, described above. You'll select this item to display a command-specific submenu and to commence collecting the information required to construct the corresponding DOS command. The menu text starts with the first non-blank character and continues through the end of the line. It must contain no more than 38 characters. To specify a blank line (without an associated command), use a $ instead of a text string.
file - the name of the DOS command (.COM, .EXE, or .BAT file) that will be executed to carry out your wishes. If the name doesn't include a drive or directory, COMMAND.COM will search the directories specified by the PATH environment variable.
execline - the submenu text for the item you choose after providing all required information to actually execute the command. Most commands require HW2 to gather addtional information using one or more submenus. The text specified by execline appears on the first submenu. Selecting this item signifies you have entered and approved all the required information. Like other menu text, it starts with the first non-blank character and continues through the end of the line; it must contain no more than 38 characters.
execpath - the DOS drive and directory where the command, file, will execute. Before executing the command, HiWIRE will change to the specified directory, then execute the command, and finally restore the working directory. When cd execpath is not present, execution is in the current project directory.
srchpath - the DOS drive and directory where the HW2 will search for any input files required by the command, file. If sd srchpath is not present, the current project directory is assumed (except for input.lib and input.prj, described below).
prefix - either prefix or prefix.space. This keyword specifies some boilerplate text string which should be prepended to a parameter. The text starts with the first non-blank character following the keyword and continues to the end of the line. If prefix.space is used, a blank is inserted between the prepended text and the parameter that follows. This line may be omitted if no prefix is required.
type - the parameter type. From this keyword, HW2 devises a strategy to obtain the desired information for the parameter. The form of this keyword is either: input.X (to select an input file of type X), output.X (to specify an output file of type X), or generic (to prompt for any other types of parameter). Allowable file types for .X are: .dir (for an AN/AR/RN directive file), .dwg (for a generic drawing file), .fil (for any file or directory, valid only for input), .hnl (for a HiWIRE netlist), .lib (for a library), .pcb (for a circuit board), .phx (for an HWX-format PCB file), .prj (for a project directory), .sch (for a schematic drawing), or .shx (for an HWX-format schematic drawing). NOTE: Everything but .prj and .fil correspond to the standard HiWIRE file extensions. Unless an sd srchpath specifies otherwise, HiWIRE looks for input.lib files in HW2_LIB directory, input.prj directories in the HW2_USR directory, and all other input files in the current project directory.
prompt - text of submenu item that initiates a file selection process. For input.X , HiWIRE displays all the files of the desired type and allows you to select one with the mouse. For output.X and generic, HiWIRE reuses the menu text to prompt you to type in a file name or some other parameter. The menu text starts with the first non-blank character and continues through the end of the line. It must contain no more than 38 characters.
suffix - either suffix or suffix.space. This keyword specifies boilerplate text to append to the parameter. The text starts with the first non-blank character following the keyword and continues to the end of the line. If suffix.space is used, a blank is inserted between the parameter and the appended text. This line may be omitted if no suffix is required.
string - default answer, prefix and suffix strings. These strings start with the first non-blank character following their keyword and continue through the end of the line; they may contain blanks.
When type is enclosed in square brackets (e.g., [input.pcb]), the corresponding argument is optional and the command can be executed without specifying the corresponding value. If the []'s are omitted, HiWIRE will insist that you to enter or select something before the command can be executed.
For output.X and generic, HiWIRE can provide a default answer to keep you from having to type in the most common answer. If you omit the default string line, no default answer will be presented. For output.X, HiWIRE enforces the file extension specified by .X.
To summarize, each item in a custom menu requires a 3-line command/file/perform specification. This initial 3-line sequence is followed by as many 1- to 4-line prefix/type/default/suffix sequences as are required to construct the additional invocation-line parameters required by the command.
An Example: Adding a New Command
If anything in the preceding description seemed remotely interesting, you should now be crying for an example. In this case, your first step should be to print out CUSTOM.MNU and examine it in detail. With the printout and the description provided above, you should eventually be able to understand the purpose of each line in the file.
Before you make changes, you should know many of the documented features were only tested sufficiently to confirm their operation with Wintek's custom menu. During preparation of the example, slight perterbations (allowable according to the documentation) lead to some unexpected results. Don't modfiy the Wintek-supplied file unless you have a true sense of adventure. Ride 'em cowboy!
Suppose we want to add a command to extract a netlist from a printed-circuit board. We know that on the DOS command line to extract a netlist, my.hnl, from a 4-(signal) layer circuit-board drawing, my.pcb, we would type:
an -4 -p -omy.hnl my.pcb
That is, we want to run the program AN.EXE (an) to analyze four signal layers (-4) using the connectivity rules for circuit boards (-p). We want to emit a HiWIRE netlist file (my.hnl) that we extract from our circuit-board (my.pcb). Below are the sequence of lines we could add to automate this process:
:
# Extract a netist from a printed circuit board
command Extract PCB netlist
an
perform Generate netlist now
prefix -
generic Number of signal layers
default 2
prefix -p -o
output.hnl PCB netlist file
input.pcb Select PCB to netlist
# Blank line
command $
The first and penultimate lines are comments. They begin with # and so are ignored. The second line specifies the menu item that will be added to the custom menu. The last line inserts an empty item in the menu to separate our new command from the Return to Main menu item. The remainder of the lines define the command-specific submenu:
Notice the elipsis (...) is provided by HiWIRE. It is not included in the prompt. Although [generic] specifies an optional argument (AN.EXE assumes 2 layers), use of the brackets is redundant here since a default answer (2) is provided.
A Final Rumor
An anonymous source was heard to to say that file can not only specify a .COM, .EXE or .BAT file, but also can specify another .MNU file. (A dummy perform line may also be required.) Selecting the menu item specified by file's associated command line evokes a whole new submenu. Thus the custom menu system can be expanded ad infinitum (or maybe ad nauseum?).
If you have questions, comments, or would like to request further
information and a demonstration diskette (either 3.5" or
5.25"), please e-mail
Wintek.