Creating Custom 2L Shortcuts (alias commands) for Visual Cadd

The icons, speed bars, pull-down and popup menus provide an interface that makes it easy to learn and use Visual Cadd.  However, many user prefer the productivity gains that can be accomplished by accessing the commands directly with two or three-letter keyboard commands.  Visual Cadd not only allows most commands and functions to be accessed through two or three-letter keyboard entry, but also allows you to create your own two or three-letter shortcuts or "aliases" for the native commands.  These aliases may be used directly by keyboard entry or in scripts.

When Visual Cadd is loaded, a text file called ALIAS.CMD is read into memory.  This file includes a list on all Visual Cadd "native" command names, each with its two-letter shortcut (if any).  When you type a two-letter shortcut, Visual Cadd checks the list of  aliases for a match.  It it finds one, then it executes the native command associated with that alias.  If there is no alias or native command name matching what you type, Visual Cadd ignores the input.

Native command names are longer than the alternative two or three-letter shortcuts (alias commands).  The "Enter" key is not required to end either alias or native commands, so alias commands are preferable for efficient keyboard entry.  However, because native commands are "hard coded" into Visual Cadd, they are preferable for use in scripts, especially if the scripts will be used by other users, who may have different two or three-letter shortcuts assigned.  This will also maintain compatability with any changes that you may make in the future with your own alias commands.

To customize the alias command names, load ALIAS.CMD into a text editor such as the Windows Notepad program, the DOS Edit program, or any word processor (using text mode).  Note that each line in the file starts with the currently assigned alias name followed by a comma, then the native command name.  For example:

PO,Point
L1,LineSingle
LI,LineCont
L2,LineDbl
RE,Rect2
R3,Rect3 

You may change the alias name to any two or three-letter text that you wish.  Make sure that these letters do not conflict with the starting letters of any other alias command name.  You can easily check this by using the search function in your text editor.

Creating your own Custom Commands

Visual Cadd also supports the definition of user-defined custom commands.  These commands are contained in the CMDEXT.DEF file located the the ....\Vcadd3\Programs\ directory.  The format for this file is as follows:

Command Name, Two-Letter Shortcut, Bitmap File, Menu Description, Status Line Description, Script;

Command Name
This is the internal command name for your custom command.  This can be used in .CST or .MNU files to place the custom command on a button or in a custom menu.  This should be a single word, 12 characters or less.

Two-Letter Shortcut
This is the two (or three) letter shortcut that will provide access to your custom command via the keyboard.  If the same two-letter alias is already defined in the ALIAS.CMD file, your new two-letter shortcut will have precedence, and the two-letter alias in the ALIAS.CMD will be ignored.  If using three letters, be aware that if another custom or native command uses the same first two letters, it will have precedence and your custom command will be ignored.  All two-letter shortcuts must start with a letter.

Bitmap File
This the path and name of the bitmap to be placed on the button if your custom command is placed on a toolbar.  See the Visual Cadd documentation for more information on customizing toolbars.

Menu Description
This specifies the text that will appear on a menu if your custom command is placed in a custom menu.  The "&" symbol placed before a letter designates that the letter will be the "Hot Key" or keyboard shortcut for that item on the menu.  This "Hot Key" will appear underlined.

Status Line Description
When you pass the cursor over commands on a menu or buttons on a toolbar, a description for that command appears in the status line.  Use this to describe your custom command or prompt for user information.

Script
This is the actual script that your custom command will perform.  All commands in the script must be separated by semi-colons ( ; ), including the end of the line.
 

Custom Command Examples

Note that the entries in CMDEXT.DEF before the script portion are separated by commas ( , ).  Commands within the script must be separated with semi-colons ( ; ) and the end of the line must have a semi-colon as well.  We do not have to use all of the entries before the script portion if they do not apply, but we do have to keep the comma ( , ) as a place holder.  Remarks can be included in the CMDEXT.DEF file by using a double-slash (//).  These can be used at the beginning of your line to "remark out" your custom command line for testing purposes, etc.

In this series of articles, we are using external programs which can be EXEs or DLLs.  Different Visual Cadd native commands are used in each specific type of external program.  For example:

//use "CA" 2-letter shortcut to load Windows calculator//
Calculator,CA,,,,EXENAME;C:\WINDOWS\CALC.EXE;RUN;

Custom Command Name: Calculator
2-Letter Shortcut: CA
Bitmap File, Menu Description, Status Line Description are not 	used, but commas ( , ) must remain as place holders
Script Native Commands:
EXENAME;  defines the name and path of the executable to be run
RUN;  executes the the program designated by the EXENAME command

To use a DLL, the entry for a custom command is similar, but different native commands are used.  For example:

//use "DF" for "ToggleFill" procedure in Sample01.dll//
GcDF,DF,,,,DllName;Sample01.dll;DllFunName;ToggleFill;DllRun; 

Custom Command Name: GcDF or whatever you would like to use
2-Letter Shortcut: DF or whatever suites your purposes
Bitmap File, Menu Description, and Status Line Description not used
Script Native Commands:
DLLNAME;  defines the name and path of the DLL to be loaded.  The path is not required if the DLL is located in the ....\Vcadd3\Programs\ directory, which is generally the case.
DLLFUNNAME;  defines the procedure within the specified DLL to be run
DLLRUN;  executes the DLL procedure defined by DLLFUNNAME:   

If you want the drawing to redraw after the fill is toggled, add  Regen; to the end of the line.  If you will be using the new command while another operation is being performed, replace DllRun with DllRunNested.


