Routine Bot - Online Manual

Prev Page Next Page


The list of supported commands in RoutineBot


Introduction - Functions Overview

You will find below the list of commands available in RoutineBot with description telling what the command do and how the command can help you. To access these commands you should run RoutineBot, select there Script tab, and click "Add action" button.

  • Please note: starting version 1.2 the commands are actually functions, so they return some values. Typically, it is 0 if the function failed and 1 if everything was ok.
Group Command Description How can it help?
Applications and Processes      
  Execute. Learn more about Execute function. Runs any external application with parameters. Use this command to execute some external programs. Pass the name of file you want to open as a parameter. Sure, you can manage script to select "Start - Program - Your program name", but using execute command is more reliable way.

Learn more about Execute function.
  ShellExecute. Learn more about ShellExecute function. The function will use program associated with file extension to open it. No need to find the program to execute the file, RoutineBot will use program associated by default.

Learn more about ShellExecute function.
  KillProcess. Learn more about KillProcess function. Closes application. This command closes application. Use it to make your scripts more reliable, for instance, some application, if not closed, might block the further execution of your script. In this case KillProcess command will ensure that the process was closed.

Learn more about KillProcess function.
  FindWindows. More information on FindWindows. The functions helps to find window(s), by some text in the caption or in the process name. If you deal with more than one window, check also commands from Lists group. More information on FindWindows. Use it to find appropriate window, then use other commands from "Application and Process" to work with windows handle. More information on FindWindows.
  SendMessage. Learn more about SendMessage function. The function will do SendMessage function to some window found with FindWindows function. For instance, it is possible to send commands Activate, Close, Minimize, Maximize, Normalize.

Learn more about SendMessage function.
  WindowActive Pass window handle to the function, the result will be 1 if the window is active, 0 if not. Use it to make sure the window you are working with is active.
  WindowVisible Close to WindowActive, returns visibility state. Sometime window might be active, but not visible, this function will let to check visible state.
  ExecuteMenuItem ExecuteMenuItem( AppPath:String, MenuItemName:String ) Functions executes certain menu command in application. Read more.
  MouseFocuse Focuses mouse on specific image. Parameters are Try Interval and Time out.

when adding command you can specify left or right mouse click.
One of the most powerful command. It searches for some picture on the screen, if found, the command will focus your mouse pointer on the center of this image.

What if image will not be found? It depends on your parameters - try interval and time out interval. It is good idea to use some timeout and try intervals. As sometime it takes computer time to execute your commands and show results on the screen.

  FuzzyMouseFocuse FuzzyMouseFocuse works exactly as a MouseFocuse, but this function can find the image, which is few pixels different from what you have in the library. Use this function when you can expect the control or the text to be changed a little. 
  MouseFocuseCV The function uses OpenCV (Open Source Computer Vision) library to find objects on the screen Use this command when you expect that the object's appearence might change.
  MouseClick, MouseDoubleClick This command emulates mouse click on the current cursor position.

Note: when adding command you can specify left or right mouse click.
Use this command after MouseFocuse command to click on the objects you focused on. For instance. to click the button or click the list on the web-site.
  ClickButton Click on the button. Pass button's caption as a parameter. If you have a button on in your application and it has some caption, then it is the best way to click this button. Sure, you can focus on it with MouseFocuse and then click on it, but ClickButton will work faster.
  MouseUp and MouseDown Emulates the MouseDown event and MouseUp event. Actually, MouseClick in Windows is MouseDown + MouseUp.

Note: when adding command you can specify left or right mouse click.
Sometime there is need to press and don't release mouse button. In this case these command will help.
  MouseScrollUp and MouseScrollDown These two command emulates the mouse scrolling on the page. The parameter is the number of steps to scroll. Sometime it is necessary to fill some data on the top of the page, then scroll down and then click "Submit" button. That is the way you can automate the scroll down task. Sure, you can focus the mouse on the down arrow, but scrolling in this way is more reliable.
  MouseMove Moves the mouse to the screen coordinates. This command moves the mouse to the screen coordinates, where X=0 is the left and Y=0 is the top.
  MouseMoveRel Moves mouse relatively. This is very useful command. Use it with MouseFocuse command. First, you focus on some object on the screen, for instance, it is label above the text box, then you move a little your mouse down (so it will point on the text box), then you click and enter necessary text. This command is very useful, as sometime it is not possible to focus on the object by it's image template, but there are a lot of other objects that helps to focus on this object and then move mouse relatively.
  MouseX and MouseY functions These two functions will return integer value of the current mouse X and Y coordinate Use functions to have an integer values of coordinates. It is a function only, if you need to move mouse to somewhere, you will need to use MouseMove or MouseMoveRel functions.
  EnterKeys Pass to this command any text sting that you want to enter. Actually, you can click any key using this command.

Check more information about supported keys.

The most useful keys:
  • EnterKeys('^v'); - will emulate the Control + V command, e.g. paste text or picture from the clipboard.
  • EnterKeys('~') - will emulate "enter" key.
  • EnterKeys('%{PRTSC}'); - emulates Alt + PrintScreen key.

Check more information about supported keys.

  KeyBrd Clicks certain key, should pass Virtual Key Code as a parameter Pass VirtualCode (check the list of virtual codes) and if the key should be IsUp
  SetKbdLayout / GetKbdLayot Functions will set or read keyboard layout. If there are more than one layouts on the computer, say English and German, it is necessary to make sure that you are entering the text with script using right layout.
  ListSize. Learn more about ListSize function. Use this function to get the number of items in the list. Pass list variable name as a parameter. Functions, such as FindWindows might return not a single item, but a list. ListSize will return the size of this list.

