Try this:
Code:
(defun C:XbetweenAandB (/ $ent $num $str $val a b i n pickset string ss)
(setq ss (ssget (quote ((0 . "TEXT")))))
(if ss
(progn
(initget 1)
(setq a (getreal "\nMin range value: "))
(if a
(progn
(initget 1)
(setq b (getreal "\nMax range value: "))
(if (and b (< a b))
(progn
(setq n 0
pickset (ssadd)
)
(while (< n (sslength ss))
(setq $ent (ssname ss n)
$val (cdr (assoc 1 (entget $ent)))
)
(if (setq $num (distof $val))
(if (< a $num b) (ssadd $ent pickset))
(progn
(setq i 1 string "")
(while (<= i (strlen $val))
(if (vl-position (setq $str (substr $val i 1)) (quote ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "." "-")))
(setq string (strcat string $str))
)
(setq i (1+ i))
)
(if (and (setq $num (distof string)) (< a $num b)) (ssadd $ent pickset))
)
)
(setq n (1+ n))
)
(if pickset (sssetfirst nil pickset)) ;;Light the grips
;;Do what you want here on pickset
(setq pickset nil)
)
)
)
)
(setq ss nil)
)
)
(princ)
) ;;C:XbetweenAandB