Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #166  
Old 07-31-2020, 03:08 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,357
Hi David,

I am not sure how it's used in your script, but what about if you "wait for" just ## characters using VBScript's Left() function? Is the command unique enough that would work?

If you want to calculate an exact amount of columns, somewhere in your script where you expect to be at a prompt, add this line:
Code:
    nCmdCols = g_objNewTab.Screen.Columns - g_objNewTab.Screen.CurrentColumn
That should calculate the exact columns left over for the command. Then, if you need to store it in a different variable:
Code:
    strFirstLine = Left(strCommand, nCmdCols)
Then you would "wait for" strFirstLine.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #167  
Old 07-31-2020, 03:08 PM
dav-parker dav-parker is offline
Registered User
 
Join Date: Jul 2020
Posts: 6
Quote:
Originally Posted by dav-parker View Post
For the most part, I can do most of what I need. But, I've run across a new issue. I'm sending several commands to modify ACLs on an ASA. The script gets stuck at:

g_objNewTab.Screen.WaitForString strCommand

It appears that the ACL command is long enough that it doesn't display the entire command back. It wraps. So basically, the script hangs and cannot proceed.

Any good thoughts as to how to work around this?

Thanks,
David
I came up with a solution. I added code to wait for the first 40 chars of the string before sending the next. Works like a charm.


For Each strCommand In vCommands
strCommandEcho = Left(strCommand, 40)
If strCommand = "" Then Exit For

' Send the command text to the remote
g_objNewTab.Screen.Send strCommand & vbcr

' Wait for the command to be echo'd back to us.
' g_objNewTab.Screen.WaitForString strCommand
g_objNewTab.Screen.WaitForString strCommandEcho
Reply With Quote
Reply

Tags
example script


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 12:04 PM.