Select chapter

2. Basic Concept

Can't wait to start using Laiye RPA to create automated processes? Before we dive in to the core of Laiye RPA, it’s important to understand some basic concepts. In this chapter, you will be introduced to four basic concepts of Laiye RPA: process, block, command, and property. They are vital for the rest of the tutorial, so please take your time to read this chapter carefully.

2.1 Concept

Let's first look at these four basic concepts, and notice how they contain one another. A process contains multiple blocks, a block contains multiple commands, and a command contains multiple properties.

  • Process

  • Block

  • Command

  • Property


A process is a task to be completed by Laiye RPA, and each process corresponds to exactly one task. Though you can use Laiye RPA build multiple processes, you can only edit and run one process at a time. Later this tutorial, you will see that processes constitute the basic unit in Laiye Worker and Laiye Commander.

If you already have some programming experiences, a process roughly corresponds to a script, but it differs in several important points. For example, a process is a folder of files, while a script is typically just one file. More significantly, an Laiye RPA process is displayed in the form of flowcharts.

We recommend that you open Laiye Creator and follow along as we introduce new materials. Play around with the software, experiment a little, and see everything in action yourself. As people say, practice makes perfect, and the best way to become a skilled Laiye RPA user is to use it.

Laiye Creator already has some built-in example processes. We encourage you to check them out, run the processes, and get familiar with how everything works. Of course, you can always create a new instance yourself.

2.2 Flowchart

After creating or opening a process in Laiye RPA, you can see that each process is represented by a flowchart. The flowchart contains four components: Start, Block, Decision, and End; and they are connected by arrows. See the following figure:

D1-2.2.png
Figure 3: A Flowchart in Laiye RPA

Each flowchart contains exactly one Start component. As the name implies, the process starts from here and follows the arrows to run sequentially through subsequent components.

There can be zero or more End components in each flowchart. Once the process reaches an End component, it will stop running. When there are no End components, the process simply stops when it reaches a component that has no outgoing arrows.

In each flowchart, there can be any number of Decision components. A Decision component is associated with a user-defined condition and branches out to two components. When the process reaches a Decision component, it evaluates the condition and, depending on the result, directs the process to one of its two branches. If the condition is true, the process will follow the "yes" arrow; otherwise, the process will follow the "no" arrow. If you are a beginner, you can forget about the Decision component for now. We’ll introduce it in more detail later.

Last but not least, there must be one or more Blocks in the flowchart. And the Block is the second important concept to be introduced in this chapter.

We can divide a task into multiple steps, each of which is described by a Block in Laiye RPA. For example, if our task is to "put the elephant in the refrigerator", then we can divide this task into three steps:

  • Open the refrigerator door

  • Put the elephant in

  • Close the refrigerator door


Each of the above steps is a Block. Of course, this example is just an analogy. Laiye RPA cannot help us open the refrigerator door. Nevertheless, through this example, we can see that in Laiye RPA, a Block only describes what should be done in a step and does not involve the details of how to do it. Laiye RPA does not specify how detailed a Block should be. A Block can be very high-level. Indeed, you can have a process with only one Block. In this case, the process and the Block can actually be regarded as the same concept. On the other hand, Blocks can be very specific, and a process can be split into many Blocks. So how many Blocks should a process have? It depends on your personal preferences. However, there are two principles that should guide your decision. First, each Block should contain relatively independent logic that makes sense as its own step. Second, you shouldn’t have too many Blocks in a process. Our recommended limit is 20 Blocks.

Why do we give these principles? Well, the flowcharts in Laiye RPA are designed to be a tool to facilitate communication between business experts, who design RPA processes, and regular employees, who use RPA processes. The two parties can lay out the general steps of a process together during the design phase and divide the process into Blocks. Then, the business experts are responsible for filling in the implementation details of each Block, which the regular employees do not need to know. At this stage, if there are too many Blocks, it will naturally be more difficult for them to communicate.

Notice the Run button on the Laiye RPA Creator toolbar, located at the top of the screen. Pressing this button in the flowchart interface will run the process, starting from the Start component and executing each subsequent component in a sequence as the arrows indicate. There is also a small blue triangle on each Block. Pressing the triangle runs the Block on its own. This is a convenient function for us to test each Block separately when developing the RPA process.

You can also view and edit the specific content in each Block by pressing the edit button, which is the pen and paper icon located next to the triangle button. The editing of an individual block is done through the Visual View.

