Jump to content

AutoCAD Command for storing data into clipboard in VM


Recommended Posts

Posted

I am trying to store some data of the AutoCAD drawing into clipboard for other paste use using command/lisp.

(vlax-invoke(vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData) 'setData "TEXT" "test")

When I run the command above, It is successful to store the data into clipboard when it run in Local Machine, and the administrator account in Virtual Machine, with code -1

pass.png.15cb52391ac40c097746323a3a630ef1.png

However when I run the command under user account in Virtual Machine, it is fail with code 0

fail.thumb.png.8cff87012b8bfae0c417ab6c284bb372.png

Any idea to solve? Thanks

Posted

I use these, subtle difference in the code with (setq htmlfile.... but not sure if that will work for you - I don't use a virtual machine. Also a good tip from MHUPP was to release the html file after use.

 

 

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

 

 

Posted

Isn't the whole point of a VM to completely isolate the VM from computer running it? I assume there are ways to have shared file access, but any operating system access like clipboard would need to be worked out through the VM, not AutoCAD. (Just my assumptions, have not tested a VM in years.)

 

However if file acces is possible, you could code to write clipboard to a text file that could be read between Local & Admin VM.

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