Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting

Thread Tools Rate Thread Display Modes
Old 08-06-2012, 09:46 PM
ahlai ahlai is offline
Registered User
Join Date: Aug 2012
Posts: 1
vbs problem

my script :

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

' Connect to an SSH server using the SSH2 protocol. Specify the
' username and password and hostname on the command line as well as
' some SSH2 protocol specific options.

Sub Main

Dim host
host = "djme"
Dim user
user = "linux"

' Prompt for a password instead of embedding it in a script...
Dim passwd
passwd = "ciscohuawei0"
cmd = "/SSH2 /L " & user & " /PASSWORD " & passwd & " /C 3DES /M MD5 " & host
crt.Session.Connect cmd
Dim huawei
huawei = crt.Screen.WaitForStrings("ME60","connection","out","unreachable",10)
Select case huawei
case 1
crt.screen.send "dis ip-pool pool-usage domain pppoe" & VbCr
crt.screen.send "q" & VbCr
crt.sleep 1000
case else
End Select
End Sub

I Just Want to auto exit secure crt if there is no ME60 character on the screen.
But it can't.
Anyone could kind enough to tell me.
many thanks!
Reply With Quote
Old 08-07-2012, 10:53 AM
bgagnon bgagnon is offline
VanDyke Technical Support
Join Date: Oct 2008
Posts: 4,163
Hi ahlai,

I Just Want to auto exit secure crt if there is no ME60 character on the screen.
But it can't.
What does happen when ME60 is not the response from the remote?

If you are trying to handle issues regarding connection/authentication, as it appears is the case from the other possible responses, are you getting the prompts in dialogs instead?

If so, you probably need to enable Display logon prompts in terminal window in the Connection / Logon Actions category (via Default Session). See tip on our website here.

You can also do this via the SessionConfiguration object (version 6.2 and later).

Set objDefaultConfig = crt.OpenSessionConfiguration("Default")
objDefaultConfig.SetOption "Auth Prompts in Window", 1
As a note, in case 1, you have two Sends in a row, which is not the best practice. Keep in mind the Golden Rule from the scripting manual (section 4.2) that there should be a WaitForString() following each Send() command.

case 1
crt.screen.send "dis ip-pool pool-usage domain pppoe" & VbCr
crt.screen.WaitForString "expected_prompt"
crt.screen.send "q" & VbCr
crt.screen.WaitForString "expected_prompt"

VanDyke Software
Technical Support
(505) 332-5730
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
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 04:51 PM.