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 03-05-2013, 09:13 AM
mikevm mikevm is offline
Registered User
 
Join Date: Mar 2013
Posts: 3
Delay start of script

I generated a vbscript to execute a command in a session.
I can execute the script when selecting "run" from the script menu.

When I set this script as a login script (to execute automatically after a login), it does not execute.

I suspect this is happening because the shell I am logging into takes about 5 seconds to initialize. Is there a way I cana delay the start of the vbscript?

I added a 5 second pause in my script before sending the command, but that isn't working either. I suspect the script isn't initializing or dying at the beginning because the shell isn't up yet.

This is to automate a command to a Cisco Call Manager.

Any ideas?

Thanks,

mike
Reply With Quote
  #2  
Old 03-05-2013, 09:34 AM
mikevm mikevm is offline
Registered User
 
Join Date: Mar 2013
Posts: 3
I shall add...

The shell returns this prompt while it initializes:

"Command Line Interface is starting up, please wait ..."

So I am trying to wait for this to occur, then send the command.
Reply With Quote
  #3  
Old 03-05-2013, 09:51 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,946
Hello Mike,

What are you waiting for following authentication to the device?

In other words, in the login script, you should be waiting for the shell prompt, then send the desired command.

Code:
  ' Turn on synchronous mode so we don't miss any data
  crt.Screen.Synchronous = True

  ' Wait for a string that looks like "login: " or "Login: "
  crt.Screen.WaitForString "ogin: "

  ' Send your username followed by a carriage return
  crt.Screen.Send "username" & VbCr

  ' Wait for a string that looks like "password: " or "Password: "
  crt.Screen.WaitForString "assword:"

  ' send the password and a carriage return
  crt.Screen.Send passwd & VbCr
  
  ' Wait for the shell prompt"
  crt.Screen.WaitForString "shell prompt"

  ' send the desired command
  crt.Screen.Send "command here" & VbCr
The above is an excerpt from one of the script examples included in SecureCRT's installation folder.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #4  
Old 03-05-2013, 05:06 PM
mikevm mikevm is offline
Registered User
 
Join Date: Mar 2013
Posts: 3
Smile ok thanks

crt.Screen.WaitForString was the key here, and also because my session signs in already, I don't need to re-send the credentials programatically.
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 07:32 PM.