Greetings,
I'm trying to cut down on my embarrassing typos of customer names ( also expanding my laziness )
My goal is to type the minimum characters in order to extract a single name
So far rhis kludge is about as ugly as ( fill in he blank )
In vanilla Autolisp :
(setq nl (list "John Doe" "Jane Doe" "Joe Doe" "Jack Doe"
"John Dot" "Jane Dot" "Joseph Don"
"Mike Smith" "May Smith" "Mark Smith"
"Don Jones" "Doc Jones" "Don Jock" "Don Zero"))
(getname nl)
;;;ARG -> SrtList
;;;RET -> 'STR
;;;ERR (exit)
(defun getname (sl / p tl c p tl)
(setq sl (mapcar 'strcase sl))
(textscr)
(setq p "")
(while (/= (length sl) 1)
(setq c (strcase (getstring t (strcat "\n\nContact Name: " p " : "))))
(setq p (strcat p c)
tl nil)
(foreach a sl
(if (= p (substr a 1 (strlen p)))
(setq tl (cons a tl))))
(setq sl tl)
(cond ((not sl)
(alert (strcat p " Not Found"))
(exit))
((< (length sl) 15)
(textpage)
(foreach c sl
(princ (strcat "\n" c))))))
(princ (strcat "\n" (car sl)))
(car sl))
Any suggestions ? TIA -David
[/code]