System information
Manual:Scripting
30
#valid variable name
:local myVar;
#invalid variable name
:local my-var;
#valid because double quoted
:global "my-var";
If variable is initially defined without value then variable data type is set to nil, otherwise data type is determined
automatically by scripting engine. Sometimes conversion from one data type to another is required. It can be
achieved using data conversion commands. Example:
#convert string to array
:local myStr "1,2,3,4,5";
:put [:typeof $myStr];
:local myArr [:toarray $myStr];
:put [:typeof $myArr]
Variable names are case sensitive.
:local myVar "hello"
# following line will generate error, because variable myVAr is not defined
:put $myVAr
# correct code
:put $myVar
Set command without value will un-define the variable (remove from environment, new in v6.2)
#remove variable from environment
:global myVar "myValue"
:set myVar;
Commands
Every global command should start with ":" token, otherwise it will be treated as variable.
Command Syntax Description Example
/ go to root menu
.. go back by one menu level
? list all available menu commands and brief
descriptions
global :global <var>
[<value>]
define global variable :global myVar "something"; :put
$myVar;
local :local <var>
[<value>]
define local variable { :local myLocalVar "I am
local"; :put $myVar; }
beep :beep <freq>
<length>
beep built in speaker
delay :delay <time> do nothing for a given period of time
put :put <expression> put supplied argument to console
len :len <expression> return string length or array element count :put [:len "length=8"];
typeof :typeof <var> return data type of variable :put [:typeof 4];