Announcement

Collapse
No announcement yet.

VBS - Wait / Pause for xx seconds, then resume with the script?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBS - Wait / Pause for xx seconds, then resume with the script?

    Ey up,
    I've written a script like so:

    Code:
    Set WshShell = WScript.CreateObject("WScript.Shell")
    
    WshShell.Run ("\\server\directory\script1.vbs & WScript.ScriptFullName")
    
    WshShell.Run ("\\server\directory\script2.vbs & WScript.ScriptFullName")
    
    WshShell.Run ("\\server\directory\script3.vbs & WScript.ScriptFullName")
    
    WshShell.Run ("\\server\directory\script4.vbs & WScript.ScriptFullName")
    
    WshShell.Run ("\\server\directory\script5.vbs & WScript.ScriptFullName")
    
    WshShell.Run ("\\server\directory\script6.vbs & WScript.ScriptFullName")
    
    WshShell.Run ("\\server\directory\script7.vbs & WScript.ScriptFullName")
    
    WshShell.Run ("\\server\directory\script8.bat & WScript.ScriptFullName")
    When this is run in the logon script, it skips some.

    I thought a simple solution to resolve this would be to give the script a breather between each call.

    Is there a vb script which will run the script, pause for 10 seconds and then resume?

    Cheers,

    Andy

  • #2
    Re: VBS - Wait / Pause for xx seconds, then resume with the script?

    why not add the WScript.sleep command

    example

    WScript.sleep 60 would wait 60 secs

    Comment


    • #3
      Re: VBS - Wait / Pause for xx seconds, then resume with the script?

      I'm not sure if that example is correct for other systems, but on WinXP SP2, that example gives a delay of 60 milliseconds, not 60 seconds. (So one might not think the code was working since 60 milliseconds is so brief).

      To delay 60 seconds try this
      WScript.sleep 60000

      Comment


      • #4
        Re: VBS - Wait / Pause for xx seconds, then resume with the script?

        Two options to execute the 8 scripts consecutively (asynchronously):

        - Syntax
        WScript.Sleep time
        (Yes the delay is in milliseconds)

        - Syntax
        WshShell.Run strCommand, , TRUE
        (I think the last one is the best option for this)

        But above all, Is the problem in fact caused because the scripts execute simultaneously???
        How are the two parameters & and WScript.ScriptFullName used in each of these scripts???
        And could it be possible there is a space in one of the paths (http://www.ureader.com/message/80955.aspx)?

        (see the syntax in this 'Run method' example http://www.fpschultze.de/smartfaq+fa...94e94348ac.htm).


        \Rems

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment


        • #5
          Re: VBS - Wait / Pause for xx seconds, then resume with the script?

          please issachar don't reply to old postings

          \Rems

          This posting is provided "AS IS" with no warranties, and confers no rights.

          __________________

          ** Remember to give credit where credit's due **
          and leave Reputation Points for meaningful posts

          Comment


          • #6
            Re: VBS - Wait / Pause for xx seconds, then resume with the script?

            Well, it's not the only case here : http://forums.petri.com/showthread.php?t=7883
            I just wonder: is it really bad? Afterall, the answers are the right ones. So, even if the OP does not need it, the answers may help "future generations" , in search for the same solution.

            Sorin Solomon


            In order to succeed, your desire for success should be greater than your fear of failure.
            -

            Comment

            Working...
            X