|
Re: Re:WScript.Sleep for HTA?
Malcolm McCaffery wrote:
> This is what I use:
>
> ' Sleep for HTA by Malcolm McCaffery
> Sub Sleep(intMilliSecs)
> CONST HideWindow=0
> CONST WaitForCompletion=TRUE
>
> ' Because HTA doesn't use Windows Script Host, it uses IE Script Host
> we can't use WScript.Sleep
> ' Workaround: send one ping command to fake address with a wait for
> reply value set in milliseconds
> cmd="cmd /c ping 1.1.1.1 -n 1 -w " & intMilliSecs
> With CreateObject("WScript.Shell")
> .Run cmd,HideWindow,WaitForCompletion
> End With
> End Sub
If this is for personal use, you could always install ScriptX (has a Wait
method) or AutoItX (has a Sleep method) - both are free.
Personally, I'm using the AutoItX v3 COM object...
Set aux = CreateObject("AutoItX3.Control")
aux.sleep 10000
--
Michael Harris
Microsoft.MVP.Scripting
|