使用VBScript清除剪贴板 [英] Clearing the clipboard using VBScript
本文介绍了使用VBScript清除剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Win32上使用VBScript清除剪贴板?
How can the clipboard be cleared using VBScript on Win32?
推荐答案
它不能直接完成,但是可以让应用程序可以完成工作。这将使用命令行工具 clip
:
It can not be done directly, but you can let an application do the work. This will clear
the clipboard, using the command-line tool clip
:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
< hr>
另一种方法是使用具有 COM 界面,它可以操纵
剪贴板。例如。 Microsoft Word和Internet Explorer。
Another way is to use applications that have a COM interface and that can manipulate the clipboard. E.g. Microsoft Word and Internet Explorer.
这可以在Internet Explorer中使用,但可能会引发用户对话框:
This will work, using Internet Explorer, but it may throw a user dialog:
Set slaveApplication = CreateObject("InternetExplorer.Application")
slaveApplication.Navigate("about:blank")
slaveApplication.document.parentwindow.clipboardData.SetData "text", ""
slaveApplication.Quit
这篇关于使用VBScript清除剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文