1. Home
  2. Docs
  3. Scense Embedded Scripting Guide
  4. Scripting Action Headers

Scripting Action Headers

Scense Scripting Actions can be extended with an XML header. This header specifies variables act as configurable parameters for a script. The scripting action property page in Scense Explorer will interpret the XML header and dynamically generate a user interface for the scripting action which hides the actual script. By doing this an administrator can add ‘Action templates’ to his Scense system with complete new functionality.

The XML Header

The XML header as laid out below will be just ‘comment’ to the runtime scripting host, but for Scense Explorer it will be valuable information from which a GUI can be created. The header consists of 2 blocks:

  • The ScenseScriptHeader
    This is the XML structure that describes the user interface elements
  • The ParameterCodeBlock
    This is the XML structure that links the GUI as described in the ScenseScriptHeader to the actual executable script code


Main structure or ‘root node’.


Script parameter collection


The ‘Parameter’ node describes a single parameter linked to a script variable.


The ScriptParameter ‘Name’ specifies the friendly name of the Script Parameter. This friendly name will be used as the ‘label caption’ for the parameter.


The ScriptVariableName specifies to which script variable this parameter will be bound. These script variables should exist in the ParameterCodeBlock.


The value of the ‘AllowedRange’ attribute is used to screen the input from the user and thus prevent the script from crashing. the syntax for the ‘AllowedRange’ is: <low-1>-<high-1>;<low-2>-<high-2>;<low-n>-<high-n>; e.g. A-Z;a-z;0-9; which will allow all alphanumeric characters but no special characters 1-10 will allow only numbers from 1 to 10, including 1 and 10   If the user’s input is not in range, the property page will show a messagebox telling the user that the input is out of range and the message will also show what the actual valid range is.


The GUI node describes how the parameters are presented in the GUI of the property page. If the GUI node is omitted, the default control to be used is the TextBox.


The Control attribute specifies the control to be used in the GUI. Each control will appear on a single line. These are the supported controls:   LabelThe label control is used to write a line of text in the property page. The label uses the ‘Caption’ attribute for text. The phrase ‘{CRLF}’ can be used to break to a new line   Example: <GUI Control=”Label” Caption=”This Action has no configurable options” />   TextBoxThe TextBox control is used to accept user input.   PasswordThe ‘Password’ attribute specifies how the textbox should present its value:  True – Hide the content as if it is a password  False – Show the content as normal text   MultilineThe ‘Multiline’ attribute specifies whether the textbox should allow multiple lines of text:  True – The textbox allows multiple lines of text  False – The textbox allows only one line of text   DropDownListA ComboBox is used for accepting predefined values. The Listelements collection determine the values the user can pick.   ListElementsA collection of Elements for populating the list. ElementList element entry. NameName of the element to be visible in the list. ValueValue of the element to be used in the script If no value is specified, the value will be equal to the Name. CheckBoxA CheckBox is used to accept state input The parameter name is used as the checkbox caption.   ValueTypeThe ‘ValueType’ attribute specifies what type of value the CheckBox should return:  Standard – Return 1 (Checked) or 0 (Unchecked)  Boolean – Return True (Checked) or False (Unchecked)


The ‘ParameterCodeBlock’ is a separate block that holds the parameter values as script variables. Te ‘ParameterCodeBlock’ holds the actual values of the parameters and is rewritten each time the scripting action is being modified. The Parameter code block contains executable code


Here’s an example of a working script with header:

And this is how the property page will look:

For more examples see chapter 6 ‘Scense Scripting Examples’.

How to comfortably develop an XML Header

Building and testing the GUI for your scripting action is made easy by toggling between the script-GUI and the script-code. This is done by pressing the F6 key.

By default switching is not enabled. It can be enabled by setting ‘Allow action template editing’ option in Scense Explorer.

Adding the action templates to the ‘new action’ context menu

When adding actions to Session Events an administrator often uses the ‘New’ command from the context menu which looks like the screenshot on the right.

These are all actions that are available in Scense Explorer.

There is a way to add your own action templates to this menu.

The TaskSet with the ‘Function’ status (Often named the ‘Script Container’ can hold a Session Event of type ‘Action template’.

If the Scripting Actions you would like to serve as action templates are placed within this Session Event, then Scense Explorer will make these actions available in the context menu by adding a ‘Action templates’ submenu.

In this way your action templates can appear and be used as normal actions in Scense Explorer.

Action templates will be copied from the original to the new location.