Rpa Unit2
Rpa Unit2
Now, click on the Search button beside the search box. It will also get recorded
automatically and the Trash folder will appear.
5 Click on Empty Trash now: Once you are done with clicking on the Trash action, You
can see a link showing Empty Trash now. Hover mouse on this link and it will get
highlighted, click on it to delete all the messages in the Trash folder:
6 Confirm: When you click on Empty Trash now, a confirmation dialog will appear
asking your permission for the action. Just confirm your action by clicking on the OK
button.
In the indicate anchor wizard, we have to indicate the adjacent button, that is, the Cancel
button, so that the recorder will identify that the button is adjacent to Cancel.
Now recording is complete, press Esc to get to the recording dialog. Click on the Save &
Exit button.
Then, in UiPath Studio, you can see a recording sequence in the Designer panel.
Now run it by pressing the; F5 key; it should perform the same task again. You have
created your first Robot, which empties trash from your Gmail!
This diagram is simpler and more detailed than in the Emptying trash in Gmail example; we need
to do exactly the same steps in order to perform this task.
Open UiPath Studio and choose a blank project.
Since we are working in the recorder, and since we are working on the desktop and not a
web application, we are required to choose the desktop recorder:
Start the recorder and simply perform the following steps:
1. Go to the desktop by pressing the Windows + D keys.
2. Open Recycle Bin by clicking on Recycle Bin and then pressing Enter key.
3. Click on the Manage tab of the Recycle Bin folder.
4. Click on the Empty Recycle Bin button.
5. Confirm by clicking on the Yes button in the dialog box.
6. Close the Recycle Bin folder by pressing the cross button.
7. Press the Esc key and Save & Exit the recorder.
selecting the Recycle Bin is recorded, not the Enter key. We should manually add that
step. Search for Send hot key in the Activities window and insert it into the workflow
just below the Select item 'list Desktop' step, as shown in the following screenshot:
Click on the Manage tab of the Recycle Bin folder: This is recorded as it is and so
is the fourth step, click on the Empty Recycle Bin button:
4. confirming by clicking on the Yes button on the dialog box is also recorded
Smoothly:
Module-3
Sequence, Flowchart and Control Flow
2. Search for Sequence in the Activities panel and then drag and drop it into the Flowchart, as shown in
the following screenshot:
3. Double-click on the Sequence. We now have to add the steps that we want to perform. Consider each
step as an action.
We can add many steps inside a Sequence. For the sake of simplicity, we will add
two steps:
Ask for the username in an Input dialog
Display the username in a Message box
4. Search for Input dialog in the Search panel of the Activities panel. Drag and drop the Input dialog
activity inside the Sequence (the Input dialog activity is a dialog box that appears with a message or a
question; in response to which the user is required to put in his or her reply):
Write the appropriate message on the Label of this Input dialog to ask for the user's name. In our case,
we have put in “What’s your name?”.
5. Drag and drop a Message box activity into the Sequence. (A Message box, as the name suggests,
displays a given text. In this case, we will use it to display the text/reply that the user has given in the
Input dialog box on being asked his/her name.)
6. Next, create a variable and give it the desired name. This variable will receive the text that the user has
entered in the Input dialog box in response to our question, that is, the user's name:
7. We now have to specify the Result property (in the Properties panel) of the Input dialog box.
On specifying the variable name there, it will receive the text that the user entered.
Click on the dotted icon that appears on the right side of the Result property.
Now, specify the variable name:
3.2 Activities
Activity represents the unit of an action. Each activity performs some action. When these
activities combine together, it becomes a process.
Every activity resides on the Activities panel of the main Designer panel. You can search for
a particular activity and use it in your project.
For example, when we search for browser, all the browser activities will appear in the Activities
panel, as shown in the following screenshot:
We have seen how we can easily search for a particular activity. Now, let us see how to use
them in a workflow:
1. Search for Flowchart in the same way that we have searched for the browser activities in
the Activities panel search bar. Drag and drop the Flowchart activity inside the Designer panel.
2. The Flowchart appears in the Designer panel and we have a given Start node.
The Start node specifies where the execution begins.
3. We are ready to use different activities in our Flowchart. You can use any
activity/activities inside the Flowchart. For the sake of simplicity, let us just use a
Write line activity.
4. Drag and drop the Write line activity inside the Flowchart. Set its text property
by providing a string value. Connect this Write line activity with the Start node
by right-clicking on the Write line activity and selecting Set as Start Node.
A window will pop up asking for the name. Give it a meaningful name and click on Create.
This will be the name of your workflow:
We have just used activities and extracted them in a workflow. If you check the main
Designer panel, it looks like the following screenshot:
A Flowchart's branches are set to true/false by default. However, its names can be manually
changed from the Properties panel.
1. First, add a Flowchart from the Activities panel into the Designer panel.
2. Add a Sequence activity within the Flowchart.
3. Take two Input dialog activities (for entering the numbers to be added) inside the Sequence activity.
4. Create the variables x and y to save the values.
5. Next, add a Message box activity to perform a mathematical operation. In our case, the sum of the two
numbers is less than 20:
x + y < 20
6. Now, add a Flow Decision activity to check the mathematical operation.
7. If true, the Flow Decision will flow toward the true branch. Otherwise, it will flow towards the false
branch.
Control flow refers to the order or the particular manner in which actions are performed in
an automation. UiPath provides numerous activities for performing the decision-making
process.
These activities, present in the Activities panel, are put into the workflow either
using the double-click method or the drag and drop method.
The Delay activity, as the name suggests, is used to delay or slow down an automation by
pausing it for a defined period of time.
The workflow continues after the specified period of time. It is in the hh:mm:ss format.
This activity plays a significant role when we need a waiting period during automation,
perhaps say, a waiting period required for a particular application to open.
Example: To better understand how the Delay activity works; let us see an example of an
automation that writes two messages to the Output panel with a delay of 50 seconds.
Perform the following steps:
2. Add a Write line activity from the Activities panel and connect it to the Start
node.
3. Select the Write line activity. Now, type the following text into the Text box:
“Hey, what is your name”.
4. Next, add a Delay activity and connect it to the Write line activity.
5. Select the Delay activity and go to the Properties panel. In the Duration field, set
00:00:50. This is a 50-second delay between the two logged messages.
6. Take another Write line activity and connect it to the Delay activity. In the
Text field, write “My name is Andrew Ng,”:
7. After clicking on the Run button, the Output panel shows the message that
delays it by 50 seconds:
The Break activity is used to break/stop the loop at a particular point, and then continue to the
next activity according to the requirement.
It cannot be used for any other activity apart from the For each activity.
It is useful when we want to break the loop to continue to the next activity in the For each activity.
In this example, we will use the Break activity to execute only one iteration. Perform the following steps:
1. Add a Sequence activity to the Designer panel.
2.Next, add a For each activity inside the Sequence (as mentioned in the preceding
section, to use the Break activity, we need the For each activity):
7. In the Write line activity, type Item to string in the text field.
8. When we click the Run button, it will display one element, as shown in the
following screenshot. This is due to the Break activity, which has stopped
execution after the first iteration:
A loop can simply be created by connecting the end of the workflow to the point where we want the
workflow to resume. The While, Do while, and For each activities mentioned among the various
control flow activities are examples of loops.
In the example, we will see how an integer variable will increase from 5 to 50 in
increments of 5.Perform the following steps:
6. Now, go to the Properties panel of the Assign activity and type in the text field
Integer variable for value field integer X+5.
7. Drag and drop a Write line activity and specify the variable name X and apply
Tostring method on this variable:
8. Now, click the Run button. The output will display in the Output panel, as shown in the
following screenshot:
example to understand how the Do while activity works in automation. Take an integer variable. Starting
with this variable, we shall generate all multiples of 2, less than 20.
4. Now, select the Assign activity. Go to the Properties panel and create an integer
variable y. Set its default value to 2.
5. Set y+2 in the value section of the Assign activity to increment the result each
time by 2 until the loop is executed.
8. In the condition section, set the condition y<20. The loop will continue until the
condition holds true:
The For each activity works by iterating each element from the collection of items or list of
elements, one at a time.
In the process, it will execute all the actions that are available inside the body. Thus, it iterates
through the data and processes each piece of information separately.
3. Next, add a For each activity within the Sequence and create an integer type
array variable, X.
4. Add a Write line activity to the Designer Panel (this activity is used to display
the results).
6. In the Text field of the Write line activity, type item. To string to display the output:
7. Now, run the program. You will see that each number of the array is displayed
one by one because of the use of the For each activity:
The If activity and the Switch activity are the Control flow's decision-making activities.
example that checks whether the sum of any two numbers is less than 6.
Perform the following steps:
2. Add two Input dialog activities. Create two integer variables, x and y.
3. In the Properties panel, change the label name and title name of both the Input
dialog activities.
4. Now, specify these name of these two variables in the Result property of both the
Input dialog activities.
6. In the condition part, X+Y<6 check whether it is true or false. Add two Write
line activities and type “True” in one and “False” in the other:
There may be different Sequences doing their jobs. We can easily put similar Sequences into
a workflow; each workflow represents a task.
It is very easy to test a separate workflow alone.
We can see clearly that we have used two activities inside the Sequence that are logically
related (one for inputting the name and the other for popping it up). Here, the Sequence
contains two activities.
3.4.2 How to use a Flowchart
A Flowchart is a container. It can contain activities inside it.
Let us drag and drop a Message box activity inside the Flowchart. Double click on the
Message box and type “Hello World!” in the area where the text is to be quoted. Press F5 to see the
result):
So, when the program has only a few steps, we can use activities directly inside the
Flowchart.
However, it becomes more complex when we have a large number of steps. That
is why it is necessary to arrange the related activities into Sequences and then group the
Sequences into a Flowchart.
Example to see how to use Sequences in the Flowchart.
Perform the following steps:
1. Drag and drop two Flowchart activities on the main Flowchart. Rename them as
Send mail and Message.
We have two different workflows.
The Send Mail workflow will send the mail to an email address.
The Message workflow has the message body of that email and
will ask the user for a name, message, sender, and receiver.
2. We have to implement the desired steps in both workflows. For that, we are using a Sequence inside the
Flowchart.
Double click on the Flowchart. Drag and drop a Sequence activity inside both Flowcharts.
Connect the Sequence to the Start node by right-clicking on the Sequence and selecting
the Set as Start node option.
3. Double click on the Sequence in the Message Flowchart.
Drag and drop four Input dialog activities for the name, message, sender, and receiver.
4. Double click on the Send Mail Flowchart. Double click on the Sequence. You can
drag and drop the email activities here.
5. That's it. Now, go to the main Flowchart. Connect the Message Flowchart to
the Start node. Also, connect the Send Mail activity to the Message Flowchart:
5.Drag and drop a For each activity inside the Sequence. Also, specify the array
name in the expression box of the For each activity. The For each activity is used
to iterate over the array. It will pick up one name from the array each time until it
reaches the end:
7. Now, we are going to use the count variable and increment it each time a name
from an array starts with the letter a.
we have to use the A+B Assign activity. Drag and drop the A+B Assign activity inside the If
activity.
8.Just drag and drop a Message box activity inside the Sequence activity. Specify
the count variable in the expression box of the Message box activity. But
remember, the variable that we have created is of type Int32, so, it cannot be used
with the Message box activity without converting it to a string. To convert it to a
string, we have the ‘.tostring’ method available in UiPath Studio. Just apply
it to the variable and select ‘.tostring:
Memory consists of millions of memory Cells and each memory cell stores data in the form
of 0s and 1s (binary digits).
Each cell has a unique address, and by using this address, the cell can be accessed.
When data is stored in memory, its content gets split into further smaller forms (binary
digits). As shown in the preceding diagram, 2 bytes of data consists of several memory
cells.
A variable is the name that is given to a particular chunk of memory cells or simply a block
of memory and is used to hold data.
A variable is used to store data. Data is present around us in different Types-it can be an mp3
file, text file, string, numbers, and so on.
A particular type of variable can hold only that type of data.
If there is a mismatch between the data and the variable type, then an error occurs.
In UiPath, we can declare a variable in the Variables section. Just give it a meaningful
name and select the appropriate type from the drop-down list.
We can also specify the scope of a variable. The Scope is the region under which the data
has its effect or availability.
You can choose the Scope of the variable according to your requirements; try to limit it as far
as possible.