Automate program using variables and functions

Working with variables and functions is one of advantages of MouseRobot automation program. There are many convenient ways to set, change and use a value of variable. MouseRobot automation program has many build-in functions to work with date and time, strings, Windows system variables, math and etc.

This article describes the basics of using variables and functions in MouseRobot automation program.

Variables and functions are the special keywords in MouseRobot, designed to store and process data during task execution.


In the simplest case, the variable of MouseRobot automation program is a word or phrase in braces (for example, {WindowsDirectory}). During task execution, the variable is replaced by its value.

There are two type of variables in MouseRobot automation program:

  • Built-in variables, to which the program assigns values automatically
    • {LastProcess} - recently run program or command
    • {WindowsDirectory} - full path to the Windows directory
    • {TaskFileDirectory} - directory where task file in located
  • User variables, where the values are explicitly assigned in steps (for example, in the "Set variable or call function" step)
    • {my_var}, {var1}, {var2}, {my_document_name}


The functions take one or more parameters, on the values of which they calculate the result.


  • {Sum (2,2)} adds two numbers and returns the result (in this case - "4")
  • {StrStarts(abcdef, abc)} checks if the string starts with a certain substring
  • {Range(1, 10)} - list of numbers from a given range
  • {ControlText({LastControl})} returns control text
  • {DateValue({Now})} extracts date

How to use variables and functions

You can use variables and functions in all functional steps and snippets (Windows Command, Search Object on the Screen, Mouse and Keyboard, Condition, Loop and others).

For example, in the step "Mouse and Keyboard":

Variables sample

The list of built-in variables and functions is given in the MouseRobot User Manual (Reference section), and for quick insertion, you can use the drop down menu of "Value" ("V") button:

Build-in variables and functions


Bookmark & Share


Subscribe to Blog

AutomationBox Blog



View all


I had tried other types of macro programs before, but have not used them because I don’t have time to learn how to do the things that MouseRobot offers to do for me in the main interface. This is the most useful program for me thus far!
Jiang Zhao

I would like to say that MouseRobot is a great program and it is fast and very easy to use. If you create an macro to go to a web site and do what you need on it, MouseRobot will perform most of actions instantly and just as fast as your browser can load a page! MouseRobot is real time saver!
Lisa Tomcic, web designer



November 11, 2010
New Feedback System


October 16, 2010
MouseRobot 2.0 released!

Download Now!


June 24, 2010

MouseRobot 2.0
(beta-version) available


June 21, 2010

Site design changed!


News Archive >>