本帖最后由 batman 于 2013-1-20 18:51 编辑
- Dim Urls, Arr
- Urls = "http://www.baidu.com,http://www.sina.com.cn"
- Arr = Split(Urls, ",")
- Dim objIE, objTitles
- Set objIE = CreateObject("InternetExplorer.Application")
- objIE.Visible = False
- For i = 0 To UBound(Arr)
- objIE.Navigate Arr(i)
- Do Until objIE.ReadyState = 4 : WScript.Sleep 200 : Loop
- objTitles = objTitles & objIE.Document.GetElementsByTagName("title")(0).InnerText & "@#$"
- Next
- objIE.Quit
- Set objIE = Nothing
- Arr = Split(objTitles, "@#$")
- Do Until CreateObject("Scripting.FileSystemObject").FileExists("finish")
- Dim objSHELL
- Set objSHELL = CreateObject("Wscript.Shell")
- Dim objWORD, objTasks, objTask, objStr
- Set objWORD = CreateObject("Word.Application")
- Set objTasks = objWORD.Tasks
- For Each objTask in objTasks
- On Error Resume Next
- If objTask.Visible Then
- For i = 0 To UBound(Arr) - 1
- If InStr(objTask.Name, Arr(i)) Then
- objStr = Split(objTask.Name, " ")(0)
- objSHELL.Popup "五秒后将自动关闭“" & objStr & "”窗口", 5
- objTask.Close
- If Err.Number <> 0 Then Err.Clear
- End If
- Next
- End If
- Next
- objWORD.Quit
- Set objWORD = Nothing
- Set objSHELL = Nothing
- WScript.Sleep 1000
- Loop
复制代码
|