How do macros work?

You may want to familiarize yourself with this technical section to use WinVNKey at ease.

 

All WinVNKey macros are 16-bit Unicode characters stored in disk files with extension either in lower case ".txt" or upper case ".TXT", depending on whether the macro file is disabled or enabled, respectively.  These files are readable with Unicode editors such as Microsoft Word 2000 or later, or  Notepad and Wordpad that come with Windows 2000 or later.

 

WinVNKey currently supports five types of macros: foreign characters, auto expansion level 1, auto expansion level 2, shorthands, and remap. All macro files of the same type are collected in the same directory under <INSTALLATION DIR>\Macros, where <INSTALLATION DIR> is the directory specified during WinVNKey installation. The default installation directory is "C:\Program Files\Vietnam\WinVNKey."

 

Specifically, the three macro types are stored in the following predefined subdirectories:

 

1. <INSTALLATION DIR>\Macros\Language

2. <INSTALLATION DIR>\Macros\AutoExp1

3. <INSTALLATION DIR>\Macros\AutoExp2

4. <INSTALLATION DIR>\Macros\Syllable

5. <INSTALLATION DIR>\Macros\Shorthand

6. <INSTALLATION DIR>\Macros\Remap

 

There is no limit on the number of macro files in each subdirectory.  Only files with extension txt or TXT are considered macro files, which must follow certain syntax rules.   The txt/TXT extension was chosen so that macro files can be opened with Notepad simply by a double click, transparent to the users.  Therefore, you should not name any non-macro  file with extension txt or TXT.   In general you should stay away from the Macros directory tree.

 

Syntax:

All macro files have the same syntax, which is summarized at the beginning of each file.  There are four types of lines that can appear in a mcro file.

 

  1. Comment lines

  1. Keyword lines: used internally by WinVNKey only.

  2. macro definition lines

  3. macro continuation lines

 

It is best illustrated with an example.  The following is the contents of  the language macro file named "Norwegian.txt" in the directory <INSTALLATION DIR>\Macros\Language

 

; Comment lines are either blank or starting with "; " (semicolon in

;    column 1 and a space in column 2)

; Keyword lines start with ". " (a period in col 1 and a space in col 2)

; The file header is terminated with a line beginning with ";xxx"

; Macro definition is of the form "macroname =replacement text"

;   There must be a space between the macroname and the equal sign.

;   Everything to the left of this space belongs to the macroname.

;   The replacement text begins immediately after '=' and can continue on

;   several lines. Each continuation line must start with "& " (ampersand

;   in col 1 and space in col 2).

;   The continuation feature is not supported in format 1 yet.

;xxxxxxxxxxxxxxx Don't delete this line!!! xxxxxxxxxxxxxxxxx

a0  =å

a|e =æ

o|/ =ø

A0  =Å

A|E =Æ

O|/ =Ø

 

For your purposes you should ignore these lines:

 

All other lines define macros.  The general syntax for a macro is

 

macroname =expansion text

 

where the equal sign = must be preceded by at least a space and  the replacement text must follow =  immediately.  The space immediately before = is required but is discarded from the macroname.  Other spaces before this space are significant and are part of macroname.

 

At this point you should be able to edit any macros file.  You can use the Edit Macro dialog from WinVNKey, or just edit the file directly with Word/Notepad/Wordpad 2000 or later and save it in Unicode text format. It should be reminded that WinVNKey changes the filename extension to upper case or lower case dynamically depending on whether the macro file is enabled or disabled in the user interface, respectively.

 

 

Next Topic:   Order of macro evaluation

Last Topic:   What is a macro?