Design the Tutorial Bot

This chapter describes step 3 in the RPA Studio First Steps tutorial.

What will you do here? 

You will design your Bot.

For more detailed information on this process, see "Design your Bot".

Why is that important?

"Designing a Bot" means adding Steps to your Bot. These Steps tell the Bot what to do.

Video

The following video takes you through the design process. A step-by-step description is below.

Tell the Tutorial Bot what to do

Now it's time to automate the process that you have mapped out.

To do so, you replace the Placeholders with regular Steps. In these Steps, you tell the Bot what to do.

As a first Step, you want the Bot to open the demo application. You'll use a Module to create this Step.

When you design Bots, you work with two types of Modules (see "Use Modules"):

To create this Step, you need the Module OpenUrl from the RPA subset.

  1. In the Flowchart tab, click on Add within the Placeholder Open the registration page.

Turn a Placeholder into a regular Step

  1. In the subsequent Add dialog, select the Module tab and type OpenUrl into the search bar. This is not case sensitive.

Module tab: search for the Module OpenUrl

  1. Double-click on the Module in the search results, or press ENTER. This replaces the Placeholder with a Step created from the Module.

  1. Each Step consists of one or more Step Values, which tell the Bot exactly what to do.

    You fill out these Step Values in the Details tab.

    In this case, you need to fill out only one: the Step Value Url. Enter the URL of the demo application into the Value column:

    https://documentation.tricentis.com/sampleapp/rpa/index.html

Fill out the Step Value Url of the Step Open registration form

If you are ever unsure which Module you used in a Step - or you want to modify the Module you used - right-click the Step and select Jump to Module from the context menu.

In the next Step, you want to ensure that the browser window is maximized and in front.

To do so, you need the Module Window Operation from the RPA subset.

  1. In the Flowchart tab, click on Add within the Placeholder Manipulate browser window.

  2. Create a Step from the Module:

    • Search for the Module Window Operation.

    • Double-click the Module in the search results.

  3. Fill out the Step Values as shown in the screenshot below.

    The window's Caption is actually much longer. Instead of typing out the full name, you can use a wildcard * (see "Use wildcards").

Maximize the browser window and bring it to the front

As you can see, this Step has more Step Values than you currently need.

Press F9 to hide all do-nothing Step Values, or click Hide DoNothing in the View menu. This helps you to keep a good overview of complex Modules.

To show do-nothings again, press F9, or click Show DoNothing in the View menu.

Steer the demo application

Now it's time to steer the demo application. In the next Steps, the Bot types in the visitor data and saves the resulting registration code.

  1. Click on Add within the Placeholder Enter registration data.

  2. Select the Module Enter visitor data. This is the Module that you created by scanning the first page of the demo application.

If you can't see any Step Values in the Step, press F9 (or click Show DoNothing in the View menu).

Since you haven't filled out any Step Values yet, they are technically all do-nothings.

  1. Fill out the Step Values:

    • Type in any first name, last name, and email address into the respective Step Values.

    • For the Step Value Visitor Type, select Business from the drop-down menu in the Value column.

      A drop-down menu in an application is a so-called ComboBox control. In the Module, the control has a value range. Once you create a Step out of the Module, this value range turns into a drop-down menu in the Value column.

    • Type in a company name.

    • For the Step Value I agree to the Terms and Conditions, select True from the Value drop-down menu. This prompts the Bot to tick the box (see "Checkbox").

    • For the Step Value REGISTER (see " Button"), enter x. This is a click operation.

      If you use x instead of {Click}, the Bot performs a left-click without using the cursor.

    Since the Bot should input all these things, use ActionMode Input for all Step Values (see "Use ActionModes").

Fill out registration data

Now you want the Bot to save the registration code that the system generates.

For this, you need the Module you created by scanning the second page of the demo application: Registration code.

You will also use your first Buffer. Buffers save the content of controls, so you can reuse it later on (see "ActionMode Buffer").

  1. Click on Add within the Placeholder Get code.

  2. Select the Module Registration code.

  3. To save the content of the Label Code, perform the following actions:

    • Enter a name for your Buffer into the Value field, for instance SavedCode.

    • Set the ActionMode to Buffer.

At run-time, the Bot saves the current content of the Label, which is the registration code you generated for this particular visitor, to a Buffer named SavedCode.

