I have now written my script (tchelp.btm) for quickly accessing my favorite help topics. I list them in a file with lines that look like this:
functionnames Functions by Name
The help keyword comes first (for coding convenience). Descriptions are aligned in a column farther right. There are blank lines for readability in the selection window. The whole thing can be seen below as it currently stands. It is very easy and quick to update.
That text file is read into an array variable using the EXECARRAY function call shown below. The environment variable %HelpChoices is set to the name of the file. The one-dimensional array variable "choices" is defined earlier with the proper size based on the number of lines in the file (stored in environment variable %lines).
%@execarray[choices,type %HelpChoices]
The choices are now displayed in a popup window using the SELECTARRAY function with the selection returned in a variable.
set choice=%@selectarray[choices,2,3,%@eval[1+%lines],75]
If a non-blank line was selected, the first word of the line is used as an argument for the HELP command (which I include as
*help
because I end up aliasing HELP to my script).
If the script is invoked with an argument, that argument is passed to the HELP command; otherwise the selection window is popped up.
Next, I defined an alias "help" that invokes the script (
alias help=batrun tchelp
). I have so many aliases that invoke scripts that I have an alias called "batrun" that handles the calling (
alias batrun=call c:\commands\bat\%@name[%1].btm %2$
).
Finally, I defined an auto-execute keyboard alias. I first tried defining F1, but then I lost the ability to press F1 after typing a command on the command line, so I used Alt-F1.
alias @@Alt-F1=^ehelp
(The leading caret-e represents the ESC key to clear the command line. Otherwise, the text "help" just gets added to the command line. If there were a character to force the cursor to the beginning of the line, then the alias could have that character followed by "help^s" instead, which would insert "help" and a space in front of the text already on the command line.
Here's what I see when I execute HELP with no argument.