Learn more about ListSize function.
  ListItem. Learn more about ListItem function. Use this function to access certain item from the list. Pass list variable name and index of item that you want to read. Functions, such as FindWindows might return not a single item, but a list. ListItem will return certain item from the list.

Learn more about ListItem function.
  ToStr Converts Integer to String str:=ToStr(123); // pass integer as a parameter to convert to the string
  ToInt Convert String to Integer int:=ToStr('123'); // pass string to convert into integer
  FileExists The function will return 1 if passed parameter is a valid name of file, which exists. 0 - if the file doesn't exist. Example:

if FileExists('C:\tmp\tmp.ini')=1
then begin
else msgbox('Does not exists');

  DirectoryExists Function checks if the specified directory exists  
  MakeDir Function creates directory  
  IncludeIniFile Use this function to declare variables with some predefined values. Useful when a lot of variable parameters need to be passed to script.

Learn more about IncludeIniFile.
Here is example. We have tmp.ini file in C:\tmp directory, the content of the file is just one line "a=The test text from ini", in this way we declare the variable a. Now, we will test it in script like this:
the result of script execution will be the message "The test text from ini"

Learn more about IncludeIniFile
  GetFileContent The function will return the text content of the file.

Use this function together with FileExists function.


  • a:=GetFileContent('C:\tmp\somefile.txt'); // the a now contains the content of the file
  • CopyToClipBoard(GetFileContent('C:\tmp\somefile.txt')); // will get the content of the file, it is possible now to use clipboard value to paste values into the web-form or somewhere else.
  WriteText The function will write a certain text to certain file. Learn more about WriteText

The function has three parameters:

  • File name to write
  • The text to write
  • Append (1) or rewrite file (0)


  • WriteText('C:\test.txt','text',1); // will append 'text' string to the file C:\test.txt

Learn more about WriteText

  CopyToClipBoard The command is useful, if you need to copy the value of some variable to the clipboard.

The function is good to use together with GetFileContent function when you need to insert some text into the text field on the web-form.

The are two ways to use this function:

  • CopyToClipBoard(i); // the function will copy the value of variable i to the clipboard
  • CopyToClipBoard('test'); //the function will copy the text string to the clipboard

This command will get the content of the file and copy it to the clipboard:

  • CopyToClipBoard(GetFileContent('C:\tmp\somefile.txt'));
  GetClipboard The command will read the text content of the clipboard and insert it into the variable; If the clipboard contains "Sample text", then after:


the value of "a" variable will "Sample text"
  TakeSnapShot The command will take the screenshot. The first parameter is the name of screenshot file that RoutineBot should create. The second parameter determines if there should be the screenshot of all screen or only of active window.
Debug and information      
  LogMessage Pass the message to log and the program will write it into its log Can use this function for some internal debugging
  LogImage Adds the image variable to the htm log. LogImage('img');
  LogImageUnderCurson Adds the image under cursor to the htm log. LogImageUnderCursor(100,100); // define as a parameter area that should be taken as a screenshot
  SetLogState If passed 1, then the program will run the logging; If 0, it will stop the logging; If -1 then it will return current logging state It is useful for debugging the script, when for certain parts of script logging is not needed.
  FindAVText This function searches for "Access violation" text on the screen, if this text exists, then function returns 1. This function is used in default OnException script, you can replace it with your own, more advanced solution to check for exception in your enviroment.
  MsgBox The function will show a standard window dialog with text or variable value


  • MsgBox('Message Text');
  • MsgBox(a); // will show the message with a variable value
  ShowHint This function will show specified text in a hint near products' icon in the tray. Use it to inform yourself or quality engineer about the process stage during testing or routine tasks automation.


  • ShowHint('Test Message1','Info'); // will show test "Test Message1" as a hint with title "Info".
  LineN The function returns the line, which is executed in script now. Use LineN function for debugging purposes when needed.
  FindAVTextLog The functions searches for "Access violation" in windows' captions. Returns 1, if the text was found.
  Random The function returns random value. Function can return real values or integer values. Random(10); // for integer values in interval 0...9
Random; // for real values
Script execution      
  Wait Script just waits for a necessary time. Pass wait interval in milliseconds. Sometime it is a good idea to wait... until application will run or web-page will be fully loaded. Sometime RoutineBot might click too fast so that some web-site might not be fast enough to update data.

A better alternative to Wait is MouseFocus command, think about MouseFocus command in this case as about "WaitForImage" command. In will not just wait specified time, but will search for some image to appear. If found, it will continue running script.

  Sleep Works exactly as command wait Works exactly as command wait
  SetWarningsOn Specify whether RoutineBot should automatically process possible warning messages. More information on syntax of SetWarningsOn function. Sometime there might be some unexpected problem. For instance, one of your applications will close with access violation message. RoutineBot has an ability to close these messages automatically. Learn more...
  Show and Hide commands Show or Hide for script executer program. When you just debug your script don't use these commands, in this way you will see how script is executing, what images it is looking in ImageFocus command. When your script is ready use "Hide" command in the first list of the script.
  Download The download command will download file from http or ftp server or from any web-site. Pass URL as a first parameter and file to save results as a second parameter. Use during testing of web-applications, for instance, to check results of some online request.
  Help This command will open the dialog with all script commands You might use this dialog for testing purposes or for your information.
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)