这是按我一个工具修改的- const config_ = "config.ini" '配置文件名称
- const ForReading = 1
- const ForWriting = 2
-
- Dim fso,Ieo,Control_Mark
- Set fso = CreateObject("Scripting.FileSystemObject")
-
- 'WScript.Echo ReadConfig
- RegExpConfig()
-
- Function ReadConfig()
- If (fso.FileExists(config_)) Then
- Set Readobj=fso.OpenTextFile(config_,ForReading)
- ReadConfig = Readobj.ReadAll
- Set readobj=Nothing
- Else
- WScript.Timeout = 10
- WScript.Echo "为了正常启动在当前目录下需要配置文件(" & config_ & ")"
- WScript.Quit
- End If
- End Function
-
- Function RegExpConfig() 'ReadTextStream
- Set RegTmp1 = New RegExp
- RegTmp1.Global = True
- RegTmp1.IgnoreCase = True
- RegTmp1.Pattern = "P(\d{3})=(\S+)\s(\S+)\s(\S+)"
- Set RegSet = RegTmp1.Execute(ReadConfig())
- For Each Match In RegSet
- Webbrowser Match.SubMatches(0),Match.SubMatches(1),Match.SubMatches(2),Match.SubMatches(3)
- 'WScript.Echo match.value
- 'Wscript.Echo Match.SubMatches(0) & Match.SubMatches(1) & Match.SubMatches(2)
- '根据子集数目列出数组 子集括号数-1
- 'For Each substr in match.submatches
- ' WScript.Echo substr
- 'Next
- '枚举
- Next
- End Function
-
- Function Webbrowser(Listnum_,Address_,UserName_,PassWord_)
- 'WScript.Echo "Address:" & Address_ & " UserName:" & UserName_ & " Password:" &PassWord_
- Control_Mark = True
- Set Ieo = WScript.CreateObject("InternetExplorer.Application","Event_")
- Ieo.Navigate (Address_)
- While (Ieo.Busy)
- WScript.Sleep 200
- Wend
- Ieo.Visible=1
- Ieo.Document.All.wd.Value=" UserName:" & UserName_ & " Password:" &PassWord_
- Ieo.Document.All.sb.click
- While Control_Mark
- WScript.Sleep 200
- Wend
- 'WScript.Echo Listnum_ & "已完成操作"
- End Function
-
-
-
- Sub Event_OnQuit()
- Set Ieo = Nothing
- Control_Mark = False
- 'WScript.Echo 当前IE实例已释放"
- End Sub
-
-
-
- '''''''''''''''''''''''''config_示例'''''''
- '[Server]
- 'P001=www.baidu.com admin1 123456a
- 'P002=www.baidu.com admin2 123456b
- 'P003=www.baidu.com admin3 123456c
- ''''''''''''''''''''''''''''''''''''''''''
复制代码
|