Arbortext Command Language > Using the Arbortext Command Language > readvar and response
  
readvar and response
The readvar command and response functions can be used to prompt the user for input. readvar brings up a window with one or more entry fields in which text or values can be entered. The -value option enables the application programmer to present the user with a default value. If the user clicks on OK without entering a value, the default value is used.
The following two examples include a readvar with one entry field with a default value of "Mr.X" and a readvar with three entry fields.
readvar -prompt "Enter your name:" -value "Mr.X" name
readvar -prompt "Height:" -choice '5.5|8.5|11' h
-prompt "Width" -choice '8|11|16' w
-prompt "Depth" d
The first command prompts the user with only one entry field in which to enter his or her name. In the second example, there are entry fields with choice boxes for the height and width, and an entry box for the depth.
The response function creates a number of buttons in a special window, and returns a value indicating which button was clicked. The value of the button correlates to its place in the argument.
For example, the user is given three choices in the following example:
$choice=response("Are you ready?","yes","no","maybe")
When a user clicks on yes in the window, $choice is set to 1. Clicking no sets $choice to 2. Clicking maybe sets $choice to 3.