In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how VBS accesses the clipboard, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.
The code is as follows:
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate("about:blank")
Set clipboard = IE.document.parentWindow.clipboardData
'SetData Sets the contents of the clipboard
clipboard.SetData "text", "Forget, like a person's feeling"
'GetData Gets the contents of the clipboard
WScript.Echo clipboard.GetData("text")
IE.Quit
Practice has proved that a large number of online search code is generally not good code. The SetData method is actually related to IE browser settings.
The default setting for IE8 is Prompt, so running the script above will pop up a dialog box. If this is Disabled, then the script will not be able to set the clipboard contents (get unaffected).
This code is not guaranteed or less good, in Windows 7 can be used to set the contents of the clipboard clip.exe, get it or use IE on the line.
Dim WshShellset WshShell = CreateObject("wscript.Shell")str = "Forget, like a person's feeling"WshShell.Run "cmd. exe/c echo " & str & "| clip",0,False
Word.Application can also be used to set and get clipboard contents
'Set the contents of the clipboard Dim WordSet Word = CreateObject("Word.Application")Word.Documents.AddWord.Selection.Text = "Forget, like a person's feeling"Word.Selection.CopyWord.Quit False' Get the contents of the clipboard Dim WordSet Word = CreateObject("Word.Application")Word.Documents.AddWord.Selection.PasteAndFormat(wdFormatPlainText)Word.Selection.WholeStorystr = Word.Selection.TextWord.Quit FalseWScript.Echo str
Microsoft Forms 2.0 Object Library.
'Set the contents of the clipboard Dim Form, TextBoxSet Form = CreateObject ("Forms.Form.1")Set TextBox = Form.Controls.Add ("Forms.TextBox.1").ObjectTextBox.MultiLine = TrueTextBox.Text = "Forget, like a person's feelings"TextBox.SelStart = 0TextBox.SelLength = TextBox.TextLengthTextBox.Copy'Get the contents of the clipboard Dim Form, TextBoxSet Form = CreateObject ("Forms.Form.1")Set TextBox = Form.Controls.Add ("Forms.TextBox.1").ObjectTextBox.MultiLine = TrueIf TextBox.CanPaste Then TextBox.Paste WScript.Echo TextBox.TextEnd If Thank you for reading this article carefully, Hope Xiaobian shared "VBS how to access the clipboard" this article is helpful to everyone, but also hope that everyone a lot of support, pay attention to the industry information channel, more relevant knowledge waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.