Object and Member Notation (dot syntax)

Navigation:  Widget Designer > Scripting >

Object and Member Notation (dot syntax)

Previous page Return to chapter overview Next page

What are objects and members?

The term "object" in this context refers to windows, pages, widgets, nodes and (global and local) variables.

Each object has a unique name, e.g. CustomScript3, Node14 or var_String, by which it can be accessed in scripts. You can change the automatically generated name of every object in the object's properties dialog. Variable names can not be edited once they are declared, however, you can replace them.

The term "properties" refers to specific values of those objects that can be requested or set. The term "methods" describes actions that can be performed with this object.
Properties and Methods are so called "members" of the object. Each object, e.g. Fader, CustomScript, string variable, etc. has its specific members. A list of all possible members of an object is visualized in the Script Assistant when placing a dot "." after an object name, this is why it is also called the "dot syntax".

"Fader1.Value" returns the current value of Fader1 as a double value (Property)
"Fader1.FadeUp(2)" fades Fader1 to 100% within 2 seconds (Method)

The Script Assistant also gives information whether the member is a property or a method, and which data type the property has (i.e. whether it is a string, Boolean, integer, ...), or which arguments the method expects.

Every command in Widget Designer that handles a window, page, widget or node has an equivalent method.

There are two special objects besides the already mentioned, the are called "Project" and "Context". Those provide ancillary members, for example for session related values. Please refer to the chapter "Project and Context Member" for further information.

Data type specific members are explained in a separate sub chapter in detail.  Each data type (String, Integer, etc.) has own members that can be used for conversion, editing and information. The data type specific members can be used for variables as well as for object properties. Simply type in another dot after the variable's or object's name and the Script Assistant will list all available members. Example: varString and Label1.Text are both strings. When writing "varString." or "Label1.Text." the string members are displayed, including the member "contains". Hence you can ask whether varString or Label1 contain a specific expression.
Please note that these methods only return values, they do not change the object they refer to themselves.

How to use members?

Property members can be used exactly the same way as variables are being used. You can perform mathematical actions or use them for conditions. You can assign them to variables or other object properties. You can even use further methods respective to the type.

Some examples:

var_Fader = Fader3.Value + 10

This assigns the current value of Fader3 plus 10 to the double type variable var_Fader.

Wheel1.Max = 314

This assigns a max value of 314 to the widget Wheel1.

Fader6.Value = var_bool.ToInteger

This assigns either 0 or 1 to the widget Fader6, depending on the value of the Boolean type variable var_bool. The additional method "ToInteger" is necessary to convert the Boolean terms "True" and "False" into the values "0" and "1".

var_int = Fader6.Value.ToInteger

This assigns the value of Fader6 to the variable var_int, rounded to an integer value.

if CustomScript5.Fix = true {Label1.Text = "Button fixed"}

Only in case the button CustomScript5 is fixed, Label 1 will say "Button fixed".

If CustomScript2.Notes.Contains("A1"){CustomScript2.Click}

Only in case the Notes field in CustomScript2 contains the string "A1", the button is clicked. The next chapter shows how to combine this example with a for loop to address many widgets.

Method members can be used like the normal WD-commands, if they require parameters, the Script Assistant points them out. As the object is already defined by the object name in front of the method, you do not have to enter an ID or name as a parameter. The parameters, too, can be substituted by variables or other object properties, even functions are possible if they return the correct value type.

Some examples:


This fades Fader1 to the value of variable var_Fader within 5 seconds. This method equals the command WDFadeToValue(1,5,var_Fader).


This saves the content of PictureBox1 to the path that is currently selected in the widget TreeView1.


This clicks CustomScript1, no parameter is needed to perform the action.


This adds Label14's text to TextBox2.

The next chapters include more information regarding object and member notation.
The chapter Project and Context Member describes two special, superior objects, Project and Context.
The chapter Data Type Specific Members explains how the members of each data type (String, Integer, etc.) can be used for conversion, editing and information.
The chapter Using JSON gives a quick overview of the JavaScript Object Notation, a format for easily storing, editing and exchanging data.


Remark for advanced users: Dynamic scripting with objects

Scripts are always compiled before they are executed. This procedure can cause problems if you are deleting and re-creating objects in a script.

The following example shows a situation causing an error and how to resolve this:




Playlist2.Title = "test1"


-> deletes "Playlist2"

-> copies "Playlist1" and calls it "Playlist2"


-> renames the Title of "Playlist2"

This script will not work as expected, because the object "Playlist2" in the last line still refers to the instance that existed at the moment the script compiled. As this instance is deleted when the script actually is being executed, the action of changing the title is performed on the deleted object that is still preserved in the memory, and not on the new instance (with the same name "Playlist2") that was created with the WDControlCopy command.

In order to avoid this misbehavior, you can use the Project object for assigning the title. The Project object is a dynamic reference and refers to the instance existing at the moment in which the script is executed:

Project.Playlist("Playlist2").Title = "test2"


Another approach would be to source the last line out and write it in an external Macro:







Playlist2.Title = "test3"

This way, the macro is being compiled after the Playlist object was already replaced and "Playlist2" thus refers to the new instance.