Hi,
I have a nice little script which ping's a certain IP address and if the address is online another piece of code is executed (sub1, sub2)
Although, I use to do some post install tasks after a linux server has been installed. It does the job fine, but when the newly installed server gives a ping reply it is still going to reboot for the last time.
So when my script starts copying files to the server it will become unavailable for a while.
Since I know how long it will take to reboot I want to build in a pause in the script to let it wait for a few minutes before calling "sub1" and "sub2" in the example below.
The bottom three lines work fine as a separate script. the "WScript.Sleep" command does it's job.
But when I integrate it into the script above it gives errors.
As I am a newby with scripting, I hope someone can help me out.
*****
Sub Window_onLoad
Set objShell = CreateObject("WScript.Shell")
boolPinged = Ping("10.10.10.10")
While boolPinged = False
' Wait for one second, given by -n #
objShell.Run "cmd /c ping -n 1 localhost > nul", 0, True
boolPinged = Ping("10.10.10.10")
Wend
Call sub1
Call sub2
End Sub
*****
Set objsh = WScript.CreateObject("WScript.Shell")
Set objFso = WScript.CreateObject("Scripting.FileSystemObject")
WScript.Sleep 5000
*****