Prev: ScriptB
Next: MS Newgroups disappearing?
From: mbyerley on 21 Aug 2010 15:45 "Dave "Crash" Dummy" <invalid(a)invalid.invalid> wrote in message news:LvVbo.16010$wJ1.13813(a)newsfe08.iad... > mbyerley wrote: >> "Dave "Crash" Dummy" <invalid(a)invalid.invalid> wrote in message >> news:lFQbo.90644$xZ2.27486(a)newsfe07.iad... >>> If I want to delay something in a VBS script, I just use the "Sleep" >>> method, like: >>> >>> wscript.sleep(5000) MsgBox "At last!" >>> >>> But that code won't work in a HTA script because there is no WScript >>> object. Is there an alternative equivalent I can use? I can >>> kluge together a delay using the setTimeout function, but that can >>> get really messy. > >> In an HTA, you can mix disciplines, so you could use JScript and the >> setTimeout method... > > I thought I said that. The trouble with setTimeout is that it will not Yep.. You did. I missed it. But in your function tied to the setTimeOut, you can simply set a global Boolean value that is checked in a loop alternative to Sleep with the same outcome. Agreed it's a kludge, but not too terribly messy. > cause an inline pause in execution. Code immediately following the > setTimeout function will execute immediately. So what you have to do is > put all the code following the pause in a subroutine. If the pause is > part of another subroutine or in a loop waiting for some external event, > it is a real nightmare. > > -- > Crash > > Atheism is a matter of faith, too. |