Pauses for user input of a keyword, and returns that keyword
(getkword [msg])
getkword call with the initget function. The user cannot enter another AutoLISP expression as the response to a getkword request.
Valid keywords are set prior to theArguments
getkword does not display a prompting message.
A string to be displayed to prompt the user; if omitted,Return Values
nil, if the user presses ENTER without typing a keyword. The function also returns nil if it was not preceded by a call to initget to establish one or more keywords.
A string representing the keyword entered by the user; otherwisegetkword displays a warning message and prompts the user to try again.
If the user enters a value that is not a valid keyword,Examples
initget that sets up a list of keywords (Yes and No) and disallows null input (bits value equal to 1) to the getkword call that follows:
The following example shows an initial call toCommand: (initget 1 "Yes No")
nil
Command: (setq x (getkword "Are you sure? (Yes or No) "))
Are you sure? (Yes or No) yes
"Yes"
getkword:
The following sequence illustrates what happens if the user enters invalid data in response toCommand: (initget 1 "Yes No")
nil
Command: (setq x (getkword "Are you sure? (Yes or No) "))
Are you sure? (Yes or No) Maybe
Invalid option keyword.
Are you sure? (Yes or No) yes
"Yes"
initget, so getkword issued an error message and then prompted the user again with the string supplied in the msg argument.
The user's response was not one of the keywords defined by the precedinginitget function. The getxxx Functions in the AutoLISP Developer's Guide.
The