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 Jones yields "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 Jones yields "Gary Indiana Jones".
  • msg: optional prompt string. When cr is supplied it is the second argument; when cr is 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

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).