(defun ClearClipBoard ()
  (startapp “cmd /c \”echo off | clip\””)
)                                        ; (clearclipboard)

(defun _SetClipBoardText (text / htmlfile result)
  ;;  Caller\’s sole responsibility is to pass a
  ;;  text string. Anything else? Pie in face.

  ;;  Attribution: Reformatted version of
  ;;  post by XShrimp at theswamp.org.
  ;;
  ;;  See <a href=\”http://tinyurl.com/2ngf4r.\” target=\”_blank\”>http://tinyurl.com/2ngf4r.</a>

  (setq        result
         (vlax-invoke
           (vlax-get
             (vlax-get
               (setq htmlfile (vlax-create-object “htmlfile”))
               \’ParentWindow
             )
             \’ClipBoardData
           )
           \’SetData
           “Text”
           text
         )
  )
  (vlax-release-object htmlfile)
  text
)                                        ;( _SetClipBoardText “testing”)

(defun _GetClipBoardText (/ htmlfile result)
  ;;  Attribution: Reformatted version of
  ;;  post by Patrick_35 at theswamp.org.
  ;;
  ;;  See <a href=\”http://tinyurl.com/2ngf4r.\” target=\”_blank\”>http://tinyurl.com/2ngf4r.</a>
  (setq        result
         (vlax-invoke
           (vlax-get
             (vlax-get
               (setq htmlfile (vlax-create-object “htmlfile”))
               \’ParentWindow
             )
             \’ClipBoardData
           )
           \’GetData
           “Text”
         )
  )
  (vlax-release-object htmlfile)
  result
)                                        ;(setq test (_GetClipBoardText))

 

版权声明:本文为mjgw原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/mjgw/p/12459495.html