Navigation: Scripting Reference Manual > Functions & Subroutines > SetTextFile

 

SetTextFile

 

Contact Us: fredsupport@photonengr.com

 

Description

This command re-routes data printed to the Output window into a designated text file.  If the specified file already exists, the contents are overwritten.  The companion command, SetTextFileOff must be issued to terminate the printing to the text file.

 

Syntax

SetTextFile fname, fileOnly

 

Parameters

fname As String

The full path of the file to be written to. Alternatively "stdout" can be used to send FRED's text window output to the Windows operating system standard output.

 

fileOnly As Boolean

Set this variable to True if output is to be directed only to the file. False allows printing to the output window and text file.

 

Example

The following example specifies a text file and redirects output to both the output window and the text file.

 

Sub Main

 

    Dim fName As String

    fName = "C:\temp\textOutput.txt"

 

    SetTextFile fName, False

    Print "This"

    Print "is"

    Print "some"

    Print "text"

    Print "4 + 4 = " & 4+4

    SetTextFileOff

 

End Sub

 

See Also

GetTextPosition

SetTextFileAppend

SetTextFileOff

 

 

 

 

 

Copyright © Photon Engineering, LLC