530
OPUS Projektor Manual
JavaScript
// output: Strings and numbers can be concatenated!
print("Strings " + "and " + "numbers " + "can " + "be " +
"concatenated!");
Please note that the print function also works with the PClient simulation on the PC. The
output will be written in the file
%USER%\AppData\Roaming\%program version%
\extracted_components\pclient\simulation\console_output.txt
getVariableValue - retrieve the value of a project variable
In a project a lot of variables are used to store runtime data and you can configure your own
variables in a project. To retrieve the value of such a variable the getVariableValue function
can be used.
Prototype:
var result = getVariableValue(string nameOfVariable);
The returned value of that function contains the value of the variable. This can be either a
string or a number depending on the variable type.
Examples:
var backlightValue =
getVariableValue("@DisplayBacklightIntensity");
// result is a number representing the backlight intensity
print("Value of backlight is: " + backlightValue);
var terminalName = getVariableValue("@Terminal");
// result is a string representing the name of the device this
is executed
print("I am running on a " + terminalName);
setVariableValue - change the value of a project variable
To set a value to a pre-defined or self-created variable you can use the setVariableValue
function. The return value of the function will be true (setting value worked) or false (setting
value failed).
Prototype:
var result = setVariableValue(string nameOfVariable, number
newValueForVariable);
//or
var result = setVariableValue(string nameOfVariable, string
newValueForVariable);
Example:
var worked = setVariableValue("@DisplayBacklightIntensity",
50);
if (worked === true)
{
print("Setting display backlight to 50% worked!");
}
else
{