VBS读网页的代码
程序员文章站
2022-07-04 20:26:37
直接将下面的代码保存为test.vbs双击运行就可,如果不能使用,请看自己的电脑是否vbs被禁用。复制代码 代码如下:strurl = inputbox("请输入要读的网址...
直接将下面的代码保存为test.vbs双击运行就可,如果不能使用,请看自己的电脑是否vbs被禁用。
strurl = inputbox("请输入要读的网址", "朗读网页", "//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("请输入要读的网址", "朗读网页", "//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