Variables

Some macro actions create data which you most probably want to use in a other macro actions in your script.

Examples:
  • The ImageFind action finds the X/Y coordinates of an image.
  • The on-screen text recognition gets the text found on screen.
  • The result of the math calculation is stored in a variable.
  • The clipboard can also be stored in a variable.
  • A region of your screen is captured and analyzed with the OpenAI image action.
  • The OpenAI action output is stored in a variable, e.g. to output the result with the text action.

To transfer such data between actions, so called "variables" are used as data storage places. A variable consists of a name of your choice such as "FoundX".

For example, Macro Recorder can find the X/Y position of a picture on the screen and store the X and Y coordinate in variables "ImgX" and "ImgY". These variables are later used by a mouse click action that clicks on the X/Y coordinate stored in those variables.

Variables can also be used to transfer and exchange data with the productivity solution PhraseExpress.

Variables are volatile and dismissed on program shut-down.

Create new variable

To define a variable, simple type in the desired name in the corresponding input box in the dialog window of any Macro Recorder action that generates data:

You can also use the "Set variable" action to create a new variable and/or set the contents of an existing variable:

Use variables

To use a variable, enter its name or select from any existing variable that has been defined earlier in your script:

You can also use variables, created in Macro Recorder in the productivity solution PhraseExpress. Macro Recorder can also read variables defined in PhraseExpress.

Calculation

Macro Recorder can perform calculations with variables and store the result in a variable:

To add a variable to the equation, right-click into the text box and select the desired variable from the popup menu.

This feature allows you to create counters, calculate the distance between multiple images or text found on the screen or calculate mouse coordinate offsets, for example.

Example for a simple counter that increments the variable named "counter" by 1 for each cycle:

Supported operations, functions and constants

Operations:

+, -, *, /,
^, ** - power
! - factorial
(, ) - brackets

Functions:

sin, cos, tan, ctg, abs, sqrt, ln

Constants:

pi, e

Table of Contents


Table of Contents