readvar
readvar [ -help "text"] [ -title "string"] [ [ -prompt "string"] [ -value "string" | -choice "c1|c2|c3…cN" [ -default "string"]] variable1] [ [ -prompt "string"] [ -value "string" | -choice "c1|c2|c3…cN" [ -default "string"]] variable2] …
The readvar command prompts for the values of the variables named. The information you provide is used to assign values to those variables. (Note that the variable is created if it does not already exist).
The readvar command provides a dialog box that contains OK and CANCEL buttons. If you click on OK, main::status is set to 0. If you click on CANCEL, main::status is set to 1.
-help “text” specifies that a Help button should be added to the panel and, if pressed, the help text text will display in a Help window.
-title “string” specifies a string to be used as the window title for the readvar dialog box.
-prompt identifies a string to be supplied as the text of the prompt. Multiple prompts on the same line are allowed.
-value allows you to specify a string value at the prompt and use it as a default text entry value.
-choice specifies a list of mutually exclusive choices (radio buttons). You can stack the radio buttons vertically on the panel by starting the choice string with | (that is, the first field is empty). If you specify a single item choice list, the choice will appear as a check box instead of a radio button. If the check box is selected, the value is set to a one (1). If the check box is cleared, the value is set to a zero (0).
|
The -choice string will be truncated at 49 characters. If you want to specify a -choice string longer than 49 characters, use the list_response function.
|
-default allows you to specify a choice string as the default value. It can only be used with the -choice option. Only one of the options -value and -choice may be specified for a given variable name.
variable is a name, which should be supplied without the leading dollar sign. Variable names are limited to 199 characters each.
To establish a mnemonic (hot key) for a particular dialog box item, precede the mnemonic letter with the '&' character in the associated string. Use “&&” anyplace you want a single '&' to show.
You can prompt for up to 20 variables on the same panel.
Examples
readvar docname
readvar -prompt '...............' -prompt 'Enter story name:' story
readvar -prompt 'Story:' -value "$docname" story
readvar -prompt 'Enter &name:' name -prompt 'Enter &age:' age
readvar -prompt 'Enter new margins below:' \
-prompt 'Lt marg:' -choice '0.5"|1"|1.5"' l \
-prompt 'Rt marg:' -choice '|same-as-left|0.5"|1"|1.5"' r \
-prompt 'Top margin:' t \
-prompt 'Bottom margin:' b
Related Topics