Here is something I wrote recently.
;;function to mark checked annotation objects
;;supports ATTRIB,TEXT,MTEXT,& MTEXT in DIMENSIONs
;;
(defun C:OK ( /
code
count
etype
obj
retval
stypes)
(setq stypes '("ATTRIB" "MTEXT" "TEXT");define supported types
count 0)
(prompt "\nMark as Checked <U to Undo, any other key to exit>:")
;;grread to acquire points
(while (or(> (setq code (car (setq retval (grread nil 14 2))))2);not keyboard
(and (= 2 code) (member (cadr retval) '(85 117))));key u or U
(cond ((= 2 code);undo one step
(if (> count 0)
(progn
(remove_image (entlast))
(setq count (1- count))
);progn
(princ "\nNothing to Undo.")
);if
);pred
((= 3 code);point selected
(and
(setq obj (car (nentselp (cadr retval))));object found
(member (setq etype (cdr (assoc 0 (setq obj(entget obj))))) stypes);supported type
;;process it
(mark_as_checked obj)
(setq count (1+ count))
);and
);pred
);cond
);while
(princ)
);end OK