<< Functions | Table of Contents | Information >>


Any variable name begins with the dollar sign ($) and can contain letters, numbers and underscore. Variable names are case sensitive, i.e. $Variable and $variable are not the same.

A variable can be temporary (i.e. holds it value until Hot Keyboard restart) and permanent (saves its value on exit and loads it back on the next startup); the scope of a variable is defined on its assignment and can be changed later (both through another assignment or through the GUI). Trying to get value of a non-existent variable results in the empty string returned (scripting engine does not produce an error, it behaves exactly the same as the classic basic interpreter did).

Hot Keyboard variables are global - there are no local variable nor ability to scope. Be careful when importing macros with scripting and assign variables with meaningful names

Defining a variable

Inside a script

To define a variable call SetVar function within any macro that supports scripting functions:

${{ SetVar($myvar, 1) }}
${{ SetVar($anothervar, "text") }}

You can use other scripting function to assign a variable value:

${{ SetVar($myvar, InputBox("Enter value:") ) }}
${{ SetVar($cosine, cos($myvar) ) }}

Settings -> View/Modify Scripting Variables

Once declared (at least one macro execution is required), variable is listed within variable list that is accessible at Settings -> View/Modify Scripting Variables

Variable name - use ${{ $<variable name> }} to refer to the variable. Remember, the name is case sensitive

Type - number or string. Hot Keyboard converts types where possible

Value - current value, unless Save flag is set, variable value remains until Hot Keyboard restarts

Save flag - save variable value between restarts