In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how VBScript crawls URL through the clipboard and opens it in the browser, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
This is a very interesting question, or should we say, these are two very interesting questions. Because you actually asked two questions. The first question is simple: can I use a script to open a specific Web site? You probably already know the answer, I can answer you loudly, yes! The following is an example script that stores the URL of the script center in a variable named strURL. The script then creates an instance of the WSH Shell object and uses the Run method to open the default Web browser and navigate to the specified URL:
StrURL = "http://www.microsoft.com/technet/scriptcenter/default.mspx"
Set objShell = CreateObject ("Wscript.Shell")
ObjShell.Run (strURL)
The second question is a bit tricky: can I use scripts to grab information from the clipboard? The answer to this question is also "yes", although you must reach the clipboard through the backdoor program.
Neither WSH nor VBScript can interact with the clipboard: neither allows you to copy data to or paste data from the clipboard. Internet Explorer, on the other hand, can interact with the clipboard. Look, Internet Explorer can do anything! (so let IE do the work for us. If you want to grab data from the clipboard, you can use code similar to the following:
Set objIE = CreateObject ("InternetExplorer.Application")
ObjIE.Navigate ("about:blank")
StrURL = objIE.document.parentwindow.clipboardData.GetData ("text")
ObjIE.Quit
Wscript.Echo strURL
Here, what we do is create an instance of Internet Explorer and open it in a blank page. Note that you can't actually see this IE instance because we didn't set the Visible property to TRUE. Everything happens backstage.
Then, we use the clipboardData.GetData method to get the text placed on the clipboard and store it in the variable strURL; that's what the following line of code does:
StrURL = objIE.document.parentwindow.clipboardData.GetData ("text")
We close the IE instance (objIE.Quit) and echo the values we retrieved from the clipboard.
Try to copy some text to the clipboard and run the script. You should get a message box containing the text you just copied to the clipboard.
Now there is only one thing left to do: put the two halves of the script together to form a complete script. The following script grabs a URL from the clipboard and opens the Web site in the default Web browser:
Set objIE = CreateObject ("InternetExplorer.Application")
ObjIE.Navigate ("about:blank")
StrURL = objIE.document.parentwindow.clipboardData.GetData ("text")
ObjIE.Quit
Set objShell = CreateObject ("Wscript.Shell")
ObjShell.Run (strURL)
This script is not bad. It has another advantage-it's not just for opening Web sites. Suppose you have a file path on your clipboard, such as "C:\ Scripts\ ScriptLog.txt". Run this script, the file will open in notepad (or any application you set to associate with the .txt file). If you have a path to a .doc file on your clipboard, this script will open the document in Microsoft Word. It is actually a generic file opening script, not just an open script that can only be used on Web sites.
Thank you for reading this article carefully. I hope the article "how to grab URL from the clipboard and open it in the browser" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is 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.