Open Text File for Reading

Verb: openTextReader

Opens a readable text file using the path, the share permission, and the encoding that can alter the file later.

Syntax

openTextReader --share(AutomationFileShare) --path(String) --encoding(EncodingType) (TextFileReader)=value

Inputs

Script Designer Required AcceptedTypes Description
--share Share Options Required AutomationFileShare Option that allows you to perform actions within the file while it is open:
  • Delete
  • Inheritable
  • None
  • Read
  • Read and Write
  • Write
  • --path Path Required Text Full path of the text file that should be read.
    --encoding Encoding Required EncodingType The character encoding used for reading the text file:
  • ASCII
  • Automatic
  • Big Endian Unicode
  • Operating System Default
  • Unicode
  • UTF32
  • UTF7
  • UTF8
  • Outputs

    Script Designer AcceptedTypes Description
    value Text Reader Text File Reader Text file opened for reading.

    Example

    The Open Text File for Reading command opens the entered text file and then, the Get Text File Line command returns the contents of the first line of the file.

    defVar --name textReader --type TextFileReader
    defVar --name displayedText --type String
    // In this excerpt, the statement finds the text file and stores it open for reading in a variable named "readerText".
    // Download the following file to execute the command.
    openTextReader --share "Read" --path "fileText.txt" --encoding "Default" textReader=value
    textReadLine --linenumber 1 --file ${textReader} displayedText=value
    logMessage --message "${displayedText}" --type "Info"
    // The example displays the first line of text from the given file.
    

    Download File


    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 Open Text File for Reading command.

    Remarks

    The output variable Text Reader stores the text file that can be opened by commands such as Get Text File Line, allowing only the changes selected in the Share Options parameter.

    See Also

  • Binary Read Int
  • Close Binary File
  • Close Text File
  • Get Binary File Boolean
  • Get Binary File Characters
  • Get Binary File Text
  • Get Date and Time in Binary
  • Get Table from a Text File
  • Get Text File Line
  • Go to Text Reader Line
  • Move Index in Binary File
  • Open Binary File for Reading
  • Open Binary File for Writing
  • Open Text File for Writing
  • Read Binary File Decimal
  • Read Binary File Time Span
  • Read Delimited Line of Text File
  • Read Text to the End
  • Save Changes to Binary File
  • Save Changes to Text File
  • Write Boolean in Binary File
  • Write Date Time in Binary File
  • Write Decimal to Binary File
  • Write Delimited Text Line to Text File
  • Write Delimited Texts in Text File
  • Write in Text File
  • Write Integer to Binary File
  • Write Text in Binary File
  • Write Text Line to Text File
  • Write Time Span in Binary File