Tag: SetVarValidFilePath

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


<SetVarValidFilePath MyPath="{%MyPath%}" MyOtherPath="C:\dev\Temp_XML\ProcessError.xml" NewFile="true"/>
XML

Tag Attributes

AttributesAttribute ValuesValue DescriptionComment
Variable NameN/AAny unreserved name valid in XML. Reserved names are:

Date: current date MM/DD/YYYY
Time: HH:MM;SS AM/PM

Loop context
LoopIndex: Current loop index
ListSize: Current list size
ListName: Current list name

FolderDocuments: Windows account Documents folder path (%USERPROFILE%\Documents)
FolderTemp: Ytria temp folder path (%LOCALAPPDATA%/Ytria)

ErrorAction
ErrorSystem
N/A
Variable ValueN/AAny string or number.N/A
NewFileTrue / False If set to True, the file name shall be modified with a number increment so that it becomes unique.N/A

Detailed Description

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

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

Example Script

<ytriaAutomation console="false">
	<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>
XML