[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
还是半自动版:
在后台监视到新链接后报警,并启动IE,验证码必须手动输入,其它的当然也可以自己输入,完后得自己手动提交。
抢不抢得到沙发不一定,但相信在一般情况下绝对能出现在留言首页:)
  1. Option Explicit
  2. Dim sFile, iInterval, sLink
  3. sFile = "link.wri" 'where the last link is saved
  4. iInterval = 30 'how many seconds between twice check
  5. ShowUsage
  6. Do
  7. sLink = GetLink(sFile)
  8. CheckLink sLink, iInterval
  9. OpenLink sLink
  10. PutLink sFile, sLink
  11. PlaySound
  12. InputBox "The blog has updated!", "Information", sLink
  13. Loop
  14. Sub ShowUsage()
  15. MsgBox _
  16. " Run the tool and never kill its process unless " & "you indeed know what you're doing. " & vbCrLf & _
  17. " When the tool finds that the blog has updated, it'll pop up an IE window which display " & vbCrLf & _
  18. "the right new blog, in which you can reply after inputing some messages." & vbCrLf & _
  19. " Almost at the same time, it'll start to alarm for a few seconds. " & vbCrLf & _
  20. " Then an input box will appear, where you can copy the new link and which will also attract " & vbCrLf & _
  21. "your attention to tell you a new blog has been born." & vbCrLf & _
  22. " After you close the input box, it'll continue to monitor." & vbCrLf & _
  23. " So if you'd like to stop it, you'll have to kill its process named wscript.exe." & vbCrLf & vbCrLf & vbCrLf & _
  24. " Have a good time!", _
  25. _
  26. vbInformation, _
  27. _
  28. "by youxi01, everest79, pusofalse, rat & other guys@bbs.bathome.net 2008-11-21 19:22"
  29. End Sub
  30. Function GetLink(sFile)
  31. Const LINK = "http://blog.sina.com.cn/s/blog_49aaa3430100c9od.html", READ = 1
  32. Dim oFso, oFile
  33. Set oFso = CreateObject("Scripting.FileSystemObject")
  34. If Not oFso.FileExists(sFile) Then
  35. PutLink sFile, LINK
  36. GetLink = LINK
  37. Else
  38. Set oFile = oFso.OpenTextFile(sFile, READ, False)
  39. GetLink = oFile.ReadLine()
  40. oFile.Close
  41. Set oFile = Nothing
  42. End If
  43. Set oFso = Nothing
  44. End Function
  45. Sub CheckLink(sLink, iInterval) 'idea from everest79
  46. Const URL = "http://blog.sina.com.cn/rss/shuchang.xml", COMPLETE = 4
  47. Dim oXmlHttp, sNewLink
  48. Set oXmlHttp = CreateObject("Msxml2.XMLHTTP")
  49. Do
  50. oXmlHttp.open "Get", URL, False
  51. oXmlHttp.send
  52. sNewLink = oXmlHttp.responseXML _
  53. .selectSingleNode("rss") _
  54. .selectSingleNode("channel") _
  55. .selectSingleNode("item") _
  56. .selectSingleNode("link") _
  57. .text
  58. Do Until oXmlHttp.readyState = COMPLETE
  59. WScript.Sleep 100
  60. Loop
  61. If sNewLink <> sLink Then
  62. sLink = sNewLink 'ByRef by default
  63. Exit Do
  64. Else
  65. WScript.Sleep iInterval * 1000
  66. End If
  67. Loop
  68. Set oXmlHttp = Nothing
  69. End Sub
  70. Sub OpenLink(sLink)
  71. Const COMPLETE = 4, _
  72. NAME = "bbs.bathome.net", _
  73. COMMENT = "We love you forever!", _
  74. BBS = "http://bbs.bathome.net/thread-2465-1-1.html"
  75. Dim oIE, oDocument, oWindow
  76. Set oIE = CreateObject("InternetExplorer.Application")
  77. oIE.Navigate sLink
  78. Do While (oIE.Busy Or (oIE.ReadyState <> COMPLETE))
  79. WScript.Sleep 100
  80. Loop
  81. Set oDocument = oIE.Document
  82. oDocument.All("anonymity_name").Value = NAME
  83. oDocument.All("commentArea").Value = COMMENT & vbCrLf & vbCrLf & BBS
  84. oDocument.All("anonymity").Checked = True
  85. oDocument.All("login_check").Click
  86. oDocument.All("comment_post_btn").InsertAdjacentHTML "AfterEnd", _
  87. "<div align=""right"">" & _
  88. "<a target=""_blank"" href=""" & BBS & """>The topic about the tool...</a>" & _
  89. "</div>"
  90. Set oWindow = oDocument.ParentWindow
  91. 'oWindow.ReSizeTo oScreen.Width, oScreen.Height
  92. 'oWindow.MoveTo 0, 0
  93. oWindow.Scroll 0, oIE.Document.Body.ScrollHeight 'idea from everest79
  94. 'It doesn't scroll to the bottom, why?
  95. 'And if there is a MsgBox before it, it seems as if it'll work...
  96. oIE.Visible = True
  97. 'oIE.Quit 'wait for inputting validation code
  98. Set oWindow = Nothing
  99. Set oDocument = Nothing
  100. Set oIE = Nothing
  101. End Sub
  102. Sub PutLink(sFile, sLink)
  103. Const WRITE = 2
  104. Dim oFso, oFile
  105. Set oFso = CreateObject("Scripting.FileSystemObject")
  106. Set oFile = oFso.OpenTextFile(sFile, WRITE, True)
  107. oFile.WriteLine sLink
  108. oFile.Close
  109. Set oFile = Nothing
  110. Set oFso = Nothing
  111. End Sub
  112. Sub PlaySound()
  113. Dim oWsh
  114. Set oWsh = CreateObject("WScript.Shell")
  115. oWsh.Run "mplay32 /play /close %SystemRoot%\Clock.avi", 0, True
  116. Set oWsh = Nothing
  117. End Sub
复制代码
2

评分人数

    • everest79: 针对此脚本学习xmlhttp及xml dom相关PB + 6 技术 + 1
    • pusofalse: 厉害!PB + 10 技术 + 1

TOP

去了临时文件,全自动回复,很好!

不过还有小问题:我这边测试执行完CheckIN后,好像oIe就没了,总是提示什么已与客户断开连接。
对了,执行oIe.Navigate Checkwd 时,我这儿是提示下载图片。(XP Home + IE6)

还有,根据进程变化是什么意思呢?我好像多次运行此vbs脚本得到的验证码都是一样的。

TOP

返回列表