Function Entry: GETSTRING
← Prev | ↑ Chapter | Next → | Index | Symbols
Function Entry: GETSTRING
Name
getstring
Class
Function
Syntax
(getstring [cr] [msg])
Arguments and Values
cr: optional flag (the "carriage return" flag) that selects how the input is terminated and therefore whether the response may contain blanks. It is a boolean-style flag, so only its nil / non-nil nature matters:- omitted or nil: a blank (space) terminates the input just like
pressing Enter, so the returned string cannot contain spaces. Typing
Gary Indiana Jonesyields"Gary". - any non-nil value (conventionally T): blanks are accepted as
part of the string and the input is terminated only by pressing
Enter. Typing
Gary Indiana Jonesyields"Gary Indiana Jones".
- omitted or nil: a blank (space) terminates the input just like
pressing Enter, so the returned string cannot contain spaces. Typing
msg: optional prompt string. Whencris supplied it is the second argument; whencris omitted a lone string argument is the prompt.
Description
Prompts the user for a string response. The cr flag governs blank
handling (see Arguments and Values). The user cannot answer with another
AutoLISP expression; the response is taken as literal text.
Return Values
Returns the entered string, or nil if the user presses Enter without typing anything. AutoCAD limits the response to 132 characters; BricsCAD does not document a fixed limit.
Side Effects
- prompts at the command line
- consumes user input
Exceptional Situations
Cancel and interactive-input errors are host-dependent.
Notes
Autodesk explicitly notes that the user cannot enter another AutoLISP expression as the response; this is user input, not reader input.
Availability
- AutoCAD 2026: documented (per Autodesk reference page).
- BricsCAD V22+: documented; the
cr/CrLf flag has the same nil vs non-nil semantics as AutoCAD. - Status: documented for both AutoCAD and BricsCAD.
Source Notes
- [getstring (AutoLISP)](https://help.autodesk.com/cloudhelp/2026/FRA/AutoCAD-LT-AutoLISP-Reference/files/GUID-B139EFBD-74B7-4276-B422-D2186F7D8D0A.htm)
- [getstring (BricsCAD Developer Reference, V22)](https://developer.bricsys.com/bricscad/help/en_US/V22/DevRef/source/getstring.htm)
- Status: documented for both vendors;
crsemantics verified against both references.
clautolisp
clautolisp implementation deviation — not part of the normative
specification above. AutoCAD and BricsCAD collect this response through
the graphical drawing editor: a command-line prompt combined with
keyboard interaction in the drawing window (implicitly a GUI). clautolisp
has no drawing editor — it writes the prompt to the standard output and
reads the response as one line of text from the standard input (a TUI
interaction). Interactively this is the REPL's terminal; for scripted,
deterministic runs it is the file attached with --mock-input. A live
CAD host, when connected, restores the native GUI behavior. The cr
flag is applied to the typed line exactly as specified above (a blank
ends the input when cr is nil).