Skip to main content
Skip table of contents

SetVarValidFilePath: Set Variable with Valid Windows File Path

SetVarValidFilePath creates variables like a regular SetVar but transforms the value to a valid Windows file path.

All non-Windows-filepath-compliant characters: :?\"<>|{}*;^ are replaced by an underscore: _
Front slash / is replaced by backslash \

Tag Attributes

AttributesAttribute ValuesValue Description
Variable NameN/AAny unreserved name valid in XML. Reserved names are listed on: Variables
Variable ValueN/AAny string or number.
NewFileTrue / False If set to True, the file name shall be modified with a number increment so that it becomes unique.

Example Script

XML
<ytriaAutomation>
	<SetVar MyPath="MuhFolder/My Export at 06:06:06 {is it large? nobody | knows;}"/>
	<SetVarValidFilePath MyPath="{%MyPath%}" MyOtherPath="C:\dev\Temp_XML\ProcessError.xml" NewFile="true"/>
	<Echo Value="{%MyPath%}"/>
	<Echo Value="{%MyOtherPath%}"/>
</ytriaAutomation>

In this example, two file path are generated:



Since ProcessError.xml already exists and NewFile is set to "true" the new file name variable contains ProcessError (2).xml

JavaScript errors detected

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

If this problem persists, please contact our support.