Brief description of the language
Data Types
Statements
Variable statements
Reserved words
Functions
Syntax highlighting
Additional XILab functions
6.5. XILab scripts
XILab scripting language is implemented using QtScript,
which in turn is based on ECMAScript.
ECMAScript is the scripting language standardized by
Ecma International in the ECMA-262 specification and
ISO/IEC 16262.
QtScript (and, by extension, XILab) uses
Brief description of the language
Data Types
ECMAScript supports nine primitive data types. Values of
type Reference, List, and Completion are used only as
intermediate results of expression evaluation and cannot
be stored as properties of objects. The rest of the types
are:
Undefined,
Null,
Boolean,
String,
Number,
Object.
Statements
Most common ECMAScript language statements are
summarized below:
Name
Usage
Description
Block
{[<statement list>]}
Several statements may be grouped into a
block using braces.
Variable
declaration
var <varialble declaration list>
Variables are declared using "var"
keyword.
Empty
statement
;
Semicolon denotes an empty instruction. It
is not required to end a line with a
semicolon.
Conditional
execution
if (<condition>) <instruction>
[ else <instruction> ]
Conditional execution is done using "if ...
else" keywords. If a condition is true, then
"if"-block instruction is executed, else an
"else"-block instruction is executed.
Loop
do <loop body> while (<condition>)
while (<condition>) <loop body>
for ([<initialization>]; [<condition>]; [<iterative statement>]) <loop body>
Loops have several forms. A "do ... while
..." loop executes loop body and then
checks if condition is true or false to see
whether it should stop or continue running.
A "while ... do ..." loop repeatedly checks
the condition and executes loop body if it
is true. A "for ..." loop executes an
initialization
statement
once,
then
executes an iterative statement and loop
body while the condition is true.
Return
return [<expression>]
Stops function execution and returns
expression as a result.
Exception
throw <expression>
Generates or "throws" an exception, which
may be processed by the "try" statement
(see below).
Try-catch
block
try <block> catch (<identifier>) <block>
try <block> finally <block>
try <block> catch (<identifier>) <block> finally <block>
Used together with exceptions. This
statement tries to execute its "try"-block.
If an exception is thrown in it, then a
"catch"-block is executed. Finally a
"finally"-block is executed unconditionally.
Either a "catch" or a "finally" block may be
omitted.
Variable statements
Page 267 / 345
Page 267 / 345
Summary of Contents for 8SMC5-USB
Page 30: ...Linux Page 30 345 Page 30 345 ...
Page 83: ...Connection of magnetic brake to one axis or two axis systems Page 83 345 Page 83 345 ...
Page 87: ...Scheme of buttons connection to the HDB 26 connector Page 87 345 Page 87 345 ...
Page 99: ...Page 99 345 Page 99 345 ...
Page 167: ...Vertical load capacity the maximum vertical load on the stage Page 167 345 Page 167 345 ...
Page 186: ...Click Next Click Continue anyway Page 186 345 Page 186 345 ...
Page 188: ...Page 188 345 Page 188 345 ...
Page 190: ...Page 190 345 Page 190 345 ...
Page 193: ...Page 193 345 Page 193 345 ...
Page 201: ...Select the XILab application in the Programs block Start it Page 201 345 Page 201 345 ...
Page 274: ...7 Files 1 Configuration files 2 Software Page 274 345 Page 274 345 ...
Page 331: ...Motorized Iris Diaphragms 8MID98 Motorized Iris Diaphragm Page 331 345 Page 331 345 ...
Page 338: ...8 Related products 1 Ethernet adapter Page 338 345 Page 338 345 ...
Page 339: ...8 1 Control via Ethernet 1 Overview 2 Administration Page 339 345 Page 339 345 ...