Set interval in vbscript

老子叫甜甜 提交于 2019-12-13 06:18:09

问题


I want to set interval time in vbscript Following is my code

Set objWord = CreateObject("Word.Application")
endTime= Timer()
'Set visibilty for the client application
objWord.Visible = True

WScript.Sleep 1000
'Close MS word process
objWord.Quit

I found WScript.Sleep 1000 or WScript.Sleep(1000) 1000 is in millisecond but both of them are not working fine, I am using window7


回答1:


Quick-and-dirty batch command is the safest and surest (though not the most accurate) way to get a delay.

' Get a 10 seconds delay

Delay 10
Sub Delay( seconds )
Dim wshShell
Set wshShell = CreateObject( "WScript.Shell" )
wshShell.Run "ping -n " & ( seconds + 1 ) & " 127.0.0.1", 0, True
Set wshShell = Nothing
End Sub

As seen on Rob van der Woude's Scripting Page .Here you can also find lot of good scripts



来源:https://stackoverflow.com/questions/9766258/set-interval-in-vbscript

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!