Author Topic: Clear Windows Clipboard?  (Read 3679 times)

0 Members and 1 Guest are viewing this topic.

mkweaver

  • Bull Frog
  • Posts: 352
Clear Windows Clipboard?
« on: September 24, 2007, 10:13:53 AM »
I need to be able to clear previously pasted drawing objects from the windows clipboard to avoid inadvertantly pasting bad info into a drawing.  I have created the following code, but it doesn't seem to work.

Suggestions appreciated.

Mike Weaver

Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;  Routine: ClearClipBoard ;;;
;;;  Purpose: Clears all data from the windows clipboard ;;;
;;;  Arguments: none ;;;
;;;  Returns: nothing of value ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ClearClipBoard ( / objIEA doc body)
  (vl-load-com)
  (setq objIEA (vlax-create-object "InternetExplorer.Application"))
  (vlax-put-property objIEA "Visible" :vlax-false)
  (vlax-invoke objIEA "Navigate2" "about:blank")
  (while (/= 4 (vlax-get-property objIEA "ReadyState"))
    (princ ".")
    )
  (setq doc  (vlax-get-property objIEA "Document")
body (vlax-get-property doc "Body")
Window (vlax-get-property doc "ParentWindow")
ClipBoard (vlax-get-property window "ClipBoardData")
)
 
  (vlax-invoke-method ClipBoard "ClearData" )
  (vlax-release-object ClipBoard)
  (vlax-release-object Window)
  (vlax-release-object body)
  (vlax-release-object doc)
  (vlax-release-object objIEA)
  (gc)
  (princ)
  )

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Clear Windows Clipboard?
« Reply #1 on: September 24, 2007, 10:38:36 AM »
Would something like using Doslib’s dos_clipboard with a space work?
i.e.
Code: [Select]
(dos_clipboard " ")

GDF

  • Water Moccasin
  • Posts: 2081
Re: Clear Windows Clipboard?
« Reply #2 on: September 24, 2007, 10:40:04 AM »
;;; http://www.geometricad.com
;;; by Luis Esquivel
;;; ClipBoard Functions:
;;; Usage: (SetClipboardText <String>)
;;; Usage: (GetClipboardText)
;;; Usage: (EmptyClipboard)

Maybe Luis can help?
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Clear Windows Clipboard?
« Reply #3 on: September 24, 2007, 10:43:17 AM »
I also have some arx code here http://www.theswamp.org/index.php?topic=17605.0.
let me know if you need one rolled up

JohnK

  • Administrator
  • Seagull
  • Posts: 10638
Re: Clear Windows Clipboard?
« Reply #4 on: September 24, 2007, 12:42:37 PM »
Here is a small app for you.

Code: [Select]
Sub Main()
   Clipboard.Clear
End Sub
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mkweaver

  • Bull Frog
  • Posts: 352
Re: Clear Windows Clipboard?
« Reply #5 on: September 24, 2007, 03:41:15 PM »
I will have to take a look at this, since I am using doslib.  Thanks for the pointer.

Would something like using Doslib’s dos_clipboard with a space work?
i.e.
Code: [Select]
(dos_clipboard " ")