PrintText() action

From The x3270 Wiki

Captures a snapshot of the current screen contents and saves it to a file or to the printer.

Parameters

file
Directs the snapshot to a file instead of the printer.
string
Returns the snapshot as a string, instead of directing it to the printer.
printer
Directs output to the printer.
html
With file or string, saves the snapshot as HTML.
rtf
With file or string, saves the snapshot as Rich Text.
dialog (Windows only)
On Windows, ensures that a printer selection dialog appears, even on emulators like s3270 where it is normally suppressed.
nodialog (Windows only)
On Windows, prevents a printer selection dialog from appearing, even on emulators like wc3270 where it would normally appear.
replace
With file, causes the file to be replaced if it already exists.
append
With file, causes the snapshot to be appended to the file if it already exists. This is the default behavior.
modi
Displays modified fields in italic.
oia
Includes the Operator Information Area in the output. The text mostly resembles the OIA from c3270. New in 4.1
secure
In x3270, suppresses the dialog that allows the print command to be edited.
caption text
Specifies a caption for the snapshot. Within text, %T% is replaced with a timestamp.
command (POSIX only)
As the last keyword, specifies that what follows is the command to run.
filename
With file, the final parameter must be the name of the file to save to. If not otherwise specified, the snapshot type will be inferred from the suffix on the filename.
print-command (POSIX only)
On POSIX, the optional final parameter specifies the printing command. The screen snapshot will be fed as plain text to that command's standard input. Without this parameter, the command is specified by the printTextCommand resource.
printer-name (Windows only)
On Windows, the optional final parameter specifies the name of the printer to use. Without this parameter, the printer is defined by the printer.name resource.

Resources

A number of resources control the behavior of PrintText().

Examples

Capture a screen snapshot on the default printer.

PrintText()

Capture a plain text screen snapshot in a file.

PrintText(file,/tmp/snapshot.txt)
PrintText(file,C:\Users\me\Desktop\snapshot.txt)

Capture an HTML screen snapshot in a file.

PrintText(file,/tmp/snapshot.html)
PrintText(file,C:\Users\me\Desktop\snapshot.html)

Return the screen contents as text.

PrintText(string)

Return the screen contents as HTML.

PrintText(string,html)

Send a screen snapshot to a specific Windows printer, without a printer selection dialog.

PrintText(nodialog,"Microsoft Print to PDF")

Send a screen snapshot to a specific POSIX printer.

PrintText("lpr -Pmx860")

Send a screen snapshot to a unique file name in a specific directory on Windows. New in 4.3

PrintText("C:\Users\me\Desktop\")

Send a screen snapshot to a unique file name in a specific directory on POSIX. New in 4.3

PrintText("prtodir /tmp")