这是一个提示更改属性标记的版本。。。
- (defun c:foo (/ _puttext _getclipboardtext atts opt s sel tags txt x)
- ;; RJP - 04.12.2018
- ;; Copies clipboard text to selected objects
- (defun _puttext (o s)
- (cond ((vlax-property-available-p o 'textstring) (vla-put-textstring o s))
- ((vlax-property-available-p o 'textoverride) (vla-put-textoverride o s))
- ((vlax-property-available-p o 'hasattributes)
- (if (= 1 (length (setq atts (vlax-invoke o 'getattributes))))
- (vla-put-textstring (car atts) s)
- (progn (setq tags (mapcar '(lambda (x) (vla-get-tagstring x)) atts))
- (setq opt (apply 'strcat (mapcar '(lambda (x) (strcat x "/")) tags)))
- (initget 0 (apply 'strcat (mapcar '(lambda (x) (strcat x " ")) tags)))
- (setq sel (cond ((getkword (strcat "\n[" opt "] <" (car tags) ">: ")))
- ((car tags))
- )
- )
- (foreach a atts
- (if (= sel (vla-get-tagstring a))
- (vla-put-textstring a s)
- )
- )
- )
- )
- )
- )
- )
- ;; http://www.theswamp.org/index.php?topic=35577.msg408049#msg408049
- (defun _getclipboardtext (/ htmlfile result)
- (setq
- result (vlax-invoke
- (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'parentwindow)
- 'clipboarddata
- )
- 'getdata
- "Text"
- )
- )
- (vlax-release-object htmlfile)
- result
- )
- (cond
- ((null (setq txt (_getclipboardtext))) (print "Nothing in clipboard"))
- ((null (setq s (ssget ":L" '((0 . "insert,*text,multileader,dimension"))))) (print "Bye.."))
- ((foreach a (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
- (_puttext a txt)
- )
- )
- )
- (princ)
- )
- (vl-load-com)
|