0% found this document useful (0 votes)
16 views20 pages

RPA Unit4

details answer

Uploaded by

jiledoy752
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views20 pages

RPA Unit4

details answer

Uploaded by

jiledoy752
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Robotic Process Automation 18CS745

methods too.

4.6.1 Read cell


This is used to read the value of a cell from an Excel file.

Suppose we have to read the value of the B3 cell:

1. Drag and drop a Flowchart activity on the main Designer panel. Also, drag and
drop an Excel application scope inside the Flowchart. Connect it to the Start node. Double click
on Excel application scope.
2. Drag and drop the Read Cell activity inside the Excel application scope activity.
Specify the range value in the cell text box of the Read Cell activity.

Create a variable of type string to hold the result produced by the Read Cell activity.
In our case, we have created a Result variable.
Specify the Output property of the Read Cell activity by providing the variable's name that we
have created:

Department of ISE, AIT Page 51 of 68


Robotic Process Automation 18CS745

3. Drag and drop a Message box activity inside the Excel application scope activity
and specify the string variable's name (which we created earlier) in the
expression box of the Message box activity.

That's it. Press F5 to see the result.

4.6.2 Write cell

This activity is used to write a value in a cell of an Excel file:

1. Drag and drop a Flowchart activity on the main Designer panel. Also, drag and drop an Excel application
scope inside the Flowchart activity. Connect it to the Start node.

2. Drag and drop a Write Cell activity inside the Excel application scope. Specify the cell value in which we
want to write in the Range property of the Write Cell activity. Also, specify the value of the Value property:

Department of ISE, AIT Page 52 of 68


Robotic Process Automation 18CS745

Press F5 and see the result. Open the Excel file to see the changes:

Department of ISE, AIT Page 53 of 68


Robotic Process Automation 18CS745
4.6.3 Read range

This is used to read the value up to the specified range. If the range parameter is not
specified, it will read the entire Excel file:

1. Drag and drop a Flowchart activity on the main Designer panel. Also, drag and drop an Excel
application scope inside the Flowchart activity. Connect it to the Start node.

2. Drag and drop a Read Range activity inside the Excel application scope activity.
The Read Range activity produces a data table. We have to receive this data table in order to
Consume it. We need to create a data table variable and specify it in the Output property of the Read
Range activity.

3. Drag and drop an Output Data Table activity inside the Excel application scope activity. Now, we
have to specify two properties of the Output Data Table activity: Data Table property and text property.
The Data Table property of the Output Data Table activity is used to convert the data table into a string
format. The text property is used to supply its value in a string format. We have to receive this value in
order to consume it. For this, let us create a variable of type string. Give it a meaningful name (in our case,
it is Result):

Department of ISE, AIT Page 54 of 68


Robotic Process Automation 18CS745
4. Drag and drop a Message box activity inside the Excel application scope activity. Also, specify the
string variable's name that we created earlier inside the Message box activity:

That's it. Press F5 to see the result. A window will pop up displaying your Excel file data.

Department of ISE, AIT Page 55 of 68


Robotic Process Automation 18CS745
4.6.4 Write range

This is used to write a collection of rows into the Excel sheet. It writes to the Excel file in the
form of a data table. Hence, we have to supply a data table:

1. Drag and drop a Build data table activity from the Activities panel.
Double-click on this activity.
A window will pop up.
You will notice that two columns have been generated automatically. Delete these two columns.
Add your column by clicking on the + icon and specify the column name.
You can also select your preferred data type.
You are free to add any number of columns:

Department of ISE, AIT Page 56 of 68


Robotic Process Automation 18CS745

Department of ISE, AIT Page 57 of 68


Robotic Process Automation 18CS745
2. In this project, we are adding two columns.
The procedure for adding the second column is almost the same.
You just have to specify a name and its preferred data type.
We have added one more column (Roll) and set the data type to Int32 for
the data table.
We have also initialized this data table by providing some values
in its rows.
Create a variable of type data table. Give it a meaningful name.
Specify this data table name in the Data table property of the Build data table activity.
We have to supply this variable in order to get the data table that we have built:

Our data table has been built successfully.


3. Drag and drop an Excel application scope inside the main Designer panel.
You can either specify the Excel sheet path or manually select it.
Connect this activity to the Build Data Table activity.
Inside the Excel application scope activity, just drag and drop the Write Range activity:

Department of ISE, AIT Page 58 of 68


Robotic Process Automation 18CS745

4. Specify the data table variable name that we created earlier and set it as a Data table property inside the
Write Range activity.
We can also specify the range. In this case, we have assigned it as an empty string:

That's it. Hit the Run button or press F5 to see the result.

Department of ISE, AIT Page 59 of 68


Robotic Process Automation 18CS745
4.6.5 Append range
 This is used to add more data into an existing Excel file. The data will be appended to the end.

1. Drag and drop the Flowchart activity on the main Designer window. Also, drag
and drop the Excel application scope inside the Flowchart activity.
 Connect it to the Start node.

The Append Range activity requires a data table.

 In this program, we are going to use another sample Excel file, which has some raw data. Then, we
will read this Excel file and append the data to another Excel file.

 First, we have to read its contents:

Department of ISE, AIT Page 60 of 68


Robotic Process Automation 18CS745
2. Drag and drop the Read Range activity inside the Excel application scope activity.
 The Read Range activity produces a data table.
 We have to receive this data table in order to consume it. Create a data table variable and specify it
in the Output property of the Read Range activity:

Department of ISE, AIT Page 61 of 68


