DataCAD How-To's




HOW TO MAKE KEYBOARD MACROS

(For a Word 6-format version of this How-to,
click here to download)

Before covering the Icon Bar information you must first understand how to write a keyboard macro. Once accomplished, it is a short and easy jump to creating your own icon files and icon bars.

KEYBOARD MACROS

(See Our Current Keyboard Macro File)

One of the most powerful features of DataCad is it’s ability to be customized by the average user -- not just by programming jocks (no offense, jocks!). Keyboard macros are the shortcuts you use to access features and macros in DataCAD via the keyboard instead of via the mouse/menu combination. If used regularly you will find a marked improvement in speed and usability.

Any keystrokes you can make while in DCAD can be recreated for a macro. This makes DCAD’s keyboard and icon file macros VERY powerful.

The default keyboard macro file is located in your DCCAD directory in the \SUP subdirectory (i.e. - mine is in C:\DCADWIN\SUP). The file is called DCADWIN.MCR. Open this file with any ASCII text editor. I usually just use the Windows "Notepad" program. When finished, save the file before exiting.

CAUTION: Always make a backup copy of any DCAD files prior to editing them in case you make mistakes or want to reinstall the default files! Call it something like DCADWIN.MC1.

Below is roughly what you should see when you open the DCADWIN.MCR file.

A;^S5
B:^F4^F2
C;^F0
D:^F8^F1
E;^F6
F;^F9^F1
G:^F6
H:^F9
I;^S1
J;^F9^F5
K;^F8
L;^S7
M;^F4
N:^S6^F1
O:^S3^F8^S0
P:^S5
Q:^Ú^Û^F2^S2^F0^$^S0 (see notes beow)
R;^S4
S;^F5
T;^S6
U;^S8^S0
V;^S8^S9
W;^F9^F7
X:^F7
Y:^S7
Z:^F1

The first, capital letter of each line corresponds to the letter you will press (in combination with the ALT key) to accomplish a specific action. Everything that follows the letter tells DCad what do when these keys are pressed. The following are what some of these symbols mean:

; -- (semi-colon) go to DCad’s EDIT menu

: -- (colon) go to DCad’s UTILITY menu

^ -- (caret) a required separator between each command

Fx -- (where x is a number) corresponds to the appropriate Function key to press if you were "walking" through the DCad menus to execute a desired DCad function.

Sx -- (where x is a number) corresponds to the appropriate SHIFT-Function key to press if you were "walking" through the DCad menus to execute a desired DCad function.

Go To"Known Symbols and Commands" For List of Shortcut Codes

===================================================================================

Let’s take one of these as an example to see how it works:

O: ^S3^F8^S0

1. This keyboard macro will enable or turn On/Off Perpendicular Object Snapping.

2. The "O" means you would press the ALT and O keys together on the keyboard to invoke this macro.

3. The ":" means to go to the UTILITY menu (you can put a caret in front of it or not; it works either way).

4. The "S3" means you would press the SHIFT and F3 keys together (Object Snap).

5. The "F8" means you would press the F8 key (Perpendicular).

6. The "S0" means you would press the SHIFT and F10 keys together (Exit).

To see how it works, go into DCad and press the same keys as those shown in the macro (Utility menu, S3, F8, and S0).

You could alter this macro to turn On/Off Object Snapping by "End Point" instead of by "Perpendicular." All you would have to do is to substitute the "F8" with "F2", then save the DCAD.MCR file.

Keep in mind that you can edit the DCAD.MCR file while you are still in DataCAD. Click on FILEI/O in the UTILITY menu, then click on DOSShell. This will temporarily exit you from DataCAD and put you at the DOS prompt. Go to the /SUP directory and type EDIT DCAD.MCR. You can make your changes, save the file and exit the Edit program, putting you right back in DataCAD where you can now check to see if your changes to the DCAD.MCR file worked. This makes trouble-shooting your macros much easier than having to exit and re-enter DataCAD.

You can make up your own keyboard macros by just copying down the sequence of keys that DCad requires to run something. The trick is to get the correct keys in the correct sequence, and not forgetting simple things like placing a <return> ( $ ) or a space (for a Keyed-in Coordinate) where required.

Here’s a final example of a more complicated keyboard macro. It comes from Dale Weiss and was published as one of the "Best of Cheap Tricks" in the January 1997 Cheap Tricks newsletter. What it does is to automatically zoom you to your cursor location at a scale good for entering text. Place your cursor at the area you want to note, then execute the macro (in this case, ALT-A). When you finish with you text entry, hit P (previous view) and you’re back to your overall view.

Note that this macro assumes a default coordinate system of RELATIVE CARTESIAN. If your default coordinate system is something else, like relative polar, you would have to modify it to work with that type of input.

To see how it all works, go into DataCAD and press each key EXACTLY as you see it here, starting with the Window In ( / ) key.
 


Special Circumstances in Keyboard Macros

Because the Windows version of DataCAD uses standard Windows file dialogue boxes to select files, macros and templates, rather than menu buttons as in the old DOS version, there had to be another way to access different directories.

ACCESS TOOLBOX MACROS:

In the two examples above, notice 4 things:
    The ^M^ character tells DCAD to access a macro from the DCX file.

    The name of the macro must be followed by a "$" character.

    When selecting new paths the ^M^ character is still used, but in addition you must use the "\" (backslash) character to indicate the path to the file. In this case DCAD assumes that it should start in the directory that DCADWIN is installed in, so you don't have to add "C:\DCAD\..."

    For an icon .KEY file, everything from ^M^ to F7^ goes in the ACTION column. Omit the D since this is only for the keyboard shortcut.

ACCESS TEMPLATE FILES FROM AN ICON: In these 2 examples you should notice 4 things:
    The letter T is used to call a Template (.TPL) file.

    TPL\03-CONC is the path to the template you want.

    A comma (,) precedes the name of the template file (CONCRETE.TPL).

    In the second example the T: indicates the drive letter. There is a space between the T: and the path (TPL\03-CONC).

ACCESS TEMPLATE FILES FROM AN ICON: In the 2 examples above you should notice 4 things:
    The letter A in conjunction with the ^"^ (double quote) character is used to call a symbol directly (.SM3).

    The SYM\DWGSYMB\ is the path to the symbol.

    INTELEV.SM3 is the symbol this will access. In the .KEY file macro you access it by its name, with a "$" character at the end (INTELEV$).

    In the second example the S: indicates the drive letter. There is a space between the S: and the path (SYM\DWGSYMB\).