JavaScript

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

JavaScript

Please Note the following changes in May 2016:

The complete JavaScript engine was exchanged!

Due to some problems experienced with the old Google v8 JavaScript engine, the engine was replaced with QtScript. The new script engine solves all issues currently known to us and has some more advanteges (like a debugger that can be used with the Windows simulation, see here).

One importand difference to the old engine is that global variables are handled differently which might make changes in existing script neccessary:

In the old engine a variable that was declared as "var myGlobalVariable = 0;" in script A could be used in script B after script A was run once. THIS WILL NOT WORK ANYMORE! myGlobalVariable will not be accessible in script B with the new engine.

If it is really neccessary to use global variables, you can declare them as "myGlobalVariable = 0;" in script A and then use it in script B after script A was run once. Note the missing "var" keyword!
The same goes for functions. You need to declare functions without the keyword "function" to use them in other scripts.

We anyway do not recommend to use global JavaScript variables. It is far more reliable and secure to store important variable values that are needed in more than one script in a dedicated PClient variable (use setVariableValue and getVariableValue functions).

Other than that, the new JavaScript engine should not make any more changes in existing scripts neccessary.

JavaScript can be used to introduce highly-dynamic aspects into the project. It serves as a powerful, yet easy to use scripting language that enhances the possibilities of the tool. Seamlessly integrating into the architecture, it offers access to all the events and variables that can occur.

Do not use Java Scripts for extensive calculations! Also a frequent call of scripts is bad idea. This will slow down the complete terminal; instead the scripts should be small and fast.

If your desired functionality can not be realized with a small script or with other methods provided, please contact the support team. Most often there are other ways to get the result you want.

The JavaScript Editor

 

Assign a JavaScript file to an Event

 

JavaScript Basics

 

Custom JavaScript functions for device specific functionality

 
Programming Guidelines

hmtoggle_plus1Debugging