Screen input/output

It is possible to solicit input and display output in a paragraph. To do simple output, use the display statement with a string argument. To do simple input, embed the desired prompt within << and >> (double angle brackets). For example, the line display <<Enter name>> prompts Enter name> and then prints the name.

The paragraph input function has many forms. All of them get input from one of several sources, and substitute that input in place of the original function on the paragraph line.

The syntax for screen input and output:

<<cnumber>>
<<inumber, prompt.text>>
<<f(file.name,item.name{,attribute{,value}}),prompt.text>>
<<{options}{,@([x,y|bell|clr])},prompt.text{,mask}>>

To get input from the keyboard, use the last form. The parameters include:

cnumber c, followed by a number option, indicates that the input function should be replaced by the nth parameter on the original TCL line executing the paragraph. The first parameter returns the paragraph name.
inumber i, followed by a number, is identical to the c form, except that if the parameter is null, then the user is prompted for the desired input.
f(file.name, item.name) Gets input from a file. If the item or file is not found, then the user is prompted with the specified prompt.
[] Separates elements.
| Specifies either/or.
options a Prompts the user even if the data is already present. If a duplicate prompt displays twice in a paragraph, the user is not prompted more than once for the input. Instead, all further uses of the same prompt remembers the original input and returns the result without user intervention.
r Causes the input statement to repeat (r) until the input is null. The final result contains every previous input separated by spaces. This is useful for creating item lists.

After the options, the user may specify a direct cursor address or several predefined constants.

Finally, the input statement requires a prompt string followed by an optional mask. The mask has the same syntax as that used by the BASIC matches function.

Typing quit at any paragraph input prompt terminates the paragraph and returns to TCL.

Parameter Manipulation

Unlike standard macros, the parameters to the original TCL command line executing a paragraph are not directly passed to the first command. Instead, they are placed in a buffer for the paragraph programmer to access individually. The << place the user input or parameters in a paragraph. For example, to access the first parameter (word) in the original line (which is the name of the paragraph), use <<c1>>. To access the second parameter, use <<c2>>.

The syntax for parameter manipulation:

<<cnumber>>
<<Inumber,prompt.text>>

The parameters include:

cnumber c, followed by a number, indicates that the input function should be replaced by the nth parameter on the original TCL line executing the paragraph. The first parameter returns the paragraph name.
inumber i, followed by a number, is identical to the c form, except that if the parameter is null, then the user is prompted for the desired input.
prompt.text Displays text that requires user input.