Routine Bot - Online Manual

Prev Page Next Page


RoutineBot script syntax


Introduction - Functions Overview - Home Page Online

There are some basic syntax features used in RoutineBot:

  • Starting version 2.0 RoutineBot supports Pascal Scripts, Java Scripts, Basic Scripts
  • To change the scripting language use Scrip Language command in Project menu
  • Scripts can contain variables, there are various ways to declare variables
  • Functions and procedures declarations are possible
  • External units can be included into the script

The examples below will help to understand how everything works.


The declaration of variables in RoutineBot is similar more to php and basic ideology, e.g. the variable can be declared anywhere in the script.

  • a:=2; // the new variable a was declared
  • b:='test'; // the new variable b was declared

There are also some specific ways to declare variables, which help in test automation:


The example below will show how to use functions in RoutineBot. First, we need to create a basic function main. From the main function we call previously declared function test.

function test(a1, a2: integer; a3: string): integer;

function main: integer;
r1:=test(3,4, 'test');


the result of script execution is the message 'test' first and then the message '7', which is the sum of passed variables.


Please, note: in the same way you can pass parameters to screen-related functions. For instance:



and it is a good place to show how to use if operator

Using IF operator

There are pascal standard IF... else operators, here is an example:

cancel_btn:='cancel_button.bmp'; // please, note: there must be cancel_button.bmp image in the project


if a=1 then MsgBox('Cancel button image exists')

else MsgBox('The image does not exist');

Cycles: operators FOR and UNTIL

The for and until operators are also available:

a:=0; // this example will count using MsgBox from 1 to 3
for a:=1 to 3 do begin

using until operator is a good idea to wait for some image to appear.

For instance, when it is necessary to check the list of some items, script can move mouse to the first element of the list and then use keyboard to move and MouseFocuse function to check if necessary item exists in the list. The function below will show how to manage this with RoutineBot:

function af_category_selection: integer;

MouseFocuse('category_label.bmp',10000);  // moving the mouse to the category label, this might be "The list of possible categories:"
MouseMoveRel(9,20); // Actually we don't need category label, but we need the list of available categories, so we move the mouse to this list
MouseClick; // Click once to focus on the list
EnterKeys('{UP 100}'); // Emulate the big number (100) of UP key (arrow up on the keyboard) to make sure we are in the beginning of the list

EnterKeys('{Down 10}'); // now we are in the drop list and press DOWN ARROW 10 times to move a little down

// depending on the category we are looking for we check the necessary image for existance
if article_category='management' then

if article_category='software' then

until cat=1;

// if the category was found we click on it

Result := ff;

Uses command to include stand alone unit

In the style of Pascal one can include external unit into the project. Here is as example:

Unit Sample;
uses unit1; // there must be a file in your project (.zip file) with the name unit1

function main : Integer;


Converted from CHM to HTML with chm2web Pro 2.85 (unicode)