xmlscripting:course-en
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | xmlscripting:course-en [2018/11/12 08:56] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== XmlScript: Quick Start Guide ====== | ||
| + | [[: | ||
| + | [[: | ||
| + | * [[: | ||
| + | * **[[: | ||
| + | |||
| + | \\ | ||
| + | =====1: Introduction===== | ||
| + | This small guide will try to learn you how to use XmlScript actions in Rocrail.\\ | ||
| + | ====Requirements==== | ||
| + | * How to __**[[: | ||
| + | * How to __**[[: | ||
| + | * Some __**[[http:// | ||
| + | * A Rocrail installation with revision __**[[http:// | ||
| + | |||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | =====2: Hello World===== | ||
| + | This chapter will show you in only a few steps how an XmlScript can be used as action.\\ | ||
| + | |||
| + | ====The Layout==== | ||
| + | * {{: | ||
| + | {{: | ||
| + | The layout is very simple and contains only a button, **b1**, and a text field **t1**\\ | ||
| + | Goal is to trigger with the button a XmlScript which will display "Hello world!" | ||
| + | ====Creating the script==== | ||
| + | - Create an action with the ID **script1**. | ||
| + | - Write in the command file field **script1.xml**. | ||
| + | - Click on the **Edit** button. | ||
| + | {{: | ||
| + | |||
| + | After clicking on the **Edit** button the XmlScript editor will show up with a XmlScript skeleton:\\ | ||
| + | {{: | ||
| + | |||
| + | - Place the cursor in the XmlScript editor somewhere between < | ||
| + | - Select in the Statement box **text**. | ||
| + | - Select in the ID box **t1**. | ||
| + | - Select in the Command box **format**. | ||
| + | - Write in the Parameter box **Hello world!**. | ||
| + | - Push the **Insert** button. | ||
| + | - The new line will show up. | ||
| + | - Push the **Save** button. | ||
| + | {{: | ||
| + | |||
| + | ====Link the action with the button==== | ||
| + | Now the link must be defined with the push button **b1**. | ||
| + | - Open the button **b1** properties. | ||
| + | - Push the **Actions...** button. | ||
| + | - Select the action ID **script1**. | ||
| + | - Select the action State **on**. | ||
| + | - Push the **Add** button. | ||
| + | - Push the **OK** buttons. | ||
| + | {{: | ||
| + | |||
| + | ====Test the XmlScript==== | ||
| + | All is ready now to make the 'Hello world!' | ||
| + | - Click on button **b1**. | ||
| + | - Button **b1** will turn to green color. | ||
| + | - The text field **t1** will show: **Hello world!**. | ||
| + | - Congratulations! Your first XmlScript did work. | ||
| + | - To run it again you can reset the text from **t1** by clicking on it and delete the text in the popup. | ||
| + | {{: | ||
| + | |||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | =====3: Make a decision===== | ||
| + | In this chapter a decision will be made which depends on the text field **t2** contents.\\ | ||
| + | ====The layout==== | ||
| + | * {{: | ||
| + | {{: | ||
| + | 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.\\ | ||
| + | |||
| + | ====Extending the script==== | ||
| + | The goal is to make the new text for text field **t1** dependant of the contents of text field **t2**.\\ | ||
| + | |||
| + | - Open the **Actions dialog**, double click on the action **script1** to open the XmlScript editor. | ||
| + | - Extend the existing XmlScript as follows: | ||
| + | <code xml> | ||
| + | <?xml version=" | ||
| + | < | ||
| + | <if condition=" | ||
| + | < | ||
| + | <tx id=" | ||
| + | </ | ||
| + | < | ||
| + | <tx id=" | ||
| + | </ | ||
| + | </if> | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | With the **< | ||
| + | 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 **< | ||
| + | If its not true, and there is an **< | ||
| + | |||
| + | Because text field **t2** is defined as an input field you can play around changing the **t2** contents and push button **b1**.\\ | ||
| + | |||
| + | |||
| + | |||
| + | \\ | ||
| + | =====4: Next steps===== | ||
| + | * Check the __**[[: | ||
| + | * Use __**[[: | ||
xmlscripting/course-en.txt · Last modified: 2018/11/12 08:56 by 127.0.0.1