setTimeout method help

Discussion in 'Scripting' started by Mark, Feb 6, 2004.

  1. Mark

    Mark Guest

    I have an HTML application that runs thru a For Loop with an array of
    servers. I am tyring to to use the setTimeout method to update a progress
    bar that I have. I want the progress bar to update each time I go thru the
    For Loop.

    The problem that I am having is that my progress bar is not updating until
    after all of the code proceeding my timer statement has been executed. In
    otherwords, my timer statement is the first call in my For Loop and it
    doesn't appear to be executing until the end.

    any ideas?


    Mark, Feb 6, 2004
    1. Advertisements

  2. Mark

    Tom Lavedas Guest

    Your FOR loop is hogging all available processing time.
    The only way that I have found to use setTimeout to do
    what you want is to make it the last line executed in a
    subroutine and use the timeout to recall the routine,
    maybe something like this ...

    Dim GlobalCounter
    GlobalCounter = 0
    YourLoopProcess ' call the process the first time

    Sub YourLoopProcess()
    ' Execute the process step here ...
    GlobalCounter = GlobalCounter + 1
    if not GlobalCounter = > LoopLimit Then
    "Update you progress bar here ...
    setTimeOut "YourLoopProcess", 100, "vbscript"
    'Clear bar and indicate you're done here
    End if
    End Sub

    (I'm sorry, but I script almost exclusively in VBScript,
    so you'll need to translate to JScript, if that's what you

    Tom Lavedas
    Tom Lavedas, Feb 6, 2004
    1. Advertisements

  3. Mark

    Mark Guest

    I figured there was no processor time for my timeout to occur, but wasn't
    sure. I use VBScript as well.

    I'll it and see what happens.


    Mark, Feb 6, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.