Very nice, CAB.
Dan's initial request also included detection of Escape. This can be added by using VL-CATCH-ALL-APPLY like below. Just remember to put the test for an error object before any test of ERRNO (Esc will cause a value of 52).
(while
(not
(progn
(setvar "errno" 0) ; must pre set the errno to 0
(setq ename (vl-catch-all-apply 'entsel '("\nSelect Object: ")))
(cond
((vl-catch-all-error-p ename)
(prompt "\nEscape was pressed")
T
)
((= (getvar "errno") 52)
(prompt "\nEnter Key Pressed, Good Bye. ")
T
)
((null ename)
(prompt "\nNothing selected. ") ; returns nil
)
((= (cdr (assoc 0 (entget (car ename)))) "ARC")
(prompt "\nObject is an Arc, Try again.")
)
((= (cdr (assoc 0 (entget (car ename)))) "LINE")
(prompt "\nObject is a Line, Try again.")
)
((vl-string-search "TEXT"
(cdr (assoc 0 (entget (car ename))))
)
;; text or Mtext or Rtext
(prompt "\nObject is text, Try again.")
)
(T
;; no match
(prompt "\nYou got something else, Good Bye. ")
T ; allow exit from loop
)
)
)
)
)