If you run the Bot again, the demo application generates a new registration code. The Bot then saves this new code to the Buffer SavedCode, overwriting the old code.

Save the registration code to the Buffer SavedCode

Create an IF Statement

When you mapped out your process, you added an IF Statement, because you want the Bot to perform a quick check.

Since the Bot has to open Notepad, you want to make sure that Notepad isn't already open. If it were, the Bot wouldn't know which window to steer and throw an error.

The blue element with the question mark is a so-called Control Expression. That's the statement that the Bot checks. You can create Control Expressions in one of two ways (see "Work with Control Expressions "):

  • Type in a comparison.

  • Use a Module that performs a verification.

In this case, you want to check whether Notepad is already open. To do so, you need the Module Window Operation from the RPA subset.

  1. Click on Add within the Control Expression.

Use a Module in a Control Expression

  1. Select the Module Window Operation.

  2. Fill out the Step Values as shown in the screenshot below. The ActionMode Verify lets the Bot know that it should verify the Value (see "ActionMode Verify").

Check whether Notepad is already open

Now you need to define what the Bot should do if the Control Expression is TRUE (Notepad is open) or FALSE (Notepad isn't open).

  • If it's TRUE, the verification passes. In this case, the Bot should go straight to writing the registration code into the file.

  • If it's FALSE, the verification fails. In this case, the Bot first has to open Notepad.

That means you only need to add an extra Step to the Failed path of the IF Statement.

  1. To do so, click on Add within the Placeholder Open Notepad.

  2. Select the Module Start Program, which is part of the RPA subset.

  3. Fill out the Step Values as shown in the screenshot below.

Tell the Bot to open Notepad

Your IF Statement now looks like this:

Defined IF Statement

Manipulate the file

In the next Steps, you want to manipulate the text file: get it ready and add the code.

First, the Bot should bring the Notepad window front and center, so the Bot can steer the window. This Step is no longer part of the IF Statement.

  1. In the Flowchart, click on the first Add after the IF Statement to add another Step.

  2. Select the Module Window Operation to create this Step.

  3. Rename the Step to Bring Notepad front and center.

  4. Fill out the Step Values as shown in the screenshot below.

    The window's full caption is Untitled - Notepad. Instead of typing out the full name, you can use a wildcard * (see "Use wildcards").

Move Notepad to the front and center

Now you want to write the registration code into Notepad.

  1. Click on Add within the Placeholder Write code to Notepad.

  2. Select the Module Send Keys, which is part of the RPA subset.

  3. You want to write the following text into Notepad: The registration code is <registration code>.

    Instead of <registration code>, the Bot should add the actual registration code. To do so, fill out the Step Values as shown in the screenshot below.

    The Value Expression {B[SavedCode]} tells the Bot to insert the value that you previously saved to the Buffer named SavedCode.

Write the registration code into Notepad

Save and close the file

In the next Steps, you want to save and close the Notepad file.

The first Step prompts the saving process:

  1. Click on Add within the Placeholder Save file.

  2. Select the Module Send Keys.

  3. Rename the Step to Press CTRL + S.

  4. Fill out the Step Values as shown in the screenshot below. In the Step Value Keys, you are using a Microsoft SendKeys command to steer the window.

Save the file, part 1

The next Step steers the subsequent Save As dialog.

  1. Click on Add in the Flowchart and select the Module Save As to create this Step.

  2. Rename the Step to Save As dialog.

  3. Fill out the Step Values as shown in the screenshot below.

    In this case, the Bot saves a file with the name tutorial.txt to the directory C:\Temp. Make sure that the directory C:\Temp exists on your machine.

Save the file, part 2

In the next Step, you want to close the Notepad file.

  1. Click on Add within the Placeholder Close file.

  2. Select the Module Window Operation.

  3. Fill out the Step Values as shown in the screenshot below:

Close the file

Close the browser window

In the final Step, you want to close the browser window:

  1. Click on Add within the Placeholder Close browser.

  2. Select the Module CloseBrowser.

  3. Fill out the Step Values as shown in the screenshot below.

    The browser tab's full caption is Tricentis RPA - Thank you for your registration. Instead of typing out the full name, you can use a wildcard * (see "Use wildcards").

Close the browser window

What's next

Congratulations! You have designed your Bot. Now it's time to test it.

Was this information helpful?

Tricentis RPA Studio Manual 2020.2 © Tricentis GmbH