VBS读取网页或.HTML的文字内容
意思是制作一个VBS脚本,能把网页的文字内容写到一个TXT文件中,比如说某网站有天气预告,而这脚本就把描述天气的文字内容复制下来…懂吗?有这可能吗?做得到的追加最高分…手...
意思是制作一个VBS脚本,能把网页的文字内容写到一个TXT文件中,比如说某网站有天气预告,而这脚本就把描述天气的文字内容复制下来…
懂吗?有这可能吗?
做得到的追加最高分…手机最高才悬赏20… 展开
懂吗?有这可能吗?
做得到的追加最高分…手机最高才悬赏20… 展开
2个回答
展开全部
我给你做了一个通过新浪天气获取城市天气预报的工具,自己研究一下,以后就可以修改使用了
Function zhuanghuan(wen)
For i = 1 To LenB(wen)
text = AscB(MidB(wen,i,1))
If text < &H80 Then
body = body & Chr(text)
Else
file = AscB(MidB(wen,i+1,1))
body = body & Chr(CLng(text) * &H100 + CInt(file))
i = i + 1
End If
Next
zhuanghuan = body
End Function
Function sear(sss,pt0)
set regex = New RegExp
regex.Pattern = pt0
regex.IgnoreCase = True
regex.Global = True
set matches = regex.Execute(sss)
for each match in matches
RetStr = RetStr & match.value
next
sear = RetStr
End Function
function getwet(url)
set xml = Createobject("MSXML2.XMLHTTP")
xml.open "GET",url,false
xml.send()
s = zhuanghuan(xml.responsebody)
ss = sear(s,"(.+)(sent_to_vb.+转发至微博)(.+)")
str = split(split(ss,"(")(1),")")(0)
getwet = str
end function
on error resume next
a = inputbox("输入城市名","静飞 天气预报查询 - by xiaomingtt","青岛")
if a = false then wscript.quit
u = "http://php.weather.sina.com.cn/search.php?f=1&c=1&city=" & a & "&dpc=1"
msgbox getwet(u),64,"静飞 天气预报 - by xiaomingtt"
Function zhuanghuan(wen)
For i = 1 To LenB(wen)
text = AscB(MidB(wen,i,1))
If text < &H80 Then
body = body & Chr(text)
Else
file = AscB(MidB(wen,i+1,1))
body = body & Chr(CLng(text) * &H100 + CInt(file))
i = i + 1
End If
Next
zhuanghuan = body
End Function
Function sear(sss,pt0)
set regex = New RegExp
regex.Pattern = pt0
regex.IgnoreCase = True
regex.Global = True
set matches = regex.Execute(sss)
for each match in matches
RetStr = RetStr & match.value
next
sear = RetStr
End Function
function getwet(url)
set xml = Createobject("MSXML2.XMLHTTP")
xml.open "GET",url,false
xml.send()
s = zhuanghuan(xml.responsebody)
ss = sear(s,"(.+)(sent_to_vb.+转发至微博)(.+)")
str = split(split(ss,"(")(1),")")(0)
getwet = str
end function
on error resume next
a = inputbox("输入城市名","静飞 天气预报查询 - by xiaomingtt","青岛")
if a = false then wscript.quit
u = "http://php.weather.sina.com.cn/search.php?f=1&c=1&city=" & a & "&dpc=1"
msgbox getwet(u),64,"静飞 天气预报 - by xiaomingtt"
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在asp里可以用VBScript来创建xmlhttp来做到,vbs下我做了一次,做不到.asp代码我就不发了.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |