Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4D - Macros part II
Published On: March 28, 2003
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Since the macros that are created for us along with the new macros that will be created are saved in an XML file, it is a good idea to take a look at the XML format of a macro. 4D macros are built using customized XML tags called "elements". Each start tag of an element must have an ending tag. A start tag is represented by <tag>, an ending tag looks like </tag>, however <tag/> is both a start and end tag.

The basic requirement of a macro is defined in the sample macro below:

<macro name="">


An example macro using the basis requirements:

<macro name="Macro_ForLoop">
<text> For($i;1;Records in selection(<Caret/>))

End for

Here are the descriptions of the 4D Macro tags.

<macros> </macros>
Initializes and ends a macro file. This tag is required in a macro file.

<macro> </macro>
Defines a single macro and its attributes.

This tag is replaced by the selected text when the macro is inserted. If no text is
selected, then the tag is empty.

<text> </text>
This tag will encapsulate what you want the macro to place in your method.
The contents can be either comments, or 4D commands.

After the macro has been inserted, the cursor returns to this position.

The current 4D user is returned in this position

The current system user name is returned in this position.

The current method name is returned in this position

The current date is returned in this position

The current time is returned in this position.

The contents of the clipboard is returned in this position