Using Get text action of Text file package - Extract content from a text file and save that content to a string variable by using the Get text action .

Automation 360

Extract content from a text file and save that content to a string variable by using the Get text action.

Before you begin

Ensure that the text file you want to get data from is not empty. Alternatively, use the Error handler package to handle empty file exceptions and avoid automation failures.

Procedure

  1. In the Actions palette, double-click or drag the Get text action from the Text file package.
  2. In the Source file field, select an option to specify the location of the text file:
    • Control Room file to open a file from the Control Room.
    • Desktop file to open a file from the device. This field also accepts a file path as a string variable or global value.
    • Variable to open a file by specifying a file variable.
  3. In the Text encoding field, select the encoding applied to the text file.
    The action retrieves data using the selected encoding, even if the file uses a different encoding.
    • ANSI
    • UTF-8
    • UTF-8 with BOM
    • UNICODE
    • Win1251
    • UTF-16LE
    • UTF-16BE
    • Shift-JIS
      Note: If Shift-JIS is unable to extract some of the characters clearly, you can either convert the document to UTF-8 in order to read the text file using UTF-8 format, or use C#dll to get the output.

      For more information, see Use DLL action to read file with SHIFT-JIS.

    • Detect automatically: identifies file encoding. This option supports UTF-8 with BOM, ANSI, UTF-16LE, and UTF-16BE file encoding.
  4. Optional: Select the Trim leading spaces and Trim trailing spaces check boxes to remove the leading and trailing spaces from the data extracted from the text file.
  5. In the Save the outcome to variable field, select a string variable to hold the output.
    The text content of the file is extracted and saved to the specified string variable when the automation runs.