-
Notifications
You must be signed in to change notification settings - Fork 32
Variables
Note
Workflows are available in version 2.x and higher.
Variables allow for storing information that can be used multiple times in the watches. Each variable contains a name and a value, and both are treated as strings when a watch is executed.
<variables>
<variable>
<name></name>
<value></value>
</variable>
</variables>
The placeholder [var:{name}]
is used to specify where to use a variable. Replace {name}
with the actual variable name.
A variable can be used in any place where a placeholder
can be used.
When using a variable, the name of the variable is not case sensitive. So the variable names avariable
and aVariable
will refer to the same variable.
Variables can be added to all elements within the config file. Variables defined in a parent element are available for use in all child elements. A variable defined in a child element cannot be used by a parent element.
For example, take this structure:
<watches>
<variables>
<variable>
<name>FileEnding</name>
<value>Some value</value>
<variable>
</variables>
<watch>
<path>C:\Temp</path>
<actions>
<action>
<variables>
<variable>
<name>Extension</name>
<value>.txt</value>
</variable>
</variables>
<triggers>
<trigger>Create</trigger>
</triggers>
<type>Move</type>
<source>[exactpath]</source>
<destination>C:\Temp2\[filename]-[var:FileEnding][var:Extension]</destination>
</action>
</actions>
</watch>
</watches>
The variable FileEnding
will be available to the <action>
element so it will be appended to all the files that are moved. The variable Extension
will provide the extension for all files.
Since variable values can only be used by the element where the variable is defined, and by its child elements, the variable Extension
is not available to the watch
or any other watches.