Small Fish Posted March 3, 2010 Posted March 3, 2010 Is it programatically possible to 'copy' something from the command line, such as a generated file path? I would then like to manually 'paste' it into another application. Quote
ReMark Posted March 3, 2010 Posted March 3, 2010 Yes it is possible. Highlight, right-click, select copy. Then go paste to your heart's content. You can also press the F2 key and see what you have typed and AutoCAD's responses in the AutoCAD Text Window. You can even scroll forward and backwards through contents of the window too. Quote
ReMark Posted March 4, 2010 Posted March 4, 2010 OK. I think I read the post too quickly. I still bet there is a way to do it programmatically(sic)? Is that a word? Quote
Lee Mac Posted March 4, 2010 Posted March 4, 2010 I believe it is difficult How using/reading the logfile? Example: (defun c:test nil (setvar 'logfilemode 1) (print "This is a test") (setvar 'logfilemode 0) (startapp "notepad" (getvar 'logfilename)) (princ)) I may be missing something, but I cannot think of another way at the moment. Quote
Small Fish Posted March 4, 2010 Author Posted March 4, 2010 Thanks Lee - I was trying marry code your code with mine. I would like to paste the name and file path into an email (the earlier post I had seemed not possible) Its just too hard to go from acad to email. Thats why I want to paste manually So this is what I have.... (defun C:CurNamePath (/ acadx doc dwg ) (vl-load-com) (setvar 'logfilemode 1) (setq acadx (vlax-get-acad-object) doc (vla-get-activedocument acadx) dwg (vla-get-name doc) path (vla-get-path doc) );setq (princ (strcat path dwg )) (setvar 'logfilemode 0) (princ) ) Quote
Lee Mac Posted March 4, 2010 Posted March 4, 2010 There's no need to paste it to the command line, how about using these treats from Michael Puckett ;; MP ;; http://www.theswamp.org/index.php?topic=21764.msg263322#msg263322 (defun _SetClipBoardText ( text / htmlfile result ) ;; Caller's sole responsibility is to pass a ;; text string. Anything else? Pie in face. (setq result (vlax-invoke (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData ) 'SetData "Text" text) ) (vlax-release-object htmlfile) text ) ;; MP (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 ) Quote
Small Fish Posted March 4, 2010 Author Posted March 4, 2010 Thanks Lee and Mr Puckett works sweet. Just for those that might be interested in using it- here is the final code: ;Small Fish (defun C:CurNamePath (/ acadx doc dwg htmlfile result ) (vl-load-com) (setq acadx (vlax-get-acad-object) doc (vla-get-activedocument acadx) dwg (vla-get-name doc) path (vla-get-path doc) );setq (princ (strcat path "\\" dwg )) (setq text (strcat path "\\" dwg )) (SetClipBoardText text) (princ "\nThe above line has been copied. You can now ") (princ "\npaste into an email or any other application." ) (princ) );defun ;Michael Puckett (defun SetClipBoardText ( text / htmlfile result ) ;; Caller's sole responsibility is to pass a ;; text string. Anything else? Pie in face. (setq result (vlax-invoke (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData ) 'SetData "Text" text) ) (vlax-release-object htmlfile) text ) ;; Michael Puckett (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 ) Quote
Small Fish Posted March 4, 2010 Author Posted March 4, 2010 ...sorry for the double posting - I just deleted it... Quote
Recommended Posts
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.