This small guide will try to learn you how to use XmlScript actions in Rocrail.
This chapter will show you in only a few steps how an XmlScript can be used as action.
Now the link must be defined with the push button b1.
All is ready now to make the 'Hello world!' test.
In this chapter a decision will be made which depends on the text field t2 contents.
The layout is extended with an extra text field t2.
The contents of this new text field will be used for a XmlScript decision.
Text field t2 has became the Input option to make it easy to change the containing text.
The goal is to make the new text for text field t1 dependant of the contents of text field t2.
<?xml version="1.0" encoding="UTF-8"?> <xmlscript> <if condition="$t2 # 4711"> <then> <tx id="t1" format="t2 is 4711 :)"/> </then> <else> <tx id="t1" format="t2 is not 4711 but $t2 :("/> </else> </if> </xmlscript>
With the <if> statement a decision can be made. This decision must be defined in the condition attribute of the <if> line.
In this example the condition is defined as follows:
|The contents of text field t2, $t2 , is textually compared, #, with the value 4711.|
If the condition is true all commands between <then> and </then> are executed.
If its not true, and there is an <else> node, all commands between <else> and </else> are executed.
Because text field t2 is defined as an input field you can play around changing the t2 contents and push button b1.