定时刷新IE页面的VBS脚本

脚本启动后可按照设定时间间隔刷新IE当前页面,用于完成某些特定的任务。若IE实例不存在,则退出。

time=<刷新间隔的秒数>

'Dim the primary objects.

Dim objApp
Dim objIE
Dim objWindow
Dim time
time = 1000*3600
'Set the primary objects.

Set objApp = CreateObject("Shell.Application")
Set objIE = Nothing

'Identify the IE window and connect.

For Each objWindow In objApp.Windows
  If (InStr(objWindow.Name, "Internet Explorer")) Then
    Set objIE = objWindow
    Exit For
  End If
Next

With objIE
	

  .Visible = True    'Make sure to set the window of IE to visible.
	Set objDoc = objIE.Document
	
  Do While .Busy Or .readyState <> 4
    'Do nothing, wait for the browser to load.
  Loop

  Do While .Document.ReadyState <> "complete"
    'Do nothing, wait for the VBScript to load the document of the website.
  Loop
  Do While True 
  Wscript.Sleep time
  objDoc.Location.Reload(True)
  
  Loop

End With 

'Clear the objects.

On Error Resume Next 

objApp = Nothing 
objIE = Nothing 
objWindow = Nothing

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值