![]() | The textfile box represents a text buffer in a visual program. It can be
|
Textfile boxes are accessed via the Classes / Basic Tools / Text File I-O / TEXTFILE
menu.
![]() | The textfile box has a basic editor where texts can be edited or modified. Double click on the box to open the editor. |
The textfile object has four inputs and outputs :
"self" : the object itself
"exp-list" : a textual content
"eval-mode" : text presentation format, that is, a text, a data list or a list.
"ed-mode" : edition mode, that is, the way contents are added in the file.
The " exp-list " input and output represent a textual content. The "exp-list" input accepts :
It allows to set or read the contents of the textfile box within visual programs. The implementation and interpretation of the content depends on the "eval-mode" and "ed-mode" inputs settings. | ![]() Inputting contents with "exp-list". |
The "ed-mode" input determines the way input data is written in the text file with successive evaluations.
It offers two options :
"supersede" : any previous contents is overwritten by new input data.
"append" : new input data is append after the existing contents.
Hence, the results of several successive iterations can be stored in the text buffer.
Click on the input to select an option.
The "eval-mode" input determines the format of the contents returned by "exp-list". Three formats are available :
| ![]() Three options for formatting the text contents with "eval-mode". The result appears when evaluating the "exp-list" output. |
![]() | The contents of textfile can be imported or exported from / to a real file on the disk. To import or export a contents :
|
The imported file appears in the textfile box and in the buffer. | ![]() |
The extension of the exported instance must be added by the user.
![]() | Other options allow to attach the object permanently to an external file on the disk .
These option are alike "Import" and "Export" options, but the link the content of the object with a file on the hard drive of the computer. |
In the dialogue window, choose a name and a directory for the new file.
| ![]() |
![]() Inputting data via "exp-list" on append mode. | To modify an attached file :
Saving the object implies that the related file on the hard drive is modified as well. |
![]() The attached file has been deleted. The Listener displays an error message. | Contrary to the import and export options, the
|
To initialize a textfile with a file :
The textfile is then attached to the corresponding file. | ![]() Connecting a pathname to TextFile |
A textfile box can also be convenient to visualize the results returned by boxes that return pathnames. The corresponding file must be created previously.