Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-04-2019, 11:33 AM
Negi1984 Negi1984 is offline
Registered User
 
Join Date: Mar 2015
Posts: 12
Issue waiting for string

Hi All,

I tried to create a script by recording and modifying but not able to successful.

Basically when I login to any node via SSH command, its ask for line "Are you sure you want to continue connecting (yes/no)?" or line "Enter password:" . In below script I tried to modify into 2 parts with if condition but not succesful

Cany anybody help me out what modification required in below code.


Code:
#$language = "VBScript"
#$interface = "1.0"

crt.Screen.Synchronous = True

' This automatically generated script may need to be
' edited in order to work correctly.

Sub Main

crt.Screen.Send "ssh 00.00.000.00" & chr(13)
If crt.Screen.WaitForString ("Are you sure you want to continue connecting (yes/no)? ") = True Then
crt.Screen.Send "yes" & chr(13)
crt.Screen.WaitForString "Enter password:"
crt.Screen.Send "XXXXXX" & chr(13)
crt.Screen.WaitForString "<RING-"
crt.Screen.Send "scre 0 temp" & chr(13)
crt.Screen.WaitForString "<RING-"
crt.Screen.Send "dis interface GigabitEthernet " & chr(124) & " i GigabitEthernet" & chr(124) & "Line protocol current state" & chr(124) & "Description" & chr(124) & "IP Sending Frames" & chr(13)
crt.Screen.WaitForString "<RING-"
crt.Screen.Send "dis arp all" & chr(13)
crt.Screen.WaitForString "<RING-"
crt.Screen.Send "quit" & chr(13)
crt.Screen.WaitForString "[user@user1 " & chr(126) & "]$"
Else
crt.Screen.WaitForString "Enter password:"
crt.Screen.Send "XXXXXX" & chr(13)
crt.Screen.WaitForString "<RING-"
crt.Screen.Send "scre 0 temp" & chr(13)
crt.Screen.WaitForString "<RING-"
crt.Screen.Send "dis interface GigabitEthernet " & chr(124) & " i GigabitEthernet" & chr(124) & "Line protocol current state" & chr(124) & "Description" & chr(124) & "IP Sending Frames" & chr(13)
crt.Screen.WaitForString "<RING-"
crt.Screen.Send "dis arp all" & chr(13)
crt.Screen.WaitForString "<RING-"
crt.Screen.Send "quit" & chr(13)
crt.Screen.WaitForString "[user@user1 " & chr(126) & "]$"
End if
End Sub
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 03:47 PM.