Hi, I dont have AutoCAD with me at the moment, but I think it will not be possible to use the DDEDIT command that way.
So I would suggest something like this:
(defun c:LL ( / ent ss) (if (setq ss (ssget "_+.:E:S:L" '((0 . "TEXT,MTEXT")))) (entmod (subst (cons 1 "KUMAR") (assoc 1 (setq ent (entget (ssname ss 0)))) ent)) ) (princ) )
Hope that helps
Henrique
The reason you can't use DDEDIT that way is that the command calls up a dialog box [that's what the DD stands for, from back in the days when dialog boxes were not the standard interface for any command, and some special commands starting with DD were made that used them], which then won't take input from the line of code, but wants it typed in.
Here's another way to accomplish the same thing:
(vl-load-com); [if needed]
(defun C:LL ()
(vla-put-TextString (vlax-ename->vla-object (car (entsel))) "KUMAR")
)
But it does depend on the User selecting something that has a TextString property, so using (ssget) to filter for entity type is probably better, and it can also be made to keep asking if the User picks something else, or misses when picking:
(vl-load-com); [if needed]
(defun C:LL (/ ss)
(while (not ss)
(prompt "\To change content of Text/Mtext to \"KUMAR\",")
(setq ss (ssget "_+.:S:L" '((0 . "TEXT,MTEXT"))))
); while
(vla-put-TextString (vlax-ename->vla-object (ssname ss 0)) "KUMAR")
); defun