Jump to content

paste text from clipbard


Emmanuel Delay

Recommended Posts

Is there a way to paste text from the clipboard, and make it lose any text formating?

And have it fill a (m)text that I select or entmake... 

 

I'm tired of right click mouse ->  paste special -> without formatting ...

a lisp command would suit me better

Link to comment
Share on other sites

This is the basics, copy to clipboard, copy from clipboard

 

;;Copy text to clipboard
;; (vlax-invoke (vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData) 'setData "TEXT" --MYTEXTSTRING-- )
;;(vlax-release-object html) ;;and release the object

;;Get text from clipboard
;;(vlax-invoke (vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData) 'getData "TEXT" )
;;(vlax-release-object html)

 

 

and put together in a LISP, set clip board text and get clip board text

 

(defun SetClipBoardText ( MyText / htmlfile result )
  (vlax-invoke (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData) 'setData "Text" Mytext)
  (vlax-release-object htmlfile)
  (princ)
)
(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
)

 

  • Thanks 1
Link to comment
Share on other sites

25 minutes ago, fuccaro said:

In the old times I used to paste the text in Notepad, from there copy-paste in AutoCAD Mtext. All formatting was lost.

 

Same here

Link to comment
Share on other sites

1 hour ago, fuccaro said:

In the old times I used to paste the text in Notepad, from there copy-paste in AutoCAD Mtext. All formatting was lost.

 

The above should do the same - I use it all the time, mostly PDF mark ups, copy to clip board then a LISP txtCBTT (txt, Clip Board To Text) or txtCBNew to paste with no formatting into the drawing - I got annoyed with copy-paste to notepad being soooo slow

 

  • Agree 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...