In WinVNKey that action is usually to transform the macro sequence into another sequence of characters. Thus a macro consists of two parts:
the first part, called macro name, is what you type in. It can be as long as 255 characters and can have spaces in between but no leading nor trailing spaces.
the second part, called macro replacement or expansion, is what you actually see on screen. The replacement can be as long as 4096 characters; it can contain anything, even leading and trailing spaces.
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.
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.
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:
the first character begins of a word, or follows a space, tab, carriage return, linefeed, or punctuation mark or symbol.
the last character ends a word, or is followed by a space, tab, carriage return, linefeed, or punctuation mark or symbol.
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
auto-correction of typo errors, e.g.
nhửng =những
becuase =because
converting special sequences to foreign characters or symbols not available on your keyboard, e.g.
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.
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.
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:
^ for the circumflex: u^ =û
< for the caron (inverted circumflex): E< =Ě
% for the diaeresis (double dot above) because % has two little circles that resemble two dots: E% =Ë
5 for cedilla because the cedilla stroke looks like a cursory number 5. But be careful, if you use the VNI typing method where 5 is defined as a Vietnamese dot-below tonemark, you will not get a cedilla by typing a5 because the Vietnamese tonemark is combined first. See "Order of macro evaluation." Perhaps it is better to use _5 for cedilla as described in item 4 below.
Use the exclamation mark ! to indicate the base character is inverted upside down or flipped left right. For instance,
?! =¿ (inverted question mark, ! forces the preceding character to turn upside down)
!! =¡ (inverted exclamation mark)
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.)
If the accent mark can appear above and below, consider preceding the symbol with an underscore to indicate the position below.
If you are going to use a large number of accented characters, consider using two-symbol rules.
The first symbol indicates the location of the mark (the mark is overhead, underneath, or side by side).
Use an asterisk * to indicate overhead location. The ^ symbol is ideal for this purpose but it has been used for the circumflex accent.
Use an underscore _ to indicate underneath location.
Use a vertical bar | to indicate side-by-side location.
The second symbol represents the accent mark.
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 =™