Try to use:
Code:
(defun c:celldesc (/ adoc handle *error* file_name
str blk_descr block_name block_descr block_def
)
(defun *error* (msg)
(vl-catch-all-apply '(lambda () (close handle)))
(vla-endundomark adoc)
(princ msg)
(princ)
) ;_ end of defun
(vla-startundomark
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
) ;_ end of vla-startundomark
(if (setq file_name (getfiled "Select a description file" "" "txt" 4))
(progn
(setq handle (open file_name "r"))
(while (setq str (read-line file_name))
(setq block_name (1+ (vl-string-position (ascii ",") str 0))
block_descr (1+ (vl-string-position (ascii ",") str (1+ block_name)))
block_name (vl-string-trim
", "
(substr str block_name (+ 1 (- block_descr block_name)))
) ;_ end of vl-string-trim
block_descr (vl-string-trim
", "
(substr str
block_descr
(+ 1 (- (strlen str) block_descr))
) ;_ end of substr
) ;_ end of vl-string-trim
) ;_ end of setq
(if (tblobjname "block" block_name)
(progn
(vl-catch-all-apply
'(lambda ()
(vla-put-comments
(setq block_def (vla-item (vla-get-blocks adoc) block_name))
block_descr
) ;_ end of vla-put-Comments
(vla-update block_def)
) ;_ end of lambda
) ;_ end of vl-catch-all-apply
) ;_ end of progn
) ;_ end of if
) ;_ end of while
) ;_ end of progn
) ;_ end of if
(vla-endundomark adoc)
(princ)
) ;_ end of defun