View Single Post
  #7  
Old 06-22-2015, 11:41 AM
mms mms is offline
Registered User
 
Join Date: Jun 2015
Posts: 4
Hi rtb,

With your help, I finally found what is wrong with the script.
I verified and cancelled the Script and it is true that it points me to line
after

Code:
crt.Screen.Send "telnet " & ip & vbcr
it stucks here because it still waits for the Username Prompt which won't happen since I did have an error failed remote connection
Code:
crt.Screen.Send username & vbcr
It is working now after fixing and transferring my if statements after sending telnet. So I can expect here 2 possible outcomes.

Code:
	crt.Screen.Send "telnet " & ip & vbcr

	dim result
	result = crt.Screen.WaitForStrings("Jumpserver#", "Username: ", 10)
        crt.Dialog.MessageBox result

	If result = 1 Then
   	crt.Screen.Send "ssh " & ip & vbcr
        crt.Screen.WaitForString "Password: "
	crt.Screen.Send password & vbcr
      		End If

	If result = 2 Then
	crt.Screen.Send username & vbcr
	crt.Screen.WaitForString "Password:"
	crt.Screen.Send password & vbcr
		End If
	     
   	crt.Screen.WaitForString ">"
	crt.Screen.Send "en" & vbcr
	crt.Screen.Send enable & vbcr
	crt.Screen.WaitForString "#"
the way the script that you send me uses an array to define all possible responses, l will try to study it if I have time. I'm not yet familiar with On Error.

Great help Todd! Thank you so much.
Reply With Quote