View Single Post
  #3 (permalink)  
Old 06-12-2007, 05:21 AM
rickety
 
Posts: n/a
Re: WScript.Sleep for HTA?

On Jun 10, 12:13 am, "Michael Harris \(MVP\)" <mikhar.at.mvps.dot.org>
wrote:
> 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- Hide quoted text -
>
> - Show quoted text -


There is another workaround that you may find interesting, using the
setTimeOut function of the DOM

Function Blahblah
......
IntervalMarker = setTimeout("CarryOn", 50, "vbscript")
End Function
'
' ===== carries on from above when interval expires
' this "feature" allows the updated status message to be
' rendered and viewed by the user
'
Function CarryOn ' Code to be executed after the
delay
.... more of this function
End Function

Reply With Quote