|
Question : Insert delay into visual basic script
|
|
The following code establishes an SSH connection using PUTTY, and then uses Remote Desktop to connect to an XP computer.
Dim objShell Set objShell = CreateObject("WScript.Shell") objShell.Run "C:\Putty.exe -load MyProfile -pw MyPassword" objShell.Run "mstsc /v: localhost:10001 /console /f"
My problem is that the line which establishes the PUTTY connection takes about 3 seconds to connect, but before it connects the Remote Desktop starts trying to connect and fails. How can I insert a delay of a few seconds between the PUTTY connection and then the Remote Desktop connection?
Thanks.
|
|
Answer : Insert delay into visual basic script
|
|
For pure VBScript (.vbs), that would be:
WScript.Sleep 3000 ' 3 seconds
But you should probably try it this way first:
objShell.Run "C:\Putty.exe -load MyProfile -pw MyPassword", 1, True
Read about the "bWaitOnReturn" parameter here: http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx
|
|
|
|