Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
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
crt.Session.Disconnect()
crt.quit()
case else
crt.Session.Disconnect()
crt.quit()
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.
Why?
Anyone could kind enough to tell me.
many thanks!
Reply With Quote
  #2  
Old 08-07-2012, 10:53 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,048
Hi ahlai,

Quote:
I Just Want to auto exit secure crt if there is no ME60 character on the screen.
But it can't.
Why?
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).

Code:
Set objDefaultConfig = crt.OpenSessionConfiguration("Default")
objDefaultConfig.SetOption "Auth Prompts in Window", 1
objDefaultConfig.Save
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.

Code:
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"
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


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 11:17 PM.