WinEdt Macro Library  | macro previous macro 



This macro generates WinEdt macro code to call the MUI plug-in. Thus, it facilitates the creation of advanced dialogs a lot for macro writers. Note, however, that this macro creates code for the old, external MUI plug-in, not the new one that is built into WinEdt since version 5.5. If you intend to create an interface for WinEdt 5.5 or later, you should consider employing the new plug-in instead, even if cannot use this macro then.

The MUI plug-in is a great application to generate user friendly dialogs. However, to the macro writer, it is less friendly. If you've once tried it, you'll know that writing the underlying macro code is tiresome and error-prone. This macro tool facilitates macro programming for the MUI plug-in. It will generate all the code you would otherwise write yourself -- including register releases before, and the framework for evaluating the user's choices after running the MUI plug-in.

So, instead of programming in WinEdt's macro language, where you have to take care that you don't mix up delimiter levels, that you don't forget to release any registers before running the MUI plug-in, and where you have to double-check, when testing for a variable, that you take exactly the same option name as you chose in the MUI macro; -- instead of all this hassle, all you have to know now are some abbreviations (e.g. "C" for a Combo box), and a straight-forward syntax. You can concentrate on the contents of the MUI dialog, and don't have to bother about technicalities.

You'd write something like the following:

// this is the output file, i.e. the MUI input _F_ile:
F %b\Macros\macro\makeMUItest.mui
// This is the caption (_T_itle) of the MUI window:
T Global Options:
// This is its _W_idth:
W 300
// First, we write a _L_abel:
L These are the class options:
// This is a _C_ombo box called "Paper Size" (a4paper will be pre-selected):
C Paper Size
  letterpaper (11 x 8.5 inches)
  legalpaper (14 x 8.5 inches)
 !a4paper (297 x 210 mm)
  a5paper (210 x 148 mm)
// a _R_adio button called "Orientation" (Portrait will be pre-selected):
R Orientation
// a _X_eck box:
X Draft
// Finally, "--" marks the end of the MUI block.

Selecting this text and running makeMUI on it would transform it into the following macro code:

       'Prompt(''You do not have the MUI plug-in installed!%\Please get it from'',3,1);Exit;');");
// This is the output file, i.e. the MUI input _F_ile:
// This is the caption (_T_itle) of the MUI window:
WrL(`MUITitle("Global Options:");`);
// This is its _W_idth:
// First, we write a _L_abel:
WrL(`MUILabel("These are the class options:");`);
// This is a _C_ombo box called "Paper Size" (a4paper will be pre-selected):
WrL(`MUIComboBox("letterpaper (11 x 8.5 inches)|legalpaper (14 x 8.5 inches)|>
a4paper (297 x 210 mm)|a5paper (210 x 148 mm)",3);`);
// a _R_adio button called "Orientation" (Portrait will be pre-selected):
// a _X_eck box:
// Finally, "--" marks the end of the MUI block.
WinExe(``,`%$("MUIexe"); "%b\Macros\macro\makeMUItest.mui"`,`%p`,``,000100);
// => Orientation
// => Papersize
IfStr(`%$("MUIComboBox1");`,`letterpaper (11 x 8.5 inches)`,`=`,>
IfStr(`%$("MUIComboBox1");`,`legalpaper (14 x 8.5 inches)`,`=`,>
IfStr(`%$("MUIComboBox1");`,`a4paper (297 x 210 mm)`,`=`,>
IfStr(`%$("MUIComboBox1");`,`a5paper (210 x 148 mm)`,`=`,>
IfStr(`%$("MUICheckBox1");`,1,`=`, // => Draft <>

The complete list of abbreviations can be found at the end of the macro file.


  • You can change the two delimiters that should be used when generating the code
  • It is possible to append all lines with the concatenation character ">" (e.g., when you want to use the generated code inside a loop)


Put the macro in %b\Macros\macro\, and assign a shortcut to it if you want.



Macro contributed by Robert <>

WinEdt Macro Library  | macro previous macro