Skip to main content
Skip table of contents

SetVarFromTextFile: Assign the text content of a file to a variable.

File encoding is automatically detected among the following:

  • UTF8 with BOM

  • UTF8

  • UTF16 LE with BOM

  • UTF16 BE with BOM

  • ASCII/ANSI (default)

Tag Attributes

Attribute Name

Attribute Value


Any unreserved name. Reserved name are listed on: Variables Required


Input file path.


When set to TRUE, displays a console trace for each element added to the list

Defaults to TRUE

Example script

<ytriaAutomation Application="sapio365">
    <SetVarFromTextFile name="MyVarFromFileUTF8" filepath="C:\utf8.txt"/>
    <Echo value="{%MyVarFromFileUTF8%}"/>
    <SetVarFromTextFile name="MyVarFromFileUTF16" filepath="C:\utf16.txt"/>
    <Echo value="{%MyVarFromFileUTF16%}"/>

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.