VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Example: Read Data From Separate Hosts/Commands File And Log To Individual Files (https://forums.vandyke.com/showthread.php?t=10651)

bgagnon 07-31-2020 04:08 PM

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. :)

dav-parker 07-31-2020 04:08 PM

Quote:

Originally Posted by dav-parker (Post 53860)
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

swjriggs 09-02-2020 09:22 AM

Script error
 
Complete newby here

first time I ran script I get

a protocol error occurred. non-assigned port

any ideas

bgagnon 09-02-2020 09:48 AM

Hi swjriggs,

Are you using the VBScript version or the Python version of the script?

Did you make any edits to the provided example script?

I am going to need to see copies of your hosts and commands file (and the script file if you altered it).

Please attach to an email (append .txt extension to the script file if attaching it) and send to support@vandyke.com and include Attn Brenda - Forum Thread #10651 in the subject line.

M1NDN1NJ4 12-03-2020 04:47 AM

Log File Question
 
Is it possible to set the log file name to the hostname of the device we're connecting to and running commands on instead of the IP Address of the device?

cboyack 12-03-2020 10:32 AM

Hi M1NDN1NJ4,

Before we try to figure out a way to specify the hostname via logging, we'll need some more information about your particular setup:
  • What are you specifying in the host file -- hostname or IP address?
  • If you're specifying IP addresses in your host file, then SecureCRT doesn't know the hostname; in which case, how would you normally map that IP address to the corresponding host name?


All times are GMT -6. The time now is 12:43 AM.