;find text
(command "undo" "m")
(setq oss
(ustr1 0 "\nEnter Old string" oss nil))
(setq ns "GOOD")
;(setq ns (ustr1 0 "\nEnter New String" ns nil))
;(setq co (uint
5 "" "Second color" co))
(setq osl
(strlen oss))
(setq nsl
(strlen ns))
(defun c:ct
()
(command "undo" "m")
(c0)
(command "layer" "m" "1"
"")
(command "layer" "s" "1"
"")
(command "layer" "c" "1"
"" "")
(setq lay "1")
(setq m 0)
;(um)(oe)
;(ssc)
(setq ss1 (ssget
"x"))
(setq p0 (list 0 0 0))
(setq n (sslength
ss1))
(setq i
0)
(setq ss0 (ssadd))
(while (< i n)
(setq s1 (ssname
ss1 i))
(setq ed
(entget s1))
(setq en (dxf
0 ed))
(cond ((= en "TEXT")
(setq ws
(dxf 1 ed))
(setq wsl
(strlen ws))
(setq j 1)
(while (< j wsl)
(setq ts
(substr ws j osl))
;(setq j (+ j 1)))))
(cond ((= ts
oss)
(ssadd s1 ss0)
(setq k (- j 1))
(setq tr1 (substr
ws 1 k))
;(print tr1)
(setq tr3 (substr
ws (+ 2 j) wsl))
;(print tr3)
(setq ss
(strcat tr1 ns tr3))
(setq alc
(assoc 1 ed))
(setq al (cons 1 ss))
(setq ed
(subst al alc ed))
(setq p1 (dxf
10 ed))
;(entmod ed)
;(command "copy" s1 "" "0,0"
"0,0")
;(setq s2 (entlast))
;(command "chprop" s1
"" "la" lay "")
(setq m (+ m 1))
(grdraw p0 p1 col)))
;(print "YES")))
(setq j (+ j 1)))))
(setq i (+ i
1))))
(command "script" "ct")