2.3 Visual View

As mentioned in the previous section, there is a pen and paper button on each Block. Clicking this button allows you to view and edit the specific content in this Block, and the interface will change from Process View to Visual View.

FIGURE 4.png
Figure 4: Click and edit the Block in the flowchart

The interface of Visual View that Laiye RPA edits a Block looks as follows:

FIGURE 5.png
Figure 5: interface to edit a Block (Visual View)

In figure 5, the three main areas are marked with three red boxes. From left to right are the command area, assembly area, and property/variable area.

Here you may notice our third important concept, a Command. In a Block, Laiye RPA needs to be told exactly what action to take and how to do it in each step, and Laiye RPA will execute each command we give faithfully. Using the previous example, if the Block is "Open the refrigerator door", then the specific commands might be:

  • Find the handle of refrigerator door

  • Grab the handle of refrigerator door

  • Open the refrigerator door


Of course, as before, this example is just an analogy, and Laiye RPA cannot actually open a refrigerator door. Almost all the commands that Laiye RPA can complete are listed in the command area on the left, which is marked by the first red box in the figure above. Commands are divided into many categories, such as Mouse and Keyboard, Text, etc. You can expand each category to further view the specific commands.

The second red box in the figure contains the assembly area. Commands can be arranged and combined here to form the specific content of the Block. You can add commands to the assembly area by double-clicking a command or by dragging and dropping a command from the command area to the assembly area. You can also drag commands within the assembly area to adjust their ordering or inclusion relationship. You may refer to our Laiye RPA tutorials to see how to interact with these tools.

A command is an action we ask Laiye RPA to do, but it is not enough on its own. We also need to specify the details of this action. These details are the fourth concept we want to introduce, property. If a command is a verb, then properties are the nouns and adverbs related to this verb. Only by combining them together can we provide Laiye RPA with enough detail to execute our request.

In the example earlier, the command "open the refrigerator door" can have the following properties:

  • How much force to use to open the refrigerator door

  • Left or right hand

  • How wide an opening to make


When writing a Block, you can highlight a command by left-clicking it in the assembly area. The property/variable area on the right displays the properties of the currently highlighted command. All properties are either required or optional. Generally speaking, Laiye RPA will automatically set the default value of each property for you, but please pay attention to the required properties, which often have to be modified as required. For optional properties, it is easier to just use the default values, unless you have specific needs in mind.

The display mode currently shown in the assembly area is called Visual View. In this view, the order and inclusion relationship of all commands are displayed as a list of blocks, stacked on top of each other, and some implementation details are hidden to simplify the view. The Visual View reflects an important feature of Laiye RPA as an RPA platform: it is simple to use. Therefore, our designers have put a lot of thought into the layout, degree of detail, and aesthetics of the Visual View. Even the beginner without any programming experience can quickly learn how to navigate the Visual View.

2.4 Code View

You may have noticed that there is a switch that can be toggled between "Visual" and "Code View" above the assembly area, which allows us to access another view, the Code View. When you toggle to it, the property/variable area disappears, and the assembly area looks as shown in Figure 6.

FIGURE 6.png
Figure 6: interface to edit a Block (Code View)

Similar to the Visual View, the Code View also shows the commands contained in the current Block, as well as the properties of each command. However, the commands are no longer contained in neat boxes, and there is no property area to list each command's properties. Instead, they are all displayed as program code.

If you are already familiar with Laiye RPA, the Code View allows you to write commands and specify properties using only your keyboard. Laiye Creator implements many optimizations to help you quickly select commands and fill in their properties in the Code View, which makes implementing Blocks a breeze.

FIGURE 7.png
Figure 7: Add commands in the Code View

The Visual View and the Code View describe the same content within a Block. They are actually two different ways to display the same underlying content. The Visual View highlights each command and their relationship graphically, which is great for showing the overall logic of the Block. The Code View emphasises the essence of the Block in the form of program code and fully exposes all the details.

FIGURE 8.png
Figure 8: Two views of an aircraft

For example, the Visual View and Code View are like two views of plane above. In fact, the left and right wings of this F-16 aircraft are basically symmetrical, but why do they look so different? Well, the right wing is drawn in exterior view to show the overall shape, while the left wing is drawn in perspective view to show the internal structure. By using two views to show different aspects of the same aircraft, we highlight different aspects of our content to the audience. In the same way, using two views to show the different contents of the same Block in Laiye RPA allows us to be both simple and fast, two of the important indicators of an RPA platform.

