Thread: Hung script
View Single Post
  #3 (permalink)  
Old December 8th, 2004, 10:00 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

In spite of your rude email to me not to respond to your help requests...

   If you want to stop the script from within the script - which you don't mention in your post - then you can either use a counter if you think it is caught in a loop, or use a time-out device if you know the script should never take more than a certain amount of time.

Ex 1: This script limits iterations to 20
'==========================================
i = 0

Do Until i = 20
    WScript.Echo i
    i = i + 1
Loop
'==========================================

Ex 2: This script shuts down after 5 seconds, even though the code will take a lot longer than that to execute.
'==========================================
WScript.Timeout = 5
i = 0

Do Until i = 3000000
    WScript.Echo i
    i = i + 1
Loop
'==========================================



mmcdonal
Reply With Quote