Copy filename and path to clipboard

Copy filename and path to clipboard

Anonymous
Not applicable
1,158 Views
1 Reply
Message 1 of 2

Copy filename and path to clipboard

Anonymous
Not applicable

Hey guys,

 

Wondering if I can get some help with this one.

 

I want to be able to copy the DWGPrefix & DWGName to the clipboard. Somethign along the lines of: 

 

(defun C:SaveFilePath ()
   (setq filepath (getvar "dwgprefix"))
   (setq filename (getvar "dwgname"))

   **Concatenate variables here**
   (command "ClipBoard Paste" filepath&filename)
(princ))

 

I've read about some about Doslib but I would prefer to go this route is at all possible.

 

 

Thanks

0 Likes
Accepted solutions (1)
1,159 Views
1 Reply
Reply (1)
Message 2 of 2

Ranjit_Singh
Advisor
Advisor
Accepted solution

Try below code

 

(defun c:somefunc  (/ a htmlObj)
     (setq a       (strcat (getvar 'dwgprefix) (getvar 'dwgname))
           htmlObj (vlax-get-or-create-object "htmlfile"))
     (vlax-invoke (vlax-get (vlax-get htmlObj 'parentwindow) 'clipboarddata) 'setdata "text" a)
     (vlax-release-object htmlObj)
     (setq htmlObj ())
     (gc)
     (princ))