Some of you might be wondering whether you should use the Visual View or the Code View to develop RPA. The answer is that you don't have to worry about this, because no matter which view you use, you can switch to the other one at any time. No matter what you write in one view, the content will be 100% retained when you switch to the other view, and it will be shown in the other view's format. Therefore, you can use the Visual View first. After being more familiar with it, you can switch to the Code View and learn each command's internal principles. If you feel it is still difficult to understand, you can always switch back to the Visual View. So, there is no need to worry about which view to use, and this capacity to toggle between the two views at any time is a great strength of Laiye RPA!

Finally, the Code View provides another advantage. When you ask others for help on our Laiye RPA forum or in other platforms, you can just switch to Code View, copy your source code, and share your Blocks as text. Others can read your source code directly or copy your source code into their own Laiye Creator and switch to the Visual View to inspect your Blocks. In this way, the efficiency of communication will be greatly improved.

The programming language used in the Code View is Laiye RPA's self-developed BotScript language, and its specific language features will be introduced in detail later.

2.5 Summary

In this chapter, we learned four important concepts: process, block, command, and property. A process contains multiple Blocks, a Block contains multiple commands, and a command contains multiple properties. We also checked out three different views: Process View, Visual View and Source Code View. The Process provides a visual overview of the whole process, while Visual View and Source Code View are different ways to display a Block. Their relationship is shown in the following figure:

FIGURE 9.png
Figure 9: The relationship between the four concepts and the three views

2.6 Advanced Content

This section is advanced content, introducing how to transfer data between multiple Blocks and how to use the Decision component in the flowchart. If you are a beginner in Laiye RPA, you can skip it for now.

2.6.1 Input and Output of Flowchart

Both flowcharts and Blocks can use variables to store data. However, the variables in a flowchart can only be used in the flowchart, and its Blocks cannot directly access flowchart variables; similarly, the variables in a Block can only be used in that Block alone and cannot be accessed by the flowchart or other Blocks. Fortunately, Laiye RPA provides a way to transfer data between the flowchart and its Blocks. When a Block starts running, it can take an input value from the flowchart, which is either a variable or an expression, to use within the Block. When a Block stops running, it can also output a value to a variable in the flowchart.

In the flowchart, left-click select a Block, and its properties will appear in the Property area on the right. It contains two fields: input and output, as shown in the left figure of Figure 10. If you need to transfer data from the flowchart into a Block, then fill in the input field with the data to be transferred (variables, expressions, etc.). Doing so creates a special variable called Self.Input within this Block, which has the same value as specified. If you need to transfer data out of a Block, write a Return output value statement inside the Block and provide in the output field, which specifies the name of flowchart variable to receive the Block output.

As we will mention later, the programming language used by Laiye RPA is not case sensitive (for keywords and variable names), meaning that you can write SELF.INPUT, self.input, or RETURN output value, and they are all accepted.

FIGURE 10.png
Figure 10: Flowchart property

Next, we will illustrate the specific use of Block input and output with examples.

Suppose there is a flowchart with two Blocks, named Block 1 and Block 2, as shown in the Figure 11. Block 1 runs first. It obtains the current system time, formats it as a string, and outputs to Block 2. Then, Block 2 starts to run. It displays the output of Block 1 as debug information in Laiye Creator.

FIGURE 11.png
Figure 11: Two Blocks running in sequence

First, select Block 1 and fill in a variable name in its output field, naming it X. Then, select Block 2 and fill in the variable name x as its input property (notice how Laiye RPA is case-insensitive). Through the flowchart variable X, the output of Block 1 and the input of Block 2 are connected, as shown in the Figure 12.

FIGURE 12.png
Figure 12: Connect the output of Block 1 to the input of Block 2 through the same variable

This variable X is only valid in the current flowchart, and its role is just to connect the two Blocks. Neither Block 1 nor Block 2 can access X directly .

Thus we have configured our flowchart. Then, what do we need to set within each Block to interact with the input or output?

First, click the edit button for Block 1 to enter its Visual View. Insert a Get System Time command and Format Time command (under the Time category), and set the Time property in Format Time as the result of Get System Time. Then, you can get the current time and save it in the variable sRet in an easy-to-read format.

