Batch User Posted October 9, 2007 Share Posted October 9, 2007 (edited) There is a game and there is a bot for the game that you can design VBS scripts to work. I know you don't know how the bot works but you may be able to help with this.Simple vbscript to check forum members against site, but I'm having trouble with Inet. Someone help me to parse a site? I get an error with .openurlCODEPublic Const title = "Clan Check by AwaKening"'// Title for default new Registrations to forumPublic Const fm = "Forum Member"'// Title for Clan MembersPublic Const cm = "Clan RnR"Public Const forum = "http://clanrnr.com/index.php?act=Members"Public Const bnet = "http://www.battle.net/war3/ladder/w3xp-clan-profile.aspx?Gateway=Lordaeron&ClanTag=RnR"Dim oDict, INet1Set INet1 = CreateObject("Microsoft.XmlHttp")Set oDict = CreateObject("Scripting.Dictionary")oDict.CompareMode = 1Call ClanCheck()Sub ClanCheck() Dim inclan, content, i, pages, users, n, name content = INet1.openUrl(bnet) If InStr(content,"Error Encountered")>1 Then MsgBox "Error! The Battle.net clan page was unreachable." Exit Sub End If inclan = Mid(content,Instr(content,"Total Members:")) inclan= Split(inclan,">")(5) inclan = Left(inclan,2) i = Int(inclan) pages = Int(i/15) If i Mod 15 > 0 Then pages=pages+1 End If For n=1 to pages content = INet1.OpenURL(bnet & "&pageno=" & n) users=split(content,"PlayerName=") For i=1 to ubound(users) name=Left(users(i),InStr(users(i),">")-2) name = Replace(name,"%5b","[") name = Replace(name,"%5d","]") oDict.Add name, i Next Next Call ForumCheck()End SubSub ForumCheck() Dim i, n, content, pages, names, name, status, unregistered, remove, add content = INet1.OpenURL(forum) pages = 0 If InStr(content, "Pages:</a> (") > 0 Then pages = Int(Left(Split(content, "Pages:</a> (")(1),1)) End If For i=0 to pages content = INet1.OpenURL(forum & "&st=" & i) names = Split(content,"<strong><a href=") For n=0 to UBound(names) name = Split(Split(names, ">")(1),"<")(0) status = Split(Split(names, ">")(8),"<")(0) If oDict.Exists(name) Then If status = fm Then add = name & ", " End If oDict.Remove name ElseIf status = cm Then remove = name & ", " End If Next Next If oDict.Count > 0 Then For each k in oDict.Keys unregistered = k & ", " Next unregistered = Left(unregistered, Len(unregistered)-2) MsgBox "Unregistered members: " & unregistered End If If add <> vbNullString Then add = Left(add, Len(add)-2) MsgBox "Change the following members to " & cm & ": " & add End If If remove <> vbNullString Then remove = Left(remove, Len(remove)-2) MsgBox "Change the following to " & fm & ": " & remove End If End SubAlso, I spotted a couple of other errors, but just look past them for now. I just need Inet working.<Edit>Code tags now replaced by codebox in order to help with browser layout formatting</Edit> Edited October 9, 2007 by Yzöwl quote tags replaced Link to comment Share on other sites More sharing options...
Yzöwl Posted October 9, 2007 Share Posted October 9, 2007 It would certainly help if you were to post formatted code!In the meantime I'll have to put put your 'code' into 'code tags' instead of 'quote tags'!The secret is in the name...PSPlease ensure that your formatted code is placed inside 'codebox tags' Link to comment Share on other sites More sharing options...
Batch User Posted October 9, 2007 Author Share Posted October 9, 2007 Oh I'm sorry I didn't realize that. Link to comment Share on other sites More sharing options...
Yzöwl Posted October 9, 2007 Share Posted October 9, 2007 It would certainly help if you were to post formatted code!Oh I'm sorry I didn't realize that.What's that supposed to mean?Since your response did not mention your intention to do so; are you, or are you not, intending to format that code into something readable.Do you expect everyone who is willing to help to also be in posession of a code formatter/beautifier in order to begin to decipher and debug on your behalf. Link to comment Share on other sites More sharing options...
Batch User Posted October 9, 2007 Author Share Posted October 9, 2007 (edited) I apologize for the inconvenience.Public Const title = "Clan Check by AwaKening"'// Title for default new Registrations to forumPublic Const fm = "Forum Member"'// Title for Clan MembersPublic Const cm = "Clan RnR"Public Const forum = "http://clanrnr.com/index.php?act=Members"Public Const bnet = "http://www.battle.net/war3/ladder/w3xp-clan-profile.aspx?Gateway=Lordaeron&ClanTag=RnR"Dim oDict, INet1Set INet1 = CreateObject("Microsoft.XmlHttp")Set oDict = CreateObject("Scripting.Dictionary")oDict.CompareMode = 1Call ClanCheck()Sub ClanCheck() Dim inclan, content, i, pages, users, n, name content = INet1.openUrl(bnet) If InStr(content,"Error Encountered")>1 Then MsgBox "Error! The Battle.net clan page was unreachable." Exit SubEnd Ifinclan = Mid(content,Instr(content,"Total Members:"))inclan= Split(inclan,">")(5)inclan = Left(inclan,2)i = Int(inclan)pages = Int(i/15)If i Mod 15 > 0 Then pages=pages+1End If For n=1 to pages content = INet1.OpenURL(bnet & "&pageno=" & n) users=split(content,"PlayerName=") users=split(content,"PlayerName=") name=Left(users(i),InStr(users(i),">")-2) name = Replace(name,"%5b","[") name = Replace(name,"%5d","]") oDict.Add name, i Next Next Call ForumCheck()End SubSub ForumCheck()Dim i, n, content, pages, names, name, status, unregistered, remove, add content = INet1.OpenURL(forum) pages = 0 If InStr(content, "Pages:</a> (") > 0 Then pages = Int(Left(Split(content, "Pages:</a> (")(1),1))End If For i=0 to pages content = INet1.OpenURL(forum & "&st=" & i) names = Split(content,"<strong><a href=") For n=0 to UBound(names) name = Split(Split(names, ">")(1),"<")(0) status = Split(Split(names, ">")(8),"<")(0) If oDict.Exists(name) Then If status = fm Then add = name & ", " End If oDict.Remove name ElseIf status = cm Then remove = name & ", End If NextNext If oDict.Count > 0 Then For each k in oDict.Keys unregistered = k & ", "Nextunregistered = Left(unregistered, Len(unregistered)-2)MsgBox "Unregistered members: " & unregisteredEnd IfIf add <> vbNullString Then add = Left(add, Len(add)-2) MsgBox "Change the following members to " & cm & ": " & add End IfIf remove <> vbNullString Then remove = Left(remove, Len(remove)-2) MsgBox "Change the following to " & fm & ": " & remove End IfEnd Sub Edited October 9, 2007 by Yzöwl code tags replaced with codebox tags Link to comment Share on other sites More sharing options...
Batch User Posted October 10, 2007 Author Share Posted October 10, 2007 Please? Yzowl? Link to comment Share on other sites More sharing options...
Yzöwl Posted October 10, 2007 Share Posted October 10, 2007 Since you believe that the problem lies with .openUrl, then we'll look at changing it.try replacingcontent = INet1.openUrl(bnet)If InStr(content,"Error Encountered")>1 Then MsgBox "Error! The Battle.net clan page was unreachable." Exit SubEnd IfwithINet1.Open "GET", bnet, FalseINet1.SendIf Err.Number <> 0 Or INet1.Status <> 200 Then MsgBox "Error! The Battle.net clan page was unreachable" Exit SubEnd Ifcontent = INet1.ResponseTextand use a similar idea in your ForumCheck subroutine. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now