Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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?

Posted

I believe it is difficult :geek:

 

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.

Posted

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)
)

Posted

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
)

Posted

Thanks Lee and Mr Puckett works sweet.:D

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
)

Posted

...sorry for the double posting - I just deleted it...

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...