Xshell Forum

Why the For cycle running one time only?

Last post: Wednesday, May 2, 2018 2:05 AM by zoo, 1 reply

 
Wednesday, April 25, 2018 8:04 AM - ejzhang

Why the For cycle running one time only?

 
Sub Main
Dim Ips
Ips = Array("192.168.114.68","192.168.114.69","192.168.237.4","192.168.237.5","192.168.237.6","192.168.237.7","192.168.237.8","192.168.237.9","192.168.237.10","192.168.238.132","192.168.76.15","192.168.76.19","192.168.76.20","192.168.76.21","192.168.76.22","192.168.6.163","192.168.6.195","192.168.7.131","192.168.7.195","192.168.7.3","192.168.7.67","192.168.8.3","192.168.45.245","192.168.45.246","192.168.73.245","192.168.73.246","192.168.103.245","192.168.103.246","192.168.104.245","192.168.104.246")
xsh.Screen.Synchronous = true
For i = 1 to UBound(Ips)
xsh.Screen.Send "telnet " & Ips(i) & VbCr
xsh.Screen.WaitForString "Password:"
xsh.Screen.Send "xxxxx" & VbCr
xsh.Screen.Send VbCr & VbCr
xsh.Screen.WaitForString ">"
xsh.Screen.Send "super" & VbCr
xsh.Screen.WaitForString "Password:"
xsh.Screen.Send "xxxxx" & VbCr
xsh.Screen.WaitForString ">"
xsh.Screen.Send "display device manuinfo" & VbCr
xsh.Screen.WaitForString ">"
xsh.Screen.Send "quit" & VbCr
xsh.Screen.Send VbCr & VbCr
Next
End Sub
===========================================================
Only first ip running successly, remove all codes in for .. next and insert a line "xsh.Screen.Send Ips(i)", that is ok.

Program Ver. : Xshell 5
Wednesday, May 2, 2018 2:05 AM - zoo

Re: Why the For cycle running one time only?

 
The wait for string looks incorrect.
If you try to login with telnet protocol, your first Password as wait for string must be 'login' or something like that, isn't it?