How to record a macro?

How to record a macro?

You already know the basic theory about macro recording, so it is time to move on to practice. To record a macro, press the red Record (1) button.

 

 

From now on, the robot will record all actions that you perform: mouse clicks, keyboard shortcuts, opening a file or an application.

 

During the recording there are 3 functions available:

 

 

  1. Tools – additional functions helpful during the recording. Their description can be found in this article.

 

  1. Stop – stops the recording. Press this button only when you have recorded all the steps you have planned.

 

After clicking “Stop”, the robot will start processing the saved actions. The processing time depends on the complexity of the steps, their number and the technical parameters of your computer.

 

  1. Pause – pause recording with the possibility of restarting.

 

 

 

 

Tools

 

 

 

 

  1. Open WebView browser – opens the built-in website browser (2). Type any website address in the bar (3) and confirm with the open site button (4).

 

 

Important: The robot has a built-in website browser but supports also Google Chrome. To use it, choose Open new Chrome tab.

 

  1. Open application – opens application, which is involved in the automation, such as a calculator or a PDF document. Once clicked, select the application path (1), select the correct file (2) and click Open (3). To run an application and get back to the recording, click the check mark (4).

 

Additionally, by selecting Open application, a field for entering the parameters of a given application will be displayed (5). It allows you to enter parameters for a given application, e.g. automatic launching of a new message window in Outlook and setting its content and subject. Read more about application opening parameters here.

 

  1. Open file – a tool for opening files on which operations will be performed, e.g. files with extension .erDOC, .json, .pdf. Click on the Open file icon (1), indicate the path to the file by selecting it from the explorer list (2) and press Open (3). To open the file and get back to the recording, click the check mark (4).

 

  1. Append block – allows you to enter a block that groups recorded steps into a given thematic segment, e.g. all copy and paste actions. Blocks improve the clarity of the robot and make it easier to navigate the steps and distinguish between them, which is especially useful if the macro consists of many different steps.

 

 

 

 

You can name a block (1) and add a note to it (2). To open the block, press the check mark (3). From then on, all steps will be recorded within the block.

 

 

Example: If a macro consists of many different operations, some of the steps, e.g. concerning one process, can be grouped into a block. Below we have arranged into a block all the steps involved in the process “Logging into system X”.

 

To close the block, press the button “End block” / “STOP” (7)

 

Important: Once the block is finished, the macro does not stop recording. If you want to create blocks manually after the recording has finished, you can do this in the advanced view.

 

 

  1. Append condition (conditional block) – function that makes the execution of steps in a macro dependent on a certain variable. For example: if the value in field X in application Y is Z (e.g. a cell in Excel contains the word “Mail”), then the robot will perform a given operation (e.g. send an e-mail to a given person).

 

After clicking on Append condition, a form to define it will appear. In the Expression field (1), enter a condition in a predefined scripting language. so knowledge of the language (Beanshell/JavaScript) is required. A simplified way of creating conditional steps is described in the article “How to add a conditional step?

 

Below we describe the creation of a condition in record mode based on the above example with sending an email:

 

${xxx}.equals(email contact)

 

  • in the first part, give the name of the defined variable – in this case xxx, which must be enclosed in brackets and preceded by “$”

 

  • then put a dot and enter the operator, i.e. the rule which the condition should take into account. In this case it will be “equals”

 

  • to end the condition, after the operator, enter the text to which the value of the variable read by the robot is to be compared, i.e. the parameter to which the value from the variable.

 

In the Variables (2) field, a list of variables used in the macro is displayed. You can click on such a variable and it will be automatically entered in the Expression field. In the Notes field (3) you can enter a text describing the condition assigned to it.

 

The opening of the conditional block is confirmed by pressing the check mark (4). From now on the steps will be recorded within the conditional block.

Important: Conditions can be combined and extended in different ways. An example of the use of combined conditions could be a macro which task is to generate documents for company employees aged 18-25. To create such a macro, the conditions “age greater than 18” and “age less than 25” would have to be combined.

 

To close the condition press the End condition / STOP button (7). Once the conditional block is finished, the macro does not stop recording. If you want to create blocks manually after the recording has finished, you can do this in the STUDIO or SERVER robot view.

 

 

  1. Append a loop – one of the most commonly used functions that repeats (loops) the recorded steps on the remaining records in the database. You can name the loop (1) and enter a note to it (2). To start recording the steps to be looped, press the check mark (3).

 

Example: If you have an Excel sheet with employee data that you want to apply to individual PDF documents, simply record loops on the first row. The robot will move the data from the application to the file until it hits an empty row in the application. The robot recognises a dataset, in this case in an Excel sheet, and will propose to create a loop on the dataset automatically recognising its range.

 

Important: when recording, perform actions only in the application that participates in the loop, and always start loop recording from the point where

the process starts. For the above example:

 

  • before recording the loop open the file with the data set (Excel)
  • start the loop recording and open the form into which you want to enter data (PDF file)
  • copy a given value from Excel and paste it into the PDF file in the appropriate place
  • repeat the operation for all values from the first row
  • save the PDF file and end the loop recording with the button End loop / STOP

 

 

The robot repeats these actions for the remaining records in the database. Once the loop is finished, the macro does not stop recording. If you want to create loops manually after the recording has finished, you can do this in the robot’s advanced view on the STUDIO or SERVER license.