EasyManua.ls Logo

Standa 8SMC5-USB - 6.5. XILab Scripts

Standa 8SMC5-USB
345 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...
6.5. XILab scripts
Brief description of the language
Data Types
Statements
Variable statements
Reserved words
Functions
Syntax highlighting
Additional XILab functions
XILab log
Script execution delay
New axis object creation
New file object creation
Creation of calibration structure
Get next serial
Wait for stop
libximc library functions
Examples
Cyclic movement script
A script which scans and writes data to the file
A script which moves the controller through the list of positions with
pauses
A script which enumerates all available axes and gets their coordinates
Bitmask example script
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 third edition
of the ECMAScript standard.
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