View Single Post
Old 10-25-2018, 12:22 PM
berdmann berdmann is offline
VanDyke Technical Support
Join Date: Aug 2017
Posts: 441
Hi yous,

The example code for already writes out multiple lines of result data to the CSV file.

The script runs a command that generates output.

1) Then the script waits for either a new line to be received or for the shell prompt to appear (so that it knows when the command output has been received).

2) If a new line appears, (that's the \n), SecureCRT uses crt.Screen.Get() to "get" the line of text above the cursor (because a new line has just been received, the new data is expected to be above the line where the cursor currently exists).

2a) That line is then "split" into components, and the first 2 components are written out to the CSV file.

2b) If the shell prompt appears, the while loop is exited.

3) If the shell prompt didn't appear, the script then loops up to step 1

If you're not getting multiple lines of output from your shell command written to the resulting CSV file, you'll need to provide more context as to the command you're running, the example output that shows up on the screen, and the resulting CSV file.

Note that if the remote app/cmd you're running does note provide output terminated with a \n (if instead, it drives the screen by moving the cursor around with escape sequences), you'll have to take a different approach to getting each "line"; such an approach will involve a variable number of factors each of which are dependent upon knowing exactly what data is being received and how -- something which a raw log can typically reveal.

VanDyke Software
Technical Support
(505) 332-5730
Reply With Quote