Then, insert a Jump Out and Return command (under the Grammar category) and set sRet as the return value, so that Block 1 outputs the correct value, and the value of sRet is stored in the variable X in the flowchart, as shown in Figure 13. In order to help you understand, the figure has both the Visual View and Code View of this Block, and you can choose which one to read.

FIGURE 13.png
Figure 13: Output current time in Block 1

Now, return to the flowchart and click the edit button to enter Block 2. You only need to insert a Output Debug Information command, and set the Content property to Self.Input (In this case, the value of the flowchart variable X has been stored in Self.Input in the Block), as shown figure 14. Similarly, we also provide both the Visual View and Code View of this Block for better understanding.

FIGURE 14.png
Figure 14: Output the output of Block 1 as debug information in Block 2

Return to the flowchart interface and click the Run button. You can see the output of the whole process on the bottom of Laiye Creator. Please note that since Block 2 relies on the output of Block 1, you need to run the entire process (which includes Block 1 and 2) to see the correct result. If you run Block 2 on its own, the results may be different due to the lack of output from Block 1.

2.6.2 Implementation of Complex Flowchart

Some of you may be wondering why Laiye RPA only provides four components: Start, Block, Decision, and End. Moreover, Start and End are not really “powerful” components, but signposts to direct the flow of the process. Is Laiye RPA up to the task for creating complex flowcharts by using only the Block and Decision components?

FIGURE 15.jpg
Figure 15: Complex flowchart

Don't underestimate the components of Laiye RPA. No matter how complex the flowchart is, we can implement it by simply arranging and combining our components.

Let’s break it down. No matter how complex a flowchart is, it can be decomposed into one of three types of structures: sequential, conditional, and iterative. Let's take a look at how these three types of flowcharts are implemented with Laiye RPA respectively.

Sequential Structure

A sequential flowchart has the simplest structure. Each step is executed one after another, in a given order. As shown in Figure 16, A, B, and C are three consecutive steps of the flowchart, and they are executed in order, so the next action begins only after the operation specified in the previous action is completed.

FIGURE 16.png
Figure 16: Sequential structure

In Laiye RPA, you can implement this structure using a sequential flowchart, as shown in Figure 17.

FIGURE 17.png
Figure 17: Sequential flowchart

Conditional Structure

A conditional structure is also called the branching structure. It controls the flow of the process based on some specified condition. If the condition is true, the process takes one route; if the condition is false, the process takes the other route. In practice, you may leave one of the branches empty (see the second and third examples in Figure18).

FIGURE 18.png
Figure 18: Conditional structure

In Laiye RPA, you can implement a conditional structure using a Decision component in the flowchart. See Figure 19.

FIGURE 19.png
Figure 19: Implement conditional structure example 1 in Laiye RPA

FIGURE 20.png
Figure 20: Implement conditional structure examples 2 and 3 in Laiye RPA

Loop Structure

A loop structure is also called a repetition structure. It instructs the process to repeatedly execute a given operation under certain conditions. A loop structure can be classified into a while structure and an until structure.

An loop structure can be seen as a combination of a conditional and go back operation. When implementing in a flowchart, you need to specify a condition in the a Decision component, and one of the two branches of the Decision block points back to the Decision component itself.

While Structure: decide whether some condition P is satisfied. If P is true, then execute step A. Then,loop back to the conditional and decide whether P is true again. If P is true again, then execute step A. Repeat this process indefinitely while P is true, but when P finally evaluates to false, then leave this process.

FIGURE 21.png
Figure 21: While Structure

Until Structure: execute step A, and then decide whether the condition P is satisfied. If P is false, then execute A again. Repeat this process until P is true, then leave this process.

FIGURE 22.png
Figure 22: Until Structure

In Laiye RPA, these loop structures can be implemented by loop flowcharts shown in Figure 23.

FIGURE 23.png
Figure 23: Implement loop flowchart in Laiye RPA

Specifically, Laiye RPA uses the Decision component to implement this logic. Drag a Decision component into the flowchart, and left-click it to view its properties, as shown in Figure 24. The condition parameter is very important, and you may fill in a variable or an expression. When the process reaches this Decision component, it will decide which output branch to continue along based on how condition evaluates.

FIGURE 24.png
Figure 24: Condition

The Decision component has two arrows pointing outwards, one marked with "yes" and one marked with "no". When the Decision component’s condition is true, it continues along the "yes" arrow; otherwise, it continues along the "no" arrow.

FIGURE 25.png
Figure 25: Determine the process based on a conditional expression