Get Text File Line
Verb: textReadLine
Gets a line from a text file, using the indicated line number.
Syntax
textReadLine [--linenumber(Numeric)] --file(TextFileReader) (String)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--linenumber | Line number | Optional | Number | Number of the line that should be obtained. |
--file | Text reader | Required | Text File Reader | Variable containing the text file from which the indicated line should be obtained. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Text | Text | Value indicating the success (True) or failure (False) of the text reader line movement. |
Example
The text file is opened for reading using the Open Text File for Reading command. With the Get Text File Line command, the text of the given line is obtained.
defVar --name textFileReader --type TextFileReader
defVar --name lineText --type String
// Open the file informed for reading.
// Download the following file to execute the command.
openTextReader --share "None" --path "fileText.txt" --encoding "Default" textFileReader=value
// Get the text from line "2" of the open text file.
textReadLine --linenumber 2 --file ${textFileReader} lineText=value
logMessage --message "${lineText}" --type "Info"
// The command displays the text contained in the given line.
For the correct operation of the script above, it is necessary to download the file and enter its path in the "Path" parameter of the command "Open Text File for Reading".
Remarks
To use the Get Text File Line command, it is necessary to first open the text file using the Open Text File for Reading command.