Robotic Process Automation 18CS745
3. Drag and drop the Append Range activity inside the Excel application scope
activity.

 Specify the Excel file path in the Append Range activity (in which we
want to append the data).
 Also, specify the data table (which is generated by the Read Range activity):

That's it. Press F5 to see the result:

Department of ISE, AIT Page 62 of 68


Robotic Process Automation 18CS745

We can clearly see that the data has been appended successfully to the Excel sheet.

Department of ISE, AIT Page 63 of 68


Robotic Process Automation 18CS745
4.7 CSV/Excel to data table and vice versa (with a step-by-step example)

We will see how to extract data from an Excel file into a data table and vice
versa. We will achieve this by:

 Reading an Excel file and creating a data table using data from the Excel file
 Creating a data table and then writing all its data to an Excel file.

4.7.1 Reading an Excel file and creating a data table by using data from the Excel file

 We have an existing Excel file and we are going to use it in our project:

1. Drag and drop the Flowchart activity on the main Designer window. Also, drag
and drop the Excel application scope inside the Flowchart.

2. Double-click on the Excel application scope. You have to specify the path of your
workbook/Excel file. Drag and drop the Read Range activity from the Activities
panel inside the Excel application scope.

 The Read Range activity will read the entire Excel sheet. We also have the option
of specifying our range. Create a variable of type data table and specify it in the
Output property of the Read Range activity. This variable will receive the data table
produced by the Read Range activity:

Department of ISE, AIT Page 64 of 68


Robotic Process Automation 18CS745
3. Drag and drop the Output Data Table activity inside the Excel application scope activity.
 Now, we have to specify two properties of the Output Data Table activity:
 the Data Table property and the text property. The Data Table property of the Output Data Table
activity is used to convert the Data Table into string format.
 The text property is used to supply its value in a string format. We have to receive this value in
order to consume it. For this, let us create a variable of type string.
 Give it a meaningful name:

4. Drag and drop a Message box activity inside the Excel application scope
activity.
 Also, specify the string variable's name that we created earlier inside the
Message box activity.

That's it. Press F5 to see the result. A window displaying the Excel file data will pop up.

Department of ISE, AIT Page 65 of 68


Robotic Process Automation 18CS745
4.7.2 Creating a data table and then writing all its data to an Excel file

we will build a data table dynamically and then write all its data to an Excel
file:

1. Drag and drop a Build data table activity from the Activities panel. Double-click
on this activity. A window will pop up. Two columns have been generated
automatically; delete these two columns. Add your column by clicking on the
+ icon and specify the column name. You can also select your preferred data type.
You are free to add any number of columns:

In this project, we are adding two columns. The procedure for adding the second column is almost the
same. You just have to specify a name and its preferred data type. We have added one more column (Roll) and set
the data type to Int32 in the data table. We have also initialized this data table by giving some values to its rows.

Create a variable of type Data Table. Give it a meaningful name. Specify this data
table's name in the Data Table property of the Build data table activity. We have
to supply this variable in order to get the data table that we have built:

Department of ISE, AIT Page 66 of 68


Robotic Process Automation 18CS745

Our data table has been built successfully.


2. Drag and drop the Excel application scope inside the main Designer window.

Specify the Excel sheet's path or manually select it. Connect this activity to the
Build Data table activity:

Department of ISE, AIT Page 67 of 68


Robotic Process Automation 18CS745

3. Inside the Excel application scope activity, drag and drop the Write
Range activity.

Specify the data table variable name that we created earlier and set it as a
Data table property inside the Write Range activity.

We can also specify the range. In this case, we have assigned it as an empty string:

4. That's it. Hit the Run button or press F5 to see the result.

Department of ISE, AIT Page 68 of 68


Robotic Process Automation 18CS745

Module 4

Chapter 5: Taking Control of the


Controls
Introduction
In this chapter we will learn how we can interact with the controls in the UI. Sometimes, you may
need to click on a particular button or extract information from a textbox. Either we take some
action on a control, or we read/write. We will go into detail on how to do this accurately.

Extraction is a primary feature of RPA, enabling UI automation. Behind the scenes, many
technologies are at work on the seamless extraction of information from the UI. When typical
RPA techniques are not successful, OCR technology is used to extract information. We will
learn about using OCR and other techniques in the following topics:
a.Screen Scraping
b.When to use OCR
c.Types of OCR available
d.How to use OCR

5.1 Finding and attaching windows


we are going to use the Attach Window activity.

The Attach Window activity can be found in the Activities panel.

This activity is generally used to attach an already opened window.

It is also auto-generated when we record actions using the Basic or Desktop recorder.

Implementing the Attach Window activity

In this example, we shall use the Attach Window activity manually. Here, we are going to
attach a Notepad window and then write some text into it:

1. Create a blank project and give it a meaningful name.


2.  Drag and drop a Flowchart activity on the Designer panel.
Also, drag and drop a Click activity inside the Designer panel.
Set this Click activity as the Start node.

Department of ISE, AIT Page 1 of 39


1|P age
Robotic Process Automation 18CS745
3. Double-click on the Click activity and then click on Indicate on screen. Locate the Notepad
icon.
4. Drag and drop the Attach Window activity on the main Designer panel. Connect the Attach
Window activity to the Click activity.

5. Double-click on the Attach Window activity. Click on Click Window on Screen and
indicate the Notepad window. The Notepad window is now attached to the previous activity:

6.For the sake of completeness, we are going to add a Type into activity.
Just drag and drop the Type into activity, inside the Attach Window activity.
 Click on the Indicate element inside window and
Locate the Notepad window where you want to write the text.
 Write the text in the Text property of the Type into the activity.
7. Hit the Run button.

Department of ISE, AIT Page 2 of 39

You might also like