'How to print Trace32 terminal view to a file?

I have a script that initializes terminal and prints information in it in Trace32 terminal and I cannot edit that file. I am using term.write command to log the contents in terminal window to a file. But it does log the information that were written before executing this command.

So, I tried to Printer.file and winprint.term.view commands. Now I get this error.

terminal window with this configuration already open

What should I do to log all the contents of terminal (including contents that were already written and will be written in the terminal) to a file?



Solution 1:[1]

I am late, but figured out the answer.

&LOGFILENAME=OS.PPF()+".log" ; so, filename here is "<this_current_path_filename_with_extension>.log"
PRINT " Printing to log file: &(LOGFILENAME)"
PRinTer.FILE &LOGFILENAME ASCIIE

; select and open display the AREA you want to print to file; here it is default T32 log area A000
AREA.Select A000
AREA.View A000
WinPrint.AREA.View
;AREA.CLEAR ;if you want to clear the view for next set of prints

Alternatively, in real-time, write-to-file is

OPEN #1 OS.PPF()+".log" /CREATE  ; so, filename here is "<this_current_path_filename_with_extension>.log"
;...
WRITE #1 "Hello World - it is " DATE.TIME()
;how many ever WRITE's you want in the code 
;...
;...
WRITE #1 " BYE"
;...
CLOSE #1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1