Write Delimited Text Line to Text File
Verb: textWriteLineDelimited
Available from: <Standard>
Writes a line of text from a list, separated by a delimiter, into a text file.
Syntax
textWriteLineDelimited --texts(List<String>) --delimiter(TextDelimiterOption) --characters(String) --lengths(List<Numeric>) --file(TextFileWriter)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--texts | Texts | Required | List<Text> | Texts used for writing in the file, obtained from the list, separated by the chosen separator. |
--delimiter | Delimiter type | Required | TextDelimiterOption | Option for selecting the delimiter type to use. The available delimiters are:
|
--characters | Separator | Only whenDelimiter type is ByCharacters | Text | Character used as a separator in the text between each list element. |
--lengths | Lengths | Only whenDelimiter type is ByLengths | List<Number>, Text | The character lengths of each part of the final text. They can be used with a list of numbers or a sequence of numbers separated by commas, e.g. "1,2,3". |
--file | Text writer | Required | Text File Writer | Variable with the text file that should be opened for writing. |
Example
Write a line of text, containing the given list, with the text separated by the "-" separator. The Open Text File for Writing command is used to open the file and the Write Delimited Text Line to Text File command for writing.
defVar --name textsList --type List --innertype String --value "[IBM,Automation,Studio]"
defVar --name filePath --type String
defVar --name textWriter --type TextFileWriter
getSpecialFolder --folder "Desktop" filePath=value
// Open the file entered for writing.
openTextWriter --mode "OpenOrCreate" --autoflush --share "Write" --path "${filePath}\\textFile.txt" --encoding "Default" textWriter=value
// Write inside the open file a line of text, with an informed list, separated by the delimiter "-".
textWriteLineDelimited --texts ${textsList} --delimiter "ByCharacters" --characters "-" --file ${textWriter}