tcl.create-macro Verb: Access/TCL


Command tcl.create-macro Verb: Access/TCL
Applicable release versions: AP
Category TCL (746)
Description creates an executable "macro" from the last TCL command entered and places the macro in the md of the current account.

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

If attribute 1 of the macro is an "m", the must be enclosed in quotes when referenced from TCL. An "m" type is the default when using "create-macro".

If the already exists, a proper message will be given. The (O) option allows overwriting it.

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.

Advanced Pick only allows macro's to be placed in the md of an account.
Syntax create-macro {(option}
Options m (default if no option is given). 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".

n Creates a "non-stop" macro which executes immediately upon activation, without displaying the TCL command being issued by the macro. Attribute 1 becomes an "n".

o Overwite the macro if it already exists.
If the last command on the stack was the Access 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:

show.entity created

appears on the screen.

If the "show.entity" macro had been present, the message:

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

Executing macros:

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

First, simply executing the macro by itself:

list entity name address

The "list entity name address" appears 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. 

Pressing <return> issues the sentence as presented.

Secondly, passing input from the command line:

show.entity hdr-supp leg-supp<return>
list entity name address hdr-supp leg-supp

Again, because this a "pause"-type macro, the TCL command is 
displayed 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<return>
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 modifiy it, 
the item-id must be referenced within quotes:

u md "show.entity"<return>
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 may be placed on subsequent attributes. The 
"M" may be changed to an "n" to make it a 
"non-stop" macro, which means that it executes the first TCL command 
immediately upon activation. Since macro's are executable, if the UP 
command <ctrl>+xr is used, the macro will be filed and automatically 
Related tcl.!.unix