create-macro command

The create-macro BASIC program creates an executable macro from the last TCL command entered and places the macro in the master dictionary of the current account.

Syntax

create-macro macro.name{(options}

Parameter(s)

macro.name Name of the macro. If the macro name already exists, a message is given.
Note: The o option allows overwriting it.
options m Creates a pause and display type macro. When activated, the TCL command contained in the macro displays at the command prompt and can be modified before executing. Attribute 1 becomes an m.
Note: This option is default if no option is specified.
n Creates a nonstop macro, which executes immediately upon activation, without displaying the TCL command being issued by the macro. Attribute 1 becomes an n.
o Overwrites the macro if it already exists.

The macro is stored in the master dictionary and is executed by entering the macro name at the TCL prompt.

An m-type is the default when using create-macro.

During activation of the macro, any additional parameters following the macro name at the TCL prompt, are passed into the first executable command in the macro, but do not affect any other commands in the macro.

Any number of valid TCL commands may be placed in a macro. The first value of each attribute must be a valid TCL command. Subsequent values are treated as data to the command.

Note: D3 only allows macros to be placed in the master dictionary of an account.

Example(s)

If the last command on the stack was the AQL sentence:

list entity name phone

and the next command is:

create-macro show.entity (m

Assuming that the item is not already present, the message displays:

show.entity created

If the show.entity macro was present, the message displays:

[415] ’show.entity’ exists on file.

Executing Macros

Assuming that the show.entity macro is stored in the master dictionary, and is defined as shown in this example, below are various methods by which it may be executed:

  1. Execute the macro by itself and press ENTER:

    show.entity
    list entity name address
    

    The list entity name address displays on the next line at TCL, with the cursor under the l in list. Any aspect of the sentence may be modified prior to execution. The entire Update processor command set is available for modifying the command.

  2. Pass input from the command line:

    show.entity hdr-supp leg-supp
    list entity name address hdr-supp leg-supp
    

    Again, because this is a pause (m-type) macro, the TCL command displays prior to execution, with the hdr-supp and leg-supp modifiers appended to the command string.

An alternate example of passing input to the command:

show.entity with phone "714]" hdr-supp leg-supp
list entity name address with phone "714]" hdr-supp leg-supp

Again, any element that is valid with the first TCL command in the macro may be provided from the TCL command line. The input is only passed to the first valid TCL command within the macro.

Modifying Macros

Since show.entity is an m-type macro, to modify it, the item-ID must be referenced within quotation marks:

u md "show.entity"
md ’show.entity’ size = 46
01 M
02 list entity name address

At this point, the full complement of Update processor commands are available. Additional TCL commands can be placed on subsequent attributes. The m can be changed to an n to make it a nonstop macro, which means that it executes the first TCL command immediately upon activation. Since macro’s are executable, if the Update processor command CTRL+XR is used, the macro is filed and automatically executed.