EasyManua.ls Logo

Topcon OPUS A6G2 - Page 514

Topcon OPUS A6G2
800 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
514
OPUS Projektor Manual
JavaScript
7
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.
Debugging
Since May 2016, the new JavaScript engine provides a way to debug JavaScripts with the
Windows Simulation. Here you can configure if the debugger shall be off, on (open on
exception) or on (open on start).
The complete documentation of the used debugger can be found here: QtScriptDebugger
Manual. There you can learn how the debugger can be used and e.g. how breakpoints can be
set.
Some quick notes:
514
530 530
596

Table of Contents