学vbscript也有一段时间啦,这是我用两天时间写的,是不是觉得时间有点长啊,刚学不是太久,不是很熟练,觉得对大家应该有帮助,所以发上来,高手看了不要见笑哦
Set oNetwork = WScript.CreateObject("WScript.Network")
computername=oNetwork.ComputerName
'获取计算机名
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set objShare = objWMIService.Get("Win32_Proxy.ServerName='computername'")
Set objInParam = objShare.Methods_("SetProxySetting"). _
inParameters.SpawnInstance_()
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\1.txt", ForReading)
input=inputbox("请输入你要刷的网站名:" +chr(13)+ _
"例如:" +chr(13)+ _
"http://hi.baidu.com/icecoldheart","请输入地址")
if input<>"" then
Do Until objFile.AtEndOfStream
strNextLine = objFile.ReadLine
If Len(strNextLine) > 0 Then
strLine = strNextLine
address=instr(1,strline,":",1)
ip=left(strline,address-1)
port=right(strline,len(strline)-address)
'这是读文本的代码一直读到文本的最后一行
' 添加端口号和代理服务器地址
objInParam.Properties_.Item("ProxyPortNumber") = port
objInParam.Properties_.Item("ProxyServer") = ip
'这的strline在赋值的时候不能加双引号
Set objOutParams = objWMIService.ExecMethod("Win32_Proxy.ServerName='computername'",
"SetProxySetting", objInParam)
set objshell=createobject("wscript.shell")
set objie=createobject("internetexplorer.application")
objie.visible=true
objshell.appactivate "Windows Internet Explorer"
wscript.sleep 3000
objshell.sendkeys "{tab}"
objshell.sendkeys input
'这的input和上面的strline一样赋值的时候不能加双引号
objshell.sendkeys "{enter}"
wscript.sleep 6000
objie.quit
End If
Loop
objFile.Close
end if
哈哈,做了一下广告,代码中的那个网址是我的网志,欢迎大家来哦
Last edited by icyheart on 2007-9-24 at 03:11 PM ]