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 10-05-2008, 09:41 PM
coxuser12 coxuser12 is offline
Registered User
 
Join Date: Feb 2008
Posts: 3
Thumbs up Script problem

Hello,

I need to automatically log outputs of cisco commands and i am using this commands -

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

logfile = "C:\Documents and Settings\cadisesh\Desktop\sessions\%H=%M-%D-%h-%m-Session.txt"
crt.Session.LogFileName = logfile

crt.Session.Log True

crt.Screen.Send "skip-page-display" & VbCr
crt.Screen.WaitForString "#"

crt.Screen.Send "show run" & VbCr
crt.Screen.WaitForString "#"

crt.Screen.Send "show vlan" & VbCr
crt.Screen.WaitForString "#"

crt.Screen.Send "show span" & VbCr
crt.Screen.WaitForString "#"

crt.Screen.Send "show 8" & VbCr
crt.Screen.WaitForString "#"

crt.Screen.Send "show log" & VbCr
crt.Screen.WaitForString "#"

crt.Screen.Send " page-display" & VbCr
crt.Screen.WaitForString "#"


crt.Session.Log False

For some reason afetr this line -
crt.Screen.Send "show vlan" & VbCr
crt.Screen.WaitForString "#"

it does not complete the above line but skips the next command out.
Is there anything that can be added here so that it completes the current command of "show VLAN" and then proceed to the next command output.

Thanks
Reply With Quote
  #2  
Old 10-06-2008, 08:09 AM
tnygren's Avatar
tnygren tnygren is offline
Registered User
 
Join Date: May 2005
Posts: 1,408
Hi Coxuser12,

In looking at the script and the description of what is happening, I suspect that there is a "#" in the output of the "show vlan" which is causing the crt.Screen.WaitForString to become true and the script to continue before intended.

An option to test and avoid this issue would be to wait for a large portion of the prompt to appear.

If a larger portion of the prompt is waited for instead of just "#", does the script correctly wait for the command to finish before moving on?

There is also one other option that is missing in the script. This would be to enable crt.screen.synchronous at the beginning of the script.

This can be enabled with the following line:

crt.screen.synchronous = true

This line ensures that data is not missed as it appears on the screen.
__________________
Thanks,

Teresa

Teresa Nygren

Last edited by tnygren; 10-06-2008 at 08:48 AM.
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:18 PM.