Why not something different...?
;************************ G L A V C V S *************************
;************************** F E C I T ***************************
(defun c:txtIncrem (/ tam capa ind para a txsel lstent le l s dameTexto errores error0)
(defun errores (mens)
(setq *error* error0)
(prin1)
)
(defun dameTexto (/ tx)
;;; WRITE HERE THE CODE YOU NEED TO CUSTOMIZE THE TEXT YOU WANT TO ENTER OR CREATE
(cond
((= (strlen (setq tx (itoa (setq ind (+ ind 1))))) 1)
(strcat "00" tx)
)
((= (strlen tx) 2)
(strcat "0" tx)
)
(T tx)
)
)
(while (not para)
(if (setq ent (car (entsel "\nSelect index text...")))
(if (= (cdr (assoc 0 (setq lstent (entget ent)))) "TEXT")
(if (wcmatch (setq ind (cdr (assoc 1 lstent))) "#,##,###,####")
(setq ind (atoi ind) capa (cdr (assoc 8 lstent)) a (cdr (assoc 40 lstent)) para T)
(princ "\n*** The selected object is not valid. Please, try again... ***")
)
)
(setq para T)
)
)
(setq error0 *error*
*error* errores
)
(setq tam (* (getvar "pickbox") (/ (GETVAR "VIEWSIZE") (CADR (GETVAR "SCREENSIZE")))) para nil)
(princ "\nSelect text to modify or insert new text (RIGHT CLICK for exit)...")
(while (and (setq l (grread T (if s 4 13) (if s 2 0))) (member (car l) '(5 3)))
(if (setq s (ssget "_C" (list (- (car (setq p (cadr l))) tam) (- (cadr p) tam))
(list (+ (car p) tam) (+ (cadr p) tam))
(list (cons 0 "TEXT"))
)
)
(cond
((= (car l) 3)
(entmod (subst (cons 1 (dameTexto)) (assoc 1 (setq le (entget (ssname s 0)))) le))
)
;Here are other possible cases
)
(cond
((= (car l) 3)
(entmake (list '(0 . "TEXT")
(cons 8 capa)
(cons 40 a)
(cons 1 (dameTexto))
(cons 10 (list (car p) (cadr p) 0.0))
)
)
)
;Here are other possible cases
)
)
)
(princ)
)