7. The 'TCL Macros' menu



Since TCL-NT is a macro interpreter, it allows the creation and execution of user defined macros.
The single commands are described in the TCL-commands help

The 'TCL Macros' menu


7.1 Edit macro

The 'Edit macro' submenu first opens a file selector where you can chose an existing macro or create a new file just by typing the new filename in the 'File name' edit field:

The file selector to open a TCL-NT macro

Hint: the directory where the file selector looks for macros is defined in the 'Change Configuration ...' submenu.

Button: you can also activate the 'Edit macro' window with in the toolbar.

When you have selected a file, the system editor is opened to edit the macro:

The Notepad editor with a little user macro

When your work with the macro code is finished, save the file and execute the macro.



7.2 Exe macro

The 'Exe macro' submenu first opens a file selector where you can chose a macro for execution. If the macro is selected, you are asked for the parameters (if there are no parameters just leave the editfield blank). After that the macro is executed:

Enter the parameters of a macro

Button: you can also activate the 'Exe macro' window with in the toolbar.



7.3 Macro commands

Within the macro you can use all legal TCL commands plus the so-called program flow commands like if-then-else-endif or while-endwhile. There is one command specially created for the use in macros. It is called EMMENU31. EMMENU31 opens either an input dialog box or an output dialog box. The syntax is:
EMMENU31/input=format text_out text_var_in return_value
or
EMMENU31/output text_out return_value

where
format is either "string", "int", "long", "float" or "hex"
text_out is the output text that appears in the dialog box
text_var_in is a variable of type string to hold the user input and
return_value is a variable of type int or long to hold the funcions return code.

If EMMENU31 is called with option /input, the user data is checked against the specified type of input ( "string","int", etc. ). If the user input does not match the requrements, the return value in return_value is -2. Anyway the user input is returned in the string variable text_var_in. It is up to the macro code to extract the desired data from the string ( e.g. with command read/instring=... ).
A return value of -1 indicates that the user cancelled or closed the dialog, a return value of 0 indicates that the user clicked OK.




© TVIPS GmbH 1998, 1999, 2000

Last update: