wait for process to complete before going on to next step vbs

1.3k Views Asked by At

This is my vbs code

Set obj = CreateObject("WScript.Shell")
obj.Exec "C:\Program Files\putty.exe -load " + "111.22.33.44"
WScript.Sleep 5000
obj.SendKeys "abc"
obj.SendKeys("{Enter}")
WScript.Sleep 3000
obj.SendKeys "abc123"
obj.SendKeys("{Enter}")
WScript.Sleep 3000

This code is functioning properly, however if i try it on a different computer sometimes it does not work. As soon as putty loads the username and password is entered without the terminal asking for it. Is there an alternative way like the following logic

waitforstring = uname :
if waitforstring = true
obj.sendKey "abc"

any help on this is appreciated, Thanks

0

There are 0 best solutions below