Hi,

This following script executes a traceroute to 213.13.135.13 every ~30
seconds.

--------------------------------------------------
option explicit
dim so
dim st
st = timer()
while true
if (timer() - st) >= 30 then
set so = createobject("wscript.shell")
so.run "cmd /c tracert 213.13.135.13"
set so = nothing
st = timer()
end if
wend
--------------------------------------------------

... the problem is that the "while true" loop consumes 100% of CPU.

Is there a better way of doing this? Something like a "sleep" method?

Thanks,
rusga

Re: 100% CPU script by rusga

rusga
Fri Oct 29 14:24:37 CDT 2004

Got it!

The method is:
wscript.sleep [miliseconds]

So, the script is now:
--------------------------------------------
option explicit
dim so
while true
wscript.sleep 30000
set so = createobject("wscript.shell")
so.run "cmd /c tracert 213.13.135.13"
set so = nothing
wend
--------------------------------------------

Regards,
rusga


On Fri, 29 Oct 2004 19:56:53 +0100, rusga <reply2newsgroup@nntp> wrote:

> Hi,
>
> This following script executes a traceroute to 213.13.135.13 every ~30
> seconds.
>
> --------------------------------------------------
> option explicit
> dim so
> dim st
> st = timer()
> while true
> if (timer() - st) >= 30 then
> set so = createobject("wscript.shell")
> so.run "cmd /c tracert 213.13.135.13"
> set so = nothing
> st = timer()
> end if
> wend
> --------------------------------------------------
>
> ... the problem is that the "while true" loop consumes 100% of CPU.
>
> Is there a better way of doing this? Something like a "sleep" method?
>
> Thanks,
> rusga