VBS读网页的代码
时间:2021-04-13 09:13:11|栏目:VBS|点击: 次
直接将下面的代码保存为test.vbs双击运行就可,如果不能使用,请看自己的电脑是否vbs被禁用。
strURL = InputBox("请输入要读的网址", "朗读网页", "https://www.jb51.net/index.htm")
If strURL = "" Then
Wscript.quit
End If
Set ie = WScript.CreateObject("InternetExplorer.Application")
ie.visible = True
ie.navigate strURL
Do
Wscript.Sleep 200
Loop Until ie.ReadyState = 4
strContent = ie.document.body.innerText
Set objVoice = CreateObject("SAPI.SpVoice")
Set objVoice.Voice = objVoice.GetVoices("Name=Microsoft Simplified Chinese").Item(0)
objVoice.Rate = 5 '速度:-10,10 0
objVoice.Volume = 100 '声音:0,100 100
objVoice.Speak strContent
复制代码 代码如下:
strURL = InputBox("请输入要读的网址", "朗读网页", "https://www.jb51.net/index.htm")
If strURL = "" Then
Wscript.quit
End If
Set ie = WScript.CreateObject("InternetExplorer.Application")
ie.visible = True
ie.navigate strURL
Do
Wscript.Sleep 200
Loop Until ie.ReadyState = 4
strContent = ie.document.body.innerText
Set objVoice = CreateObject("SAPI.SpVoice")
Set objVoice.Voice = objVoice.GetVoices("Name=Microsoft Simplified Chinese").Item(0)
objVoice.Rate = 5 '速度:-10,10 0
objVoice.Volume = 100 '声音:0,100 100
objVoice.Speak strContent
上一篇:脚本编程3 关于文件的读写
栏 目:VBS
下一篇:添加网站到安全站点.设置安全站点打开ActiveX时提示.去页眉页脚的vbs代码
本文标题:VBS读网页的代码
本文地址:http://www.codeinn.net/misctech/100251.html