What is a macro?

 

As far as WinVNKey is concerned a macro is a sequence of one or more characters that triggers some predefined action.

In WinVNKey that action is usually to transform the macro sequence into another sequence of characters.  Thus a macro consists of two parts:

 

Macros are saved in 16-bit Unicode text files.  The general syntax for a macro is as follows:

macroname =expansion text

 

where the equal sign = must be preceded by at least a space and must be followed immediately by the replacement text.

 

For example, if you want to type sg and have WinVNKey expand it into Saigon, you should define a macro named "sg" with the replacement part to be Saigon as follows:

sg =Saigon

 

There are two types of macros based on how expansion takes place.

 

1) Auto-expansion macros

This type of  macros expands automatically as soon as what you type in matches with the macro name regardless of where the match begins in the typed word.

 

Example: Suppose you have defined  ug =ương  as an auto-expand macro. Now you can type "thug yêu" and get "thương yêu."  Note that the match occurs immediately after
"th", i.e., in the middle of a word.

 

There are two types of auto-expansion macros: level 1 and level 2.  The only difference is in the order of execution: level 1 is expanded before level 2.

 

2) Syllable macros  or Lazy Syllables

This type of macros represents Vietnamese syllables and is required to follow consonants that begin Vietnamese words.  The replacement occurs only if the resulting word is a legal Vietnamese word.

 

Example:  Suppose # is a syllable macro that expands into "ang".  Typing b# will expand into bang but typing z# will not because zang is not a legal Vietnamese word.

 

 

3) Word macros or Shorthands.

A macro of this type does not expand unless the first character of the macro name begins a new word and the last character ends a word.  This means expansion takes place when the following two conditions are met:

 

Example: Suppose you have defined  vn =Việt Nam  as a shorthand macro.  Then typing "Tôi yêu vn nhiều" displays "Tôi yêu Việt Nam nhiều."  But typing "WinVNKey" still displays "WinVNKey".   The sequence "vn" did not expand in the second example because it was in the middle of a word.

 

Note that shorthand macros also expand if they follow punctuation marks or parentheses.  For instance, typing "(vn ơi)"  expands into "(Việt Nam ơi)" because the first letter, v, follows the left parenthesis symbol and the last letter, n, is followed by a space.

 

Which types of macro is best for you?

 

1. Use shorthand macros if you want abbreviations for long phrases or sentences that are frequently used in your text, such as

xh =xã hội

qg =quốc gia

lhq =Liên Hiệp Quốc

ctvn =Chiến tranh Việt Nam

 

2. Use auto-expansion macros if you want automatic expansion such as in

nhửng =những

becuase =because

b|p =þ

 

3. Use lazy syllable macros to speed up typing frequently used syllables:

hjj   → hương

h(   → hoăc

 

In addition you can enable "Autochange letters" in each Vietnamese option page (Main control panel → Viet Option Page) to activate the quick syllables feature.  Quick syllables expand only if the result is consistent with the combination method in use.  For example, if the combination is to form correct Vietnamese word, quick syllables do not expand if the result would form an incorrect Vietnamese word.

Recommendations for accent mark macros on US keyboards

 

Because the US keyboard has a limited number of symbols for use in defining accent marks, you can follow certain rules so that you can define a large number of accented characters in a consistent way that is easy to remember.

 

  1. For accent marks choose symbols rarely used during text editing,  such as %, #, $, %, *, etc.  Choose the symbol that has the shape or meaning suggestive of the accent mark such as the following:

?! =¿   (inverted question mark,  ! forces the preceding character to turn upside down)

!! =¡    (inverted exclamation mark)

  1. If you are going to use only a few accented characters, use the one-symbol rule as in the examples above.

U~ =Ũ

U_~ = (capital letter U with tilde below)

 

(If you cannot see the true letter U with tilde below, you should upgrade to Times New Roman fonts version 2.95 released in Windows XP.)

 

 

  1. If the accent mark can appear above and below, consider preceding the symbol with an underscore to indicate the position below.

 

  1. If you are going to use a large number of accented characters, consider using two-symbol rules.

 

Examples:

A*o =Å  (A with ring above, * raises o to position above A )

N_5 =Ņ  (N with cedilla, _ lowers 5 to position under N )

a|e =æ  (small ligature ae, | forces a to absorb e horizontally)

h|- =ħ  (small letter h with stroke)

@|c =©

Y|= =¥

O|/ =Ø  (capital letter O with stroke)

T|M =

 

 

Next Topic:   How do macros work?

Last Topic:   Troubleshooting and tips