发布于 2011-03-02 16:17:27
9楼
我把以前VB写的自动登录本论坛代码改编成VBS代码分享给大家,把下面的代码保存为一个扩展名为vbs的文件执行即可,注意把用户名和密码输入进去
注意Ws cript被强制插入了空格
Dim ie, doc, UserName, Password,s,vTag
UserName="论坛登录名" '用户名
Password="登录密码" '密码
Set ie=Ws cript.CreateObject("InternetExplorer.Application","event_")
' ie.Visible=True '如果显示登录过程,取消本行注释
ie.Navigate "http://www.ad.siemens.com.cn/MySupport/login.aspx?from=/club/bbs/logintrace.aspx"
Ws cript.sleep 30000 '延时30秒
Sub event_DocumentComplete(pDisp, URL)
s = Mid(URL, InStrRev(URL, "/") + 1, 20)
If s = "login.aspx" or s = "logintrace.aspx" Then
Set doc = ie.Document
doc.getElementByID("txtUsername").Value = UserName
doc.getElementByID("txtPassword").Value = Password
doc.getElementByID("ctl00_ContentPlaceHolder_btnLogin").Click
End If
If s <> "logintrace.aspx" And s <> "login.aspx" And s <> "javas cript:false" Then
' ie.Navigate "http://www.ad.siemens.com.cn/club/bbs/bbs.asp?b_id=3"
'可更改为登录后想切换到的网址
ie.Visible = True '显示浏览器窗口
Ws cript.Quit
End If
End Sub