Advertisement
riking

AutoFriendRequest.vbs

Aug 4th, 2011
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 6.44 KB | None | 0 0
  1. 'Copy and paste this entire message into Notepad.
  2. 'Change ShouldBeSeen from "True" to "False" to run in the background ("silently", although it still makes noise).
  3. 'pmax is the maximum size of the Places array.
  4. ' CONFIG OPTIONS START
  5. ShouldBeSeen = True
  6. pmax = 17
  7. max = 1000 ' Maximum user IDs
  8. ' CONFIG OPTIONS END
  9. 'Click on File > Save As...
  10. 'Click Desktop, then name it autoFR.vbs
  11. 'In the drop-down box labeled "File Type", select "All Files (*.*)".
  12. 'Double-click the file to run.
  13. 'To end the script early:
  14. 'a) close Internet Explorer
  15. 'b) hit Ctrl-Alt-Delete, then in Task Manager, go to Processes, click on wscript.exe (helps to sort by name),
  16. '       and click End Process. Then, terminate any iexplore.exe that it may have left behind.
  17. '
  18. '#########  NO TECH SUPPORT WILL BE PROVIDED FOR THIS  ##########
  19. 'The right to make exceptions is reserved.
  20. Dim objIE
  21. Dim objIE2 ' Multiple IE objects are used for pseudo-threading.
  22. Dim objIE3
  23. Dim objHTTP
  24. Dim PlaceIDs()
  25. Dim UserIDs()
  26.  
  27. Dim a
  28. Dim b
  29.  
  30. ' TASK: Get list of running games
  31. Set objHTTP = CreateObject("Msxml2.ServerXMLHTTP")
  32. objHTTP.Open "GET", "http://www.roblox.com/Games.aspx", False
  33. objHTTP.Send
  34. Tex = CStr(objHTTP.ResponseText)
  35. ReDim PlaceIDs(pmax)
  36. pind = 0
  37. position = InStr(Tex, "-item?id=")
  38. Do While True
  39.     id = Split(Mid(Tex, position+9, 16), """")(0)
  40.     PlaceIDs(pind) = id
  41.     pind = pind + 1
  42.     position = InStr(position+10,Tex,"-item?id=")
  43.     If position = 0 Then
  44.         Exit Do
  45.     End If
  46.     If pind = pmax Then
  47.         pmax = pmax + 4
  48.         ReDim Preserve PlaceIDs(pmax)
  49.     End If
  50. Loop
  51. pmax = pind
  52. Tex = ""
  53. Set objHTTP = Nothing
  54.  
  55. ' TASK: Load each place, in Internet Explorer (so that we have javascript)
  56. ' Only use the first IE object for now; this part goes quick anyways
  57.  
  58. Set objIE = CreateObject("InternetExplorer.application")
  59. objIE.Visible = ShouldBeSeen
  60.  
  61. pind = 0
  62. uind = 0
  63. ReDim UserIDs(max)
  64.  
  65. Do Until pind = pmax
  66.     If Rnd() < .3 Then
  67.         WaitIE1
  68.         objIE.Navigate "http://www.roblox.com/a-item?id=" & PlaceIDs(pind)
  69.         WaitIE1
  70.         objIE.Navigate "javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(""ctl00$cphRoblox$TabbedInfo$GamesTab$LoadGamesButton"", """", true, """", """", false, true))"
  71.        
  72.         WaitIE1
  73.         If isObject(objIE) Then  'Hacky crash fix
  74.             page = 1
  75.             WaitIE1
  76.             WScript.sleep 300
  77.             Tex = CStr(objIE.Document.Body.innerhtml)
  78.             position = InStr(Tex, "/User.aspx?ID=")
  79.             ' TASK: Capture the User IDs
  80.             Do Until position = 0
  81.                 id = Split(Mid(Tex, position+14, 20), """")(0)
  82.                 UserIDs(uind) = id 'store it
  83.                 uind = uind + 1
  84.                 If uind = max Then 'expand array
  85.                     max = max + 250
  86.                     ReDim Preserve UserIDs(max)
  87.                 End If
  88.                 position = InStr(position+1, Tex, "/User.aspx?ID=")
  89.             Loop
  90.             'next page
  91.             objIE.Navigate "javascript:__doPostBack('ctl00$cphRoblox$TabbedInfo$GamesTab$RunningGamesDataPager_Footer$ctl01$ctl0" & page & "','')"
  92.             WaitIE1
  93.             ' Wait for the page to completely load
  94.             Do While Not isObject(objIE.Document)
  95.                 Wscript.sleep 500
  96.             Loop
  97.             Tex = CStr(objIE.Document.Body.innerhtml)
  98.             position = InStr(Tex, "/User.aspx?ID=")
  99.             'Get the user IDs
  100.             Do Until position = 0
  101.                 id = Split(Mid(Tex, position+14, 20), """")(0)
  102.                 UserIDs(uind) = id 'store it
  103.                 uind = uind + 1
  104.                 If uind = max Then 'expand array
  105.                         max = max + 250
  106.                         ReDim Preserve UserIDs(max)
  107.                 End If
  108.                 position = InStr(position+1, Tex, "/User.aspx?ID=")
  109.             Loop
  110.             objIE.Navigate "javascript:__doPostBack('ctl00$cphRoblox$TabbedInfo$GamesTab$RunningGamesDataPager_Footer$ctl01$ctl0" & page & "','')"
  111.             WaitIE1
  112.             Tex = CStr(objIE.Document.Body.innerhtml)
  113.             position = InStr(Tex, "/User.aspx?ID=")
  114.             'Capture user IDs
  115.             Do Until position = 0
  116.                 id = Split(Mid(Tex, position+14, 20), """")(0)
  117.                 UserIDs(uind) = id 'store it
  118.                 uind = uind + 1
  119.                 If uind = max Then 'expand array
  120.                     max = max + 250
  121.                     ReDim Preserve UserIDs(max)
  122.                 End If
  123.                 position = InStr(position+1, Tex, "/User.aspx?ID=")
  124.             Loop
  125.         Else 'Corresponds to "Hacky Crash Fix"
  126.             Set objIE = CreateObject("InternetExplorer.application")
  127.         End If
  128.         pind = pind + 1
  129.     End If
  130. Loop
  131. ' Dump extra memory and quit IE
  132. ReDim Preserve UserIDs(uind-1)
  133. WaitIE1
  134. objIE.Quit
  135.  
  136. 'Create our new IE objects. This is the pseudothreading part, since sending friend requests takes a while.
  137. Set objIE = CreateObject("InternetExplorer.application")
  138. objIE.Visible = ShouldBeSeen
  139. Set objIE2 = CreateObject("InternetExplorer.application")
  140. objIE2.Visible = ShouldBeSeen
  141. Set objIE3 = CreateObject("InternetExplorer.application")
  142. objIE3.Visible = ShouldBeSeen
  143. EnsureLoggedIn 'cause we don't want to get errors EVERY time...
  144. 'Send Friend Requests
  145. uind2 = 0
  146. Do Until uind2 = uind
  147.     objIE.Navigate "http://www.roblox.com/My/FriendInvitation.aspx?RecipientID=" & UserIDs(uind2)
  148.     objIE2.Navigate "http://www.roblox.com/My/FriendInvitation.aspx?RecipientID=" & UserIDs(uind2+1)
  149.     objIE3.Navigate "http://www.roblox.com/My/FriendInvitation.aspx?RecipientID=" & UserIDs(uind2+2)
  150.     Do While objIE.Busy
  151.         WScript.sleep 300
  152.     Loop
  153.     Do While objIE2.Busy
  154.         WScript.sleep 100
  155.     Loop
  156.     Do While objIE3.Busy
  157.         WScript.sleep 100
  158.     Loop
  159.     objIE.Navigate "javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(""ctl00$cphRoblox$lbSend"", """", true, """", """", false, true))"
  160.     objIE2.Navigate "javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(""ctl00$cphRoblox$lbSend"", """", true, """", """", false, true))"
  161.     objIE3.Navigate "javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(""ctl00$cphRoblox$lbSend"", """", true, """", """", false, true))"
  162.     Do While objIE.Busy
  163.         WScript.sleep 100
  164.     Loop
  165.     Do While objIE2.Busy
  166.         WScript.sleep 100
  167.     Loop
  168.     Do While objIE3.Busy
  169.         WScript.sleep 100
  170.     Loop
  171.     uind2 = uind2 + 3
  172. Loop
  173. 'we're done here. bah-bye.
  174. objIE.Quit
  175. objIE2.Quit
  176. objIE3.Quit
  177. MsgBox("FINISHED")
  178. WScript.quit
  179.  
  180. Sub WaitIE1()
  181.     Do While objIE.Busy
  182.         WScript.sleep 200
  183.     Loop
  184. End Sub
  185.  
  186. Sub EnsureLoggedIn()
  187.     notlogged = True
  188.     Do While notlogged
  189.         objIE.Navigate "http://www.roblox.com/My/Home.aspx"
  190.         Do While objIE.Busy
  191.             WScript.sleep 200
  192.         Loop
  193.         If objIE.LocationURL <> "http://www.roblox.com/My/Home.aspx" Then
  194.             Login
  195.         Else
  196.             notlogged = False
  197.         End If
  198.     Loop
  199. End Sub
  200.  
  201. Sub Login()
  202.     'WARNING: DON'T CALL THIS WITHOUT objIE EXISTING!
  203.     objIE.Navigate "https://www.roblox.com/Login/Default.aspx"
  204.     objIE.Visible = True
  205.     Wscript.sleep 500
  206.     MsgBox("Please login. Close this box after logging in.")
  207.     objIE.Visible = ShouldBeSeen
  208. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement