Get MBLogic at SourceForge.net. Fast, secure and Free Open Source 
	software downloads

Help Topics

Topic Details for HMI

Editing SVG with Inkscape

Scripting Inputs

Scripting for Push Buttons, Selector Switches, and Other Input Objects

Input objects such as push buttons and selector switches are activated when "clicked". When activated, they will execute and attached Javascript. This Javascript can send a message to the server which turns bits on or off, or which sets a value.

Input devices in the supplied standard library have the appropriate Javascript library functions already attached. However, these functions must have their parameters individually changed to the correct values in order to suit the actual application. These changes consist of entering the correct address tags and data values.

1) Select the push button or other input device.

setting the push button scripts.

2) Select "Edit" and then "XML Editor".

setting the push button scripts.

3) Find the XML for the push button (in this example we have set an "id" to make it easier to find). If you have selected the push button, the cursor should already be on it. Open up the levels (click on the triangles) until you find the scripting. This should be at one level down. Protocol functions will start with "MBHMIProtocol".

4) Click on the script to select it. The Javascript attribute (e.g. "onclick") will appear in the text box below, and the actual library command and parameters will appear in another text box below that.

5) Change the parameters to the correct values. These will be protocol address tag names or numeric or text constants. The parameters are discussed in more detail in the sections which describe each input object. For now we will assume the correct values are known in advance.

setting the push button scripts.

6) Take care not to delete anything which should not be deleted. This includes the single quotes ('), braces (), commas or other elements.

7) You can if you wish replace the entire function call with a different one. However, there are in most cases input objects provided with the correct function calls already present for the most common applications. It is usually easier to simply choose the correct one.