select chapter

laiye rpa developer guide d1-凯发网站

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.

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.

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:


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.

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: click and edit the block in the flowchart

the interface of visual view that laiye rpa edits a block looks as follows:


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.

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: 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: 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: 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.

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: the relationship between the four concepts and the three views

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.

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: 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: 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: 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: 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: 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.

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: 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: sequential structure

in laiye rpa, you can implement this structure using a sequential flowchart, as shown in figure 17.


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: conditional structure

in laiye rpa, you can implement a conditional structure using a decision component in the flowchart. see figure 19.


figure 19: implement conditional structure example 1 in laiye rpa


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: 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: until structure

in laiye rpa, these loop structures can be implemented by loop flowcharts shown in figure 23.


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: 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: determine the process based on a conditional expression

网站地图