Write to Text File
Write to Text File writes text to a plain text file, with .txt
as the only supported file format. You can specify if you want Write to Text File to overwrite existing text in a file or create a new file.
Properties
File Operation Settings:
-
Add new line Specify here whether a new line should be added after the new text.
-
Create if file does not exist Specify here whether a new file should be created if the specified file does not exist. This option prevent the Workflow from ending with an error message if the file does not exist.
-
Directory path Enter the path to the directory where the file to be written to is stored. You can specify an absolute or relative path. If a relative path is used, then the path refers to a storage location relative to the Base Path variable.
-
File name Enter the name of the file that is to be written.
-
Overwrite file content Specify here whether the whole content of the destination file is to be deleted before writing. This option can be used if you want the specified file to contain only the text that is to be written. If this option is not selected, the new text will be appended at the end of the existing text.
-
Text to write Specify here the text that is to be written.
Other Properties that are the same in all action steps are described in the section on Common Properties. For reasons of clarity they are not shown here.
Inbound Variables
Directory path Enter the path to the directory where the file to be written to is stored. You can specify an absolute or relative path. If a relative path is used, then the path refers to a storage location relative to the Base Path variable.
File name Enter the name of the file that is to be written.
Text to write Specify here the text that is to be written.
Outbound Variables
Text to write The Write to Text File.Text to write provides the text that is to be written.
IsWritten The Write to Text File.IsWritten variable indicates whether the text could be written to the file or not (True/False).
File name The Write to Text File.File Name variable provides the name of the file that is to be written.
Directory path The Write to Text File.Directory Path variable provides the path used.
Wizard
-
Directory path Specify the path here to the file that is to be written. You can create an absolute path or a path relative to the Base Path. The initial value is %STWS_BASEPATH%. Select an existing path. You can also insert variables from the Workflow in order to construct the path. To do so, click on the pin and select one of the available variables.
-
File name Enter the name of the file that is to be written. You can also insert a variable from the Workflow as the File Name. To do so, click on the pin and select one of the available variables.
-
Text to write Enter the text that is to be written. You can also insert a variable from the Workflow as the Text to write. To do so, click on the pin and select one of the available variables.
-
Overwrite content with text Specify here whether the whole content of the destination file is to be deleted before writing. This option can be used if you want the specified file to contain only the text that is to be written. If this option is not selected, the new text will be appended at the end of the existing text.
-
Add a new line after text Specify here whether a new line should be added after the new text.
-
Create file if it does not exist This option determines whether a new file should be created if the specified file does not exist. This option prevents the Workflow from ending with an error message if the file does not exist.
-
Encoding The encoding to use when writing the file. Includes Shift-JIS and EUC-JP for Japanese support. Specify a valid encoding type if the one you need is not in the list.