GetString Method

Back to Methods Reference

Gets a string from the user.

Signature

VLA : RetVal = Object,GetString(HasSpaces[, Prompt])

VL : RetVal = (vla- GetString Object HasSpaces Prompt)

(setq thestring (vla-GetString util 0 "\nEnter your name : "))

  • Object : Utility

  • HasSpaces : Integer; input-only
    TRUE: The return string can contain spaces. It is terminated by a carriage return only.
    FALSE: The return string may not contain spaces. It is terminated by a carriage return or space.

  • Prompt : Variant (string); input-only; optional
    The text used to prompt the user for input.

  • RetVal : String
    The string returned from the user.

Remarks

AutoCAD pauses for user input of the string, and sets the result to the string that the user enters. The HasSpaces parameter specifies whether the string can contain spaces. The Prompt parameter specifies a string that this method displays before AutoCAD pauses.

The AutoCAD user can enter the string from the keyboard. If the HasSpaces parameter is TRUE, the string can contain blanks and the user must terminate it by entering [Return]. If HasSpaces is False, entering either a blank or [Return] terminates the string. If the user enters more than 132 characters, string entry continues until the user enters a blank or carriage return (according to HasSpaces), but GetString places only the first 132 characters into the return value.

Example :


;get a reference to the Utilities Object :

(setq util (vla-get-utility 
                   (vla-get-activedocument 
                        (vlax-get-acad-object))))
                        
;no spaces allowed
(setq s (vla-getstring util 0 "Enter String: "))

;spaces allowed
(setq s (vla-getstring util 1 "Enter String: "))
 
The AutoLisp/Visual Lisp/VBA Resource Website
Google
Search the WWW Search AfraLisp

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website