查分VBS

[ 2009-01-22 17:48:35 | Author: wujimmy ]
Font Size: Large | Medium | Small
Function getHTTPPage(url)
On Error Resume Next
Dim http
Set http = CreateObject("Microsoft.XMLHTTP")
http.Open "GET", url, False
http.send
If http.readystate <> 4 Then
Exit Function
End If
getHTTPPage = bytes2BSTR(http.responseBody)
Set http = Nothing

End Function

Function bytes2BSTR(vIn)
Dim strReturn
Dim i1, ThisCharCode, NextCharCode
strReturn = ""
For i1 = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn, i1, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn, i1 + 1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i1 = i1 + 1
End If
Next
bytes2BSTR = strReturn
End Function



Function GetMid(txt, StrOne, StrTwo)
NumOne = InStr(txt, StrOne)
NumTwo = InStr(txt, StrTwo)
If NumOne = 0 Or NumTwo = 0 Then GetMid = "": Exit Function
GetMid = Mid(txt, NumOne + Len(StrOne), NumTwo - NumOne - Len(StrOne))
End Function

Function mymsgbox(str, time)
Set ws = CreateObject("WScript.shell")
mymsgbox = ws.popup(str, time, str, 1)
End Function


'VBScript.RegExp

Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches ' 建立变量。
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分大小写。
regEx.Global = True ' 设置全局替换。
Set Matches = regEx.Execute(strng) ' 执行搜索。
For Each Match In Matches ' 遍历 Matches 集合。
' retstr = retstr & "Match " & I & " found at position "
' retstr = retstr & Match.FirstIndex & ". Match Value is " '
retstr = retstr & Match.Value & "'." & "\t"
Next
RegExpTest = retstr
End Function

Function test()

retstr = getHTTPPage("http://www.8315.cn/sms/fjpta_score_print2.asp?title=全国一、二级注册结构工程师资格考试&year=2008&cmd=ZCJG&zkzh=123&sfzh=321")

'MsgBox retstr
retstr2 = RegExpTest("..............记录..................................", retstr)
retstrno = RegExpTest("....暂无..............................", retstr)

If (retstr2 <> "") Then
test = mymsgbox(retstr2, 9000)
Else
test = mymsgbox(retstrno, 10)

End If

End Function

Do While test<>1
'msgbox test
Wscript.Sleep 200000
Loop
Comments Feed Comments Feed: http://www.jgcad.com/feed.asp?q=comment&id=329

There is no comment on this article.

Post Comment
Smilies
[微笑] [忧伤] [鬼脸] [高兴] [眨眼] [困惑] [爱意] [脸红] [吐舌头] [吻你]
[惊诧] [生气] [坏笑] [耍酷] [担心] [魔鬼] [大哭] [大笑] [不高兴] [挤眉弄眼]
[天使] [你讨厌] [不要] [瞌睡] [想主意] [不舒服] [请安静] [别理我] [小丑] [呆瓜]
[我好累] [好诱人] [考虑考虑] [哦!] [鼓掌] [小猪] [老牛] [猴子] [小鸡] [玫瑰花]
[好运气] [南瓜头] [咖啡] [好点子] [骷髅头] [外星人1] [外星人2] [郁闷] [牛仔] [祈祷]
[着魔了] [发财啦] [吹口哨] [你说谎] [被扁了] [马道成功] [别这样] [跳舞] [拥抱你]
Enable UBB Codes
Auto Convert URL
Show Smilies
自动复制
Hidden Comment
Username:   Password:   Register Now?