Build a basic bot that uses a desktop application

Build a bot that uses a conditional statement to verify that the calculator is open, then uses the calculator to multiply two numbers. This example uses actions from the Application, If, Simulate keystrokes, Message Box, and Window packages.

Prerequisites

To build a bot you must already have done the following:

Procedure

  1. Open a new bot.
    1. On the left panel, click Automation.
      A list of available bots and forms is displayed.
    2. Click Create new > Bot.
    3. Enter a bot name and click Create and edit.
  2. Insert an conditional sequence that verifies that the calculator is open and activates the window.
    1. Double-click or drag the If action.
    2. Select Window exists from the Condition drop-down list.
    3. Select the Application tab and click the refresh icon to display all open applications.
    4. Select Calculator from the Window drop-down list.
      The Calculator window is saved to the variable window-1.
    5. Drag the Message box action into the If container.
    6. In the Enter the message to display field, enter The calculator is running.
    7. Drag the Window > Activate action into the If container below the Message box action.
    8. In the Window field, insert the window-1 variable.
  3. Insert an alternative sequence that opens the calculator.
    1. Double-click the If > Else action.
    2. Drag the Message box action into the Else container.
    3. In the Enter the message to display field, enter The calculator is not running.
    4. Drag the Application > Open program/file action into the If container below the Message box action.
    5. In the Location of the program/file field, enter C:\Windows\System32\calc.exe.
  4. Insert the Simulate keystrokes action to perform the calculation.
    1. Drag the Simulate keystrokes action below the If and Else containers.
    2. In the Window field, insert the window-1 variable.
    3. In the Keystrokes field, enter 5*5=.
    4. In the Delay field, enter 500.
  5. Click Save to save the bot.
  6. Run the bot.
    When the bot runs, the The calculator is not running message appears, then the Calculator window opens, and the calculation is performed.
  7. Run the bot again.
    When the bot runs, the The calculator is running message appears, then the Calculator window activates, and the calculation is performed.
If the bot does not input all of the numbers into the calculator, try increasing the keystrokes delay.