General Notes
Scoping
the this keyword refers to the scope of execution.
In case its part of a command or an expression (driver console), this will be the driver instance.
Each time a device will be connected, its creates an instance of the driver code. Each driver has its own JS code and will be sub classed from a driver base class. See also the API documentation here
So if your driver code contains a method "doSomething", you can write
this.doSomething(2)
The base driver class contains also methods to send messages to the device.
Here a number of expressions being used in the console or as command string
Send hex values
some string x0d
will be replaced to
some string \r
Make sure "Replace Hex" is on
Using variables
"mv" + [Volume] +"x0d"
will be modified to
return "mv" + this.getVariable("Volume") + "x0d";
and evaluates to (Volume variable is set to 60)
mv60\r
Using variables II
var Volume = this.getVariable("Volume");
return "mv" + (Volume + 2) + "x0d";
evaluates to (Volume variable is set to 60)
mv62\r
Make sure "Replace Hex" and "Expression" is on