Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 01-19-2021, 02:38 PM
afdslkj2r afdslkj2r is offline
Registered User
Join Date: Jan 2021
Posts: 5
Post Cannot print full screen output to file

I'm trying to combine the two python scripts 'SendData.py' and 'GetDataToFile.py'. I can get both scripts to work independently of each other but not together. The platform is Palo Alto Panorama.
# $language = "python"
# $interface = "1.0"

import os

output_path = 'path to output folder'
show_script = 'script with cli commands'

def main(output_file):
	crt.Screen.Synchronous = True
	filename = os.path.join(output_file, 'output.txt')
	fp = open(filename, "wb+")
	for line in open(show_script, 'r'):
		crt.Screen.WaitForString("\n", 2)
	promptStr = '>'
	waitStrs = ["\n", promptStr]
	row = 1
	while True:
		result = crt.Screen.WaitForStrings( waitStrs )
		if result == 2:
		screenrow = crt.Screen.CurrentRow - 1
		readline = crt.Screen.Get(screenrow, 1, screenrow, 500)
		fp.write(readline + os.linesep)
	crt.Screen.Synchronous = False
The screen output is chewed up as are the lines captured in the output file. Oddly, the output file never captures the full output. I've scoured the forums, the internet, etc, to no avail. Any help would be appreciated, even if it's just a link somewhere with solid information about SecurtCRT methods/attributes.Thank you.

Last edited by cboyack; 01-19-2021 at 02:40 PM. Reason: Please use the [CODE] and [/CODE] tags to denote a script
Reply With Quote

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 06:27 AM.