I am curious if there is a way to have MTEXT editor automatically select all the text in the particular item.
I am doing a lot of copy/paste/edit, and every time that I do an MTEXT edit, I first have to hit CTRL-A to select everything in the item. Is there a command or variable that will automatically select all of the text when I double click the item, so I don't have to keep hitting CTRL-A?
Thanks,
-Dan
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
I sought out a solution for this,
Lee at http://www.lee-mac.com/ came up with the following code that accomplishes just what you are looking for.
Add this to your "acaddoc.lsp" file using a text editor:
( (lambda nil (vl-load-com) (foreach r (cdar (vlr-reactors :vlr-command-reactor)) (if (= "acdbmtext-reactor" (vlr-data r)) (vlr-remove r) ) ) (vlr-set-notification (vlr-command-reactor "acdbmtext-reactor" '((:vlr-commandwillstart . acdbmtext-reactor-callback)) ) 'active-document-only ) (defun acdbmtext-reactor-callback ( a b / w ) (if (= "mtedit" (strcase (car b) t)) (if (setq w (vlax-create-object "wscript.shell")) (progn (vl-catch-all-apply 'vlax-invoke (list w 'sendkeys "^{HOME}(^+{END})")) (vlax-release-object w) ) ) ) ) (princ) ) )
You can find your "acaddoc.lsp" file by entering the following into the command line in autocad:
(startapp "notepad" (findfile "acaddoc.lsp"))
If you don't have an "acaddoc.lsp" file create it at:
%appdata%\Autodesk\Your CAD Version\enu\Support
It is important to note that you will probably have to restart your session of autoCAD after you save acaddoc.lsp
Thanks, to Lee!
-Skultan
Double clicking only selects a single line of text in the editor. To use a built in feature, you would have to click at the beginning (or end) of the text and hold to the opposite end of text, and click again to highlight all.
This question has come up before, probably more than once. I don't recall the Subject lines of threads about it, but a Search should reveal some approaches in addition to the reactor version posted above.
Amazing!
Thanks to Lee and to you Skultan for sharing this! 🙂
Many thanks - I'm glad it proved useful!
Hey Lee, I'm trying to use your reactor, but the reactor isn't picking up the mtedit on the last of the this routine. Any suggestions?
(defun c:lab ( ) (if (not *sty1*) (setq *sty1* "Simplex")) (if (not *sty2*) (setq *sty2* "Regular")) (if (not *siz*) (setq *siz* "Small")) (if (not *scl*) (setq *scl* 1)) (initget 128 "Style siZe") (setq pt (getpoint (strcat "\nSelect insertion point for text or select current [Style/siZe] <" *sty1* ">: "))) (cond ((= pt "Style") (initget "Simplex Regular Condensed") (setq *sty1* (cond ((getkword (strcat "\nChoose [Simplex/Regular/Condensed] <" *sty1* ">: "))) (*sty1*))) (cond ((= *sty1* "Regular") (initget "Regular Bold Italic") (setq *sty2* (cond ((getkword (strcat "\nChoose [Regular/Bold/Italic] <" *sty2* ">: "))) (*sty2*))) ) ((= *sty1* "Condensed") (initget "Regular Bold Italic") (setq *sty2* (cond ((getkword (strcat "\nChoose [Regular/Bold/Italic] <" *sty2* ">: "))) (*sty2*))) ))) ((= pt "siZe") (initget "Small Medium lArge largeR") (setq *siz* (cond ((getkword (strcat "\nChoose [Small/Medium/lArge/largeR] <" *siz* ">: "))) (*siz*))) (cond ((and (= *siz* "Small")) (setq *scl* 1)) ;1/8 = 0.125 ((and (= *siz* "Medium")) (setq *scl* 1.5)) ;3/16 = 0.1875 ((and (= *siz* "lArge")) (setq *scl* 2)) ;1/4 = 0.25 ((and (= *siz* "largeR")) (setq *scl* 3)) ;3/8 = 0.375 ; ((and (= (getvar 'useri1) 128) (= *siz* "Small")) (setq *scl* 1));3/32 = 0.09375 ; ((and (= (getvar 'useri1) 128) (= *siz* "Medium")) (setq *scl* 1.666));5/32 = 0.15625 ; ((and (= (getvar 'useri1) 128) (= *siz* "lArge")) (setq *scl* 2.333));7/32 = 0.21875 ; ((and (= (getvar 'useri1) 128) (= *siz* "largeR")) (setq *scl* 4.333));13/32 = 0.40625 ))) (cond ((= *sty1* "Simplex") (setq *sty* "Simplex")) ((and (= *sty1* "Regular") (= *sty2* "Regular")) (setq *sty* "U001")) ((and (= *sty1* "Regular") (= *sty2* "Bold")) (setq *sty* "U001 Bold")) ((and (= *sty1* "Regular") (= *sty2* "Italic")) (setq *sty* "U001 Italic")) ((and (= *sty1* "Condensed") (= *sty2* "Regular")) (setq *sty* "U001 Con")) ((and (= *sty1* "Condensed") (= *sty2* "Bold")) (setq *sty* "U001 Con Bold")) ((and (= *sty1* "Condensed") (= *sty2* "Italic")) (setq *sty* "U001 Con Italic")) ) (setq clay (getvar 'clayer) blk (strcat "*" @blk "txt_" *sty* ".dwg") lay "0L_CALL_TEXT" ascl (getvar 'cannoscalevalue) ) (command "-layer" "m" lay "") (if (tblsearch "layer" lay) (progn (command "-insert" blk (if (listp pt) pt pause) (/ *scl* ascl) pause) (command "mtedit" (entlast)) ) (progn (command "-insert" blk "0,0" "1" "1" "0") (command "erase" (entlast) "") (command "-insert" blk (if (listp pt) pt pause) (/ *scl* ascl) pause) (command "mtedit" (entlast)) )) (setvar 'clayer clay) (princ) )